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) => () => {
10 module2 = {exports: {}};
11 callback(module2.exports, module2);
13 return module2.exports;
15 var __export = (target, all) => {
16 __markAsModule(target);
18 __defProp(target, name, {get: all[name], enumerable: true});
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});
29 var __toModule = (module2) => {
30 if (module2 && module2.__esModule)
32 return __exportStar(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true}), module2);
35 // node_modules/vscode-jsonrpc/lib/is.js
36 var require_is = __commonJS((exports2) => {
38 Object.defineProperty(exports2, "__esModule", {value: true});
39 function boolean(value) {
40 return value === true || value === false;
42 exports2.boolean = boolean;
43 function string(value) {
44 return typeof value === "string" || value instanceof String;
46 exports2.string = string;
47 function number(value) {
48 return typeof value === "number" || value instanceof Number;
50 exports2.number = number;
51 function error(value) {
52 return value instanceof Error;
54 exports2.error = error;
55 function func(value) {
56 return typeof value === "function";
59 function array(value) {
60 return Array.isArray(value);
62 exports2.array = array;
63 function stringArray(value) {
64 return array(value) && value.every((elem) => string(elem));
66 exports2.stringArray = stringArray;
69 // node_modules/vscode-jsonrpc/lib/messages.js
70 var require_messages = __commonJS((exports2) => {
72 Object.defineProperty(exports2, "__esModule", {value: true});
73 var is = require_is();
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) {
93 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
95 Object.setPrototypeOf(this, ResponseError.prototype);
100 message: this.message,
105 exports2.ResponseError = ResponseError;
106 var AbstractMessageType = class {
107 constructor(_method, _numberOfParams) {
108 this._method = _method;
109 this._numberOfParams = _numberOfParams;
114 get numberOfParams() {
115 return this._numberOfParams;
118 exports2.AbstractMessageType = AbstractMessageType;
119 var RequestType0 = class extends AbstractMessageType {
120 constructor(method) {
124 exports2.RequestType0 = RequestType0;
125 var RequestType2 = class extends AbstractMessageType {
126 constructor(method) {
130 exports2.RequestType = RequestType2;
131 var RequestType1 = class extends AbstractMessageType {
132 constructor(method) {
136 exports2.RequestType1 = RequestType1;
137 var RequestType22 = class extends AbstractMessageType {
138 constructor(method) {
142 exports2.RequestType2 = RequestType22;
143 var RequestType3 = class extends AbstractMessageType {
144 constructor(method) {
148 exports2.RequestType3 = RequestType3;
149 var RequestType4 = class extends AbstractMessageType {
150 constructor(method) {
154 exports2.RequestType4 = RequestType4;
155 var RequestType5 = class extends AbstractMessageType {
156 constructor(method) {
160 exports2.RequestType5 = RequestType5;
161 var RequestType6 = class extends AbstractMessageType {
162 constructor(method) {
166 exports2.RequestType6 = RequestType6;
167 var RequestType7 = class extends AbstractMessageType {
168 constructor(method) {
172 exports2.RequestType7 = RequestType7;
173 var RequestType8 = class extends AbstractMessageType {
174 constructor(method) {
178 exports2.RequestType8 = RequestType8;
179 var RequestType9 = class extends AbstractMessageType {
180 constructor(method) {
184 exports2.RequestType9 = RequestType9;
185 var NotificationType2 = class extends AbstractMessageType {
186 constructor(method) {
191 exports2.NotificationType = NotificationType2;
192 var NotificationType02 = class extends AbstractMessageType {
193 constructor(method) {
197 exports2.NotificationType0 = NotificationType02;
198 var NotificationType1 = class extends AbstractMessageType {
199 constructor(method) {
203 exports2.NotificationType1 = NotificationType1;
204 var NotificationType22 = class extends AbstractMessageType {
205 constructor(method) {
209 exports2.NotificationType2 = NotificationType22;
210 var NotificationType3 = class extends AbstractMessageType {
211 constructor(method) {
215 exports2.NotificationType3 = NotificationType3;
216 var NotificationType4 = class extends AbstractMessageType {
217 constructor(method) {
221 exports2.NotificationType4 = NotificationType4;
222 var NotificationType5 = class extends AbstractMessageType {
223 constructor(method) {
227 exports2.NotificationType5 = NotificationType5;
228 var NotificationType6 = class extends AbstractMessageType {
229 constructor(method) {
233 exports2.NotificationType6 = NotificationType6;
234 var NotificationType7 = class extends AbstractMessageType {
235 constructor(method) {
239 exports2.NotificationType7 = NotificationType7;
240 var NotificationType8 = class extends AbstractMessageType {
241 constructor(method) {
245 exports2.NotificationType8 = NotificationType8;
246 var NotificationType9 = class extends AbstractMessageType {
247 constructor(method) {
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));
256 exports2.isRequestMessage = isRequestMessage;
257 function isNotificationMessage(message) {
258 let candidate = message;
259 return candidate && is.string(candidate.method) && message.id === void 0;
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);
266 exports2.isResponseMessage = isResponseMessage;
269 // node_modules/vscode-jsonrpc/lib/events.js
270 var require_events = __commonJS((exports2) => {
272 Object.defineProperty(exports2, "__esModule", {value: true});
274 (function(Disposable4) {
275 function create(func) {
280 Disposable4.create = create;
281 })(Disposable3 = exports2.Disposable || (exports2.Disposable = {}));
284 const _disposable = {dispose() {
286 Event2.None = function() {
289 })(Event = exports2.Event || (exports2.Event = {}));
290 var CallbackList = class {
291 add(callback, context = null, bucket) {
292 if (!this._callbacks) {
293 this._callbacks = [];
296 this._callbacks.push(callback);
297 this._contexts.push(context);
298 if (Array.isArray(bucket)) {
299 bucket.push({dispose: () => this.remove(callback, context)});
302 remove(callback, context = null) {
303 if (!this._callbacks) {
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);
314 foundCallbackWithDifferentContext = true;
318 if (foundCallbackWithDifferentContext) {
319 throw new Error("When adding a listener with a context, you should remove it with the same context");
323 if (!this._callbacks) {
326 var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
327 for (var i = 0, len = callbacks.length; i < len; i++) {
329 ret.push(callbacks[i].apply(contexts[i], args));
337 return !this._callbacks || this._callbacks.length === 0;
340 this._callbacks = void 0;
341 this._contexts = void 0;
344 var Emitter = class {
345 constructor(_options) {
346 this._options = _options;
350 this._event = (listener, thisArgs, disposables) => {
351 if (!this._callbacks) {
352 this._callbacks = new CallbackList();
354 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
355 this._options.onFirstListenerAdd(this);
357 this._callbacks.add(listener, thisArgs);
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);
368 if (Array.isArray(disposables)) {
369 disposables.push(result);
377 if (this._callbacks) {
378 this._callbacks.invoke.call(this._callbacks, event);
382 if (this._callbacks) {
383 this._callbacks.dispose();
384 this._callbacks = void 0;
388 exports2.Emitter = Emitter;
389 Emitter._noop = function() {
393 // node_modules/vscode-jsonrpc/lib/messageReader.js
394 var require_messageReader = __commonJS((exports2) => {
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];
403 var MessageBuffer = class {
404 constructor(encoding = "utf8") {
405 this.encoding = encoding;
407 this.buffer = Buffer.allocUnsafe(DefaultSize);
410 var toAppend = chunk;
411 if (typeof chunk === "string") {
413 var bufferLen = Buffer.byteLength(str, this.encoding);
414 toAppend = Buffer.allocUnsafe(bufferLen);
415 toAppend.write(str, 0, bufferLen, this.encoding);
417 if (this.buffer.length - this.index >= toAppend.length) {
418 toAppend.copy(this.buffer, this.index, 0, toAppend.length);
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);
425 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
428 this.index += toAppend.length;
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)) {
436 if (current + 3 >= this.index) {
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(":");
444 throw new Error("Message header must separate key and value using :");
446 let key = header.substr(0, index);
447 let value = header.substr(index + 1).trim();
450 let nextStart = current + 4;
451 this.buffer = this.buffer.slice(nextStart);
452 this.index = this.index - nextStart;
455 tryReadContent(length) {
456 if (this.index < length) {
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;
465 get numberOfBytes() {
470 (function(MessageReader2) {
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);
475 MessageReader2.is = is;
476 })(MessageReader = exports2.MessageReader || (exports2.MessageReader = {}));
477 var AbstractMessageReader = class {
479 this.errorEmitter = new events_1.Emitter();
480 this.closeEmitter = new events_1.Emitter();
481 this.partialMessageEmitter = new events_1.Emitter();
484 this.errorEmitter.dispose();
485 this.closeEmitter.dispose();
488 return this.errorEmitter.event;
491 this.errorEmitter.fire(this.asError(error));
494 return this.closeEmitter.event;
497 this.closeEmitter.fire(void 0);
499 get onPartialMessage() {
500 return this.partialMessageEmitter.event;
502 firePartialMessage(info) {
503 this.partialMessageEmitter.fire(info);
506 if (error instanceof Error) {
509 return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`);
513 exports2.AbstractMessageReader = AbstractMessageReader;
514 var StreamMessageReader = class extends AbstractMessageReader {
515 constructor(readable, encoding = "utf8") {
517 this.readable = readable;
518 this.buffer = new MessageBuffer(encoding);
519 this._partialMessageTimeout = 1e4;
521 set partialMessageTimeout(timeout) {
522 this._partialMessageTimeout = timeout;
524 get partialMessageTimeout() {
525 return this._partialMessageTimeout;
528 this.nextMessageLength = -1;
529 this.messageToken = 0;
530 this.partialMessageTimer = void 0;
531 this.callback = callback;
532 this.readable.on("data", (data) => {
535 this.readable.on("error", (error) => this.fireError(error));
536 this.readable.on("close", () => this.fireClose());
539 this.buffer.append(data);
541 if (this.nextMessageLength === -1) {
542 let headers = this.buffer.tryReadHeaders();
546 let contentLength = headers["Content-Length"];
547 if (!contentLength) {
548 throw new Error("Header must provide a Content-Length property.");
550 let length = parseInt(contentLength);
552 throw new Error("Content-Length value must be a number.");
554 this.nextMessageLength = length;
556 var msg = this.buffer.tryReadContent(this.nextMessageLength);
558 this.setPartialMessageTimer();
561 this.clearPartialMessageTimer();
562 this.nextMessageLength = -1;
564 var json = JSON.parse(msg);
568 clearPartialMessageTimer() {
569 if (this.partialMessageTimer) {
570 clearTimeout(this.partialMessageTimer);
571 this.partialMessageTimer = void 0;
574 setPartialMessageTimer() {
575 this.clearPartialMessageTimer();
576 if (this._partialMessageTimeout <= 0) {
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();
585 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
588 exports2.StreamMessageReader = StreamMessageReader;
589 var IPCMessageReader = class extends AbstractMessageReader {
590 constructor(process2) {
592 this.process = process2;
593 let eventEmitter = this.process;
594 eventEmitter.on("error", (error) => this.fireError(error));
595 eventEmitter.on("close", () => this.fireClose());
598 this.process.on("message", callback);
601 exports2.IPCMessageReader = IPCMessageReader;
602 var SocketMessageReader = class extends StreamMessageReader {
603 constructor(socket, encoding = "utf-8") {
604 super(socket, encoding);
607 exports2.SocketMessageReader = SocketMessageReader;
610 // node_modules/vscode-jsonrpc/lib/messageWriter.js
611 var require_messageWriter = __commonJS((exports2) => {
613 Object.defineProperty(exports2, "__esModule", {value: true});
614 var events_1 = require_events();
615 var Is2 = require_is();
616 var ContentLength = "Content-Length: ";
619 (function(MessageWriter2) {
621 let candidate = value;
622 return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write);
624 MessageWriter2.is = is;
625 })(MessageWriter = exports2.MessageWriter || (exports2.MessageWriter = {}));
626 var AbstractMessageWriter = class {
628 this.errorEmitter = new events_1.Emitter();
629 this.closeEmitter = new events_1.Emitter();
632 this.errorEmitter.dispose();
633 this.closeEmitter.dispose();
636 return this.errorEmitter.event;
638 fireError(error, message, count) {
639 this.errorEmitter.fire([this.asError(error), message, count]);
642 return this.closeEmitter.event;
645 this.closeEmitter.fire(void 0);
648 if (error instanceof Error) {
651 return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`);
655 exports2.AbstractMessageWriter = AbstractMessageWriter;
656 var StreamMessageWriter = class extends AbstractMessageWriter {
657 constructor(writable, encoding = "utf8") {
659 this.writable = writable;
660 this.encoding = encoding;
662 this.writable.on("error", (error) => this.fireError(error));
663 this.writable.on("close", () => this.fireClose());
666 let json = JSON.stringify(msg);
667 let contentLength = Buffer.byteLength(json, this.encoding);
670 contentLength.toString(),
675 this.writable.write(headers.join(""), "ascii");
676 this.writable.write(json, this.encoding);
680 this.fireError(error, msg, this.errorCount);
684 exports2.StreamMessageWriter = StreamMessageWriter;
685 var IPCMessageWriter = class extends AbstractMessageWriter {
686 constructor(process2) {
688 this.process = process2;
691 this.sending = false;
692 let eventEmitter = this.process;
693 eventEmitter.on("error", (error) => this.fireError(error));
694 eventEmitter.on("close", () => this.fireClose);
697 if (!this.sending && this.queue.length === 0) {
698 this.doWriteMessage(msg);
700 this.queue.push(msg);
703 doWriteMessage(msg) {
705 if (this.process.send) {
707 this.process.send(msg, void 0, void 0, (error) => {
708 this.sending = false;
711 this.fireError(error, msg, this.errorCount);
715 if (this.queue.length > 0) {
716 this.doWriteMessage(this.queue.shift());
722 this.fireError(error, msg, this.errorCount);
726 exports2.IPCMessageWriter = IPCMessageWriter;
727 var SocketMessageWriter = class extends AbstractMessageWriter {
728 constructor(socket, encoding = "utf8") {
730 this.socket = socket;
732 this.sending = false;
733 this.encoding = encoding;
735 this.socket.on("error", (error) => this.fireError(error));
736 this.socket.on("close", () => this.fireClose());
740 this.socket.destroy();
743 if (!this.sending && this.queue.length === 0) {
744 this.doWriteMessage(msg);
746 this.queue.push(msg);
749 doWriteMessage(msg) {
750 let json = JSON.stringify(msg);
751 let contentLength = Buffer.byteLength(json, this.encoding);
754 contentLength.toString(),
760 this.socket.write(headers.join(""), "ascii", (error) => {
762 this.handleError(error, msg);
765 this.socket.write(json, this.encoding, (error2) => {
766 this.sending = false;
768 this.handleError(error2, msg);
772 if (this.queue.length > 0) {
773 this.doWriteMessage(this.queue.shift());
777 this.handleError(error2, msg);
781 this.handleError(error, msg);
784 handleError(error, msg) {
786 this.fireError(error, msg, this.errorCount);
789 exports2.SocketMessageWriter = SocketMessageWriter;
792 // node_modules/vscode-jsonrpc/lib/cancellation.js
793 var require_cancellation = __commonJS((exports2) => {
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
804 CancellationToken2.Cancelled = Object.freeze({
805 isCancellationRequested: true,
806 onCancellationRequested: events_1.Event.None
809 let candidate = value;
810 return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
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);
817 clearTimeout(handle);
820 var MutableToken = class {
822 this._isCancelled = false;
825 if (!this._isCancelled) {
826 this._isCancelled = true;
828 this._emitter.fire(void 0);
833 get isCancellationRequested() {
834 return this._isCancelled;
836 get onCancellationRequested() {
837 if (this._isCancelled) {
838 return shortcutEvent;
840 if (!this._emitter) {
841 this._emitter = new events_1.Emitter();
843 return this._emitter.event;
847 this._emitter.dispose();
848 this._emitter = void 0;
852 var CancellationTokenSource = class {
855 this._token = new MutableToken();
861 this._token = CancellationToken.Cancelled;
863 this._token.cancel();
868 this._token = CancellationToken.None;
869 } else if (this._token instanceof MutableToken) {
870 this._token.dispose();
874 exports2.CancellationTokenSource = CancellationTokenSource;
877 // node_modules/vscode-jsonrpc/lib/linkedMap.js
878 var require_linkedMap = __commonJS((exports2) => {
880 Object.defineProperty(exports2, "__esModule", {value: true});
886 })(Touch = exports2.Touch || (exports2.Touch = {}));
887 var LinkedMap = class {
889 this._map = new Map();
901 return !this._head && !this._tail;
907 return this._map.has(key);
910 const item = this._map.get(key);
916 set(key, value, touch = Touch.None) {
917 let item = this._map.get(key);
920 if (touch !== Touch.None) {
921 this.touch(item, touch);
924 item = {key, value, next: void 0, previous: void 0};
927 this.addItemLast(item);
930 this.addItemFirst(item);
933 this.addItemLast(item);
936 this.addItemLast(item);
939 this._map.set(key, item);
944 const item = this._map.get(key);
948 this._map.delete(key);
949 this.removeItem(item);
954 if (!this._head && !this._tail) {
957 if (!this._head || !this._tail) {
958 throw new Error("Invalid list");
960 const item = this._head;
961 this._map.delete(item.key);
962 this.removeItem(item);
966 forEach(callbackfn, thisArg) {
967 let current = this._head;
970 callbackfn.bind(thisArg)(current.value, current.key, this);
972 callbackfn(current.value, current.key, this);
974 current = current.next;
977 forEachReverse(callbackfn, thisArg) {
978 let current = this._tail;
981 callbackfn.bind(thisArg)(current.value, current.key, this);
983 callbackfn(current.value, current.key, this);
985 current = current.previous;
990 let current = this._head;
992 result.push(current.value);
993 current = current.next;
999 let current = this._head;
1001 result.push(current.key);
1002 current = current.next;
1006 addItemFirst(item) {
1007 if (!this._head && !this._tail) {
1009 } else if (!this._head) {
1010 throw new Error("Invalid list");
1012 item.next = this._head;
1013 this._head.previous = item;
1018 if (!this._head && !this._tail) {
1020 } else if (!this._tail) {
1021 throw new Error("Invalid list");
1023 item.previous = this._tail;
1024 this._tail.next = 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;
1037 const next = item.next;
1038 const previous = item.previous;
1039 if (!next || !previous) {
1040 throw new Error("Invalid list");
1042 next.previous = previous;
1043 previous.next = next;
1046 touch(item, touch) {
1047 if (!this._head || !this._tail) {
1048 throw new Error("Invalid list");
1050 if (touch !== Touch.First && touch !== Touch.Last) {
1053 if (touch === Touch.First) {
1054 if (item === this._head) {
1057 const next = item.next;
1058 const previous = item.previous;
1059 if (item === this._tail) {
1060 previous.next = void 0;
1061 this._tail = previous;
1063 next.previous = previous;
1064 previous.next = next;
1066 item.previous = void 0;
1067 item.next = this._head;
1068 this._head.previous = item;
1070 } else if (touch === Touch.Last) {
1071 if (item === this._tail) {
1074 const next = item.next;
1075 const previous = item.previous;
1076 if (item === this._head) {
1077 next.previous = void 0;
1080 next.previous = previous;
1081 previous.next = next;
1084 item.previous = this._tail;
1085 this._tail.next = item;
1090 exports2.LinkedMap = LinkedMap;
1093 // node_modules/vscode-jsonrpc/lib/pipeSupport.js
1094 var require_pipeSupport = __commonJS((exports2) => {
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`;
1108 return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);
1111 exports2.generateRandomPipeName = generateRandomPipeName;
1112 function createClientPipeTransport(pipeName, encoding = "utf-8") {
1114 let connected = new Promise((resolve, _reject) => {
1115 connectResolve = resolve;
1117 return new Promise((resolve, reject) => {
1118 let server = net_1.createServer((socket) => {
1121 new messageReader_1.SocketMessageReader(socket, encoding),
1122 new messageWriter_1.SocketMessageWriter(socket, encoding)
1125 server.on("error", reject);
1126 server.listen(pipeName, () => {
1127 server.removeListener("error", reject);
1129 onConnected: () => {
1136 exports2.createClientPipeTransport = createClientPipeTransport;
1137 function createServerPipeTransport(pipeName, encoding = "utf-8") {
1138 const socket = net_1.createConnection(pipeName);
1140 new messageReader_1.SocketMessageReader(socket, encoding),
1141 new messageWriter_1.SocketMessageWriter(socket, encoding)
1144 exports2.createServerPipeTransport = createServerPipeTransport;
1147 // node_modules/vscode-jsonrpc/lib/socketSupport.js
1148 var require_socketSupport = __commonJS((exports2) => {
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") {
1156 let connected = new Promise((resolve, _reject) => {
1157 connectResolve = resolve;
1159 return new Promise((resolve, reject) => {
1160 let server = net_1.createServer((socket) => {
1163 new messageReader_1.SocketMessageReader(socket, encoding),
1164 new messageWriter_1.SocketMessageWriter(socket, encoding)
1167 server.on("error", reject);
1168 server.listen(port, "127.0.0.1", () => {
1169 server.removeListener("error", reject);
1171 onConnected: () => {
1178 exports2.createClientSocketTransport = createClientSocketTransport;
1179 function createServerSocketTransport(port, encoding = "utf-8") {
1180 const socket = net_1.createConnection(port, "127.0.0.1");
1182 new messageReader_1.SocketMessageReader(socket, encoding),
1183 new messageWriter_1.SocketMessageWriter(socket, encoding)
1186 exports2.createServerSocketTransport = createServerSocketTransport;
1189 // node_modules/vscode-jsonrpc/lib/main.js
1190 var require_main = __commonJS((exports2) => {
1192 function __export2(m) {
1194 if (!exports2.hasOwnProperty(p))
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 {
1256 exports2.ProgressType = ProgressType;
1257 exports2.NullLogger = Object.freeze({
1269 Trace2[Trace2["Off"] = 0] = "Off";
1270 Trace2[Trace2["Messages"] = 1] = "Messages";
1271 Trace2[Trace2["Verbose"] = 2] = "Verbose";
1272 })(Trace = exports2.Trace || (exports2.Trace = {}));
1274 function fromString(value) {
1275 if (!Is2.string(value)) {
1278 value = value.toLowerCase();
1283 return Trace2.Messages;
1285 return Trace2.Verbose;
1290 Trace2.fromString = fromString;
1291 function toString(value) {
1295 case Trace2.Messages:
1297 case Trace2.Verbose:
1303 Trace2.toString = toString;
1304 })(Trace = exports2.Trace || (exports2.Trace = {}));
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;
1316 return TraceFormat2.Text;
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) {
1339 Object.setPrototypeOf(this, ConnectionError.prototype);
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);
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();
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;
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();
1384 function createResponseQueueKey(id) {
1386 return "res-unknown-" + (++unknownResponseSquenceNumber).toString();
1388 return "res-" + id.toString();
1391 function createNotificationQueueKey() {
1392 return "not-" + (++notificationSquenceNumber).toString();
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);
1400 queue.set(createNotificationQueueKey(), message);
1403 function cancelUndispatched(_message) {
1406 function isListening() {
1407 return state === ConnectionState.Listening;
1409 function isClosed() {
1410 return state === ConnectionState.Closed;
1412 function isDisposed() {
1413 return state === ConnectionState.Disposed;
1415 function closeHandler() {
1416 if (state === ConnectionState.New || state === ConnectionState.Listening) {
1417 state = ConnectionState.Closed;
1418 closeEmitter.fire(void 0);
1421 function readErrorHandler(error) {
1422 errorEmitter.fire([error, void 0, void 0]);
1424 function writeErrorHandler(data) {
1425 errorEmitter.fire(data);
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) {
1435 timer = setImmediate(() => {
1437 processMessageQueue();
1440 function processMessageQueue() {
1441 if (messageQueue.size === 0) {
1444 let message = messageQueue.shift();
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);
1453 handleInvalidMessage(message);
1456 triggerMessageQueue();
1459 let callback = (message) => {
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);
1475 addMessageToQueue(messageQueue, message);
1477 triggerMessageQueue();
1480 function handleRequest(requestMessage) {
1484 function reply(resultOrError, method, startTime2) {
1487 id: requestMessage.id
1489 if (resultOrError instanceof messages_1.ResponseError) {
1490 message.error = resultOrError.toJson();
1492 message.result = resultOrError === void 0 ? null : resultOrError;
1494 traceSendingResponse(message, method, startTime2);
1495 messageWriter.write(message);
1497 function replyError(error, method, startTime2) {
1500 id: requestMessage.id,
1501 error: error.toJson()
1503 traceSendingResponse(message, method, startTime2);
1504 messageWriter.write(message);
1506 function replySuccess(result, method, startTime2) {
1507 if (result === void 0) {
1512 id: requestMessage.id,
1515 traceSendingResponse(message, method, startTime2);
1516 messageWriter.write(message);
1518 traceReceivedRequest(requestMessage);
1519 let element = requestHandlers[requestMessage.method];
1523 type = element.type;
1524 requestHandler = element.handler;
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;
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);
1538 handlerResult = requestHandler ? requestHandler(requestMessage.params, cancellationSource.token) : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
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);
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);
1555 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
1559 delete requestTokens[tokenKey];
1560 reply(handlerResult, requestMessage.method, startTime);
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);
1569 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
1573 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
1576 function handleResponse(responseMessage) {
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)}`);
1585 logger.error(`Received response message without id. No further error information provided.`);
1588 let key = String(responseMessage.id);
1589 let responsePromise = responsePromises[key];
1590 traceReceivedResponse(responseMessage, responsePromise);
1591 if (responsePromise) {
1592 delete responsePromises[key];
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);
1600 throw new Error("Should never happen.");
1603 if (error.message) {
1604 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
1606 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
1612 function handleNotification(message) {
1617 let notificationHandler;
1618 if (message.method === CancelNotification.type.method) {
1619 notificationHandler = (params) => {
1621 let source = requestTokens[String(id)];
1627 let element = notificationHandlers[message.method];
1629 notificationHandler = element.handler;
1630 type = element.type;
1633 if (notificationHandler || starNotificationHandler) {
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);
1641 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
1644 if (error.message) {
1645 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
1647 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
1651 unhandledNotificationEmitter.fire(message);
1654 function handleInvalidMessage(message) {
1656 logger.error("Received empty message.");
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."));
1670 function traceSendingRequest(message) {
1671 if (trace === Trace.Off || !tracer) {
1674 if (traceFormat === TraceFormat.Text) {
1676 if (trace === Trace.Verbose && message.params) {
1677 data = `Params: ${JSON.stringify(message.params, null, 4)}
1681 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
1683 logLSPMessage("send-request", message);
1686 function traceSendingNotification(message) {
1687 if (trace === Trace.Off || !tracer) {
1690 if (traceFormat === TraceFormat.Text) {
1692 if (trace === Trace.Verbose) {
1693 if (message.params) {
1694 data = `Params: ${JSON.stringify(message.params, null, 4)}
1698 data = "No parameters provided.\n\n";
1701 tracer.log(`Sending notification '${message.method}'.`, data);
1703 logLSPMessage("send-notification", message);
1706 function traceSendingResponse(message, method, startTime) {
1707 if (trace === Trace.Off || !tracer) {
1710 if (traceFormat === TraceFormat.Text) {
1712 if (trace === Trace.Verbose) {
1713 if (message.error && message.error.data) {
1714 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
1718 if (message.result) {
1719 data = `Result: ${JSON.stringify(message.result, null, 4)}
1722 } else if (message.error === void 0) {
1723 data = "No result returned.\n\n";
1727 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
1729 logLSPMessage("send-response", message);
1732 function traceReceivedRequest(message) {
1733 if (trace === Trace.Off || !tracer) {
1736 if (traceFormat === TraceFormat.Text) {
1738 if (trace === Trace.Verbose && message.params) {
1739 data = `Params: ${JSON.stringify(message.params, null, 4)}
1743 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
1745 logLSPMessage("receive-request", message);
1748 function traceReceivedNotification(message) {
1749 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
1752 if (traceFormat === TraceFormat.Text) {
1754 if (trace === Trace.Verbose) {
1755 if (message.params) {
1756 data = `Params: ${JSON.stringify(message.params, null, 4)}
1760 data = "No parameters provided.\n\n";
1763 tracer.log(`Received notification '${message.method}'.`, data);
1765 logLSPMessage("receive-notification", message);
1768 function traceReceivedResponse(message, responsePromise) {
1769 if (trace === Trace.Off || !tracer) {
1772 if (traceFormat === TraceFormat.Text) {
1774 if (trace === Trace.Verbose) {
1775 if (message.error && message.error.data) {
1776 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
1780 if (message.result) {
1781 data = `Result: ${JSON.stringify(message.result, null, 4)}
1784 } else if (message.error === void 0) {
1785 data = "No result returned.\n\n";
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);
1793 tracer.log(`Received response ${message.id} without active response promise.`, data);
1796 logLSPMessage("receive-response", message);
1799 function logLSPMessage(type, message) {
1800 if (!tracer || trace === Trace.Off) {
1803 const lspMessage = {
1807 timestamp: Date.now()
1809 tracer.log(lspMessage);
1811 function throwIfClosedOrDisposed() {
1813 throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed.");
1816 throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed.");
1819 function throwIfListening() {
1820 if (isListening()) {
1821 throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
1824 function throwIfNotListening() {
1825 if (!isListening()) {
1826 throw new Error("Call listen() first.");
1829 function undefinedToNull(param) {
1830 if (param === void 0) {
1836 function computeMessageParams(type, params) {
1838 let numberOfParams = type.numberOfParams;
1839 switch (numberOfParams) {
1844 result = undefinedToNull(params[0]);
1848 for (let i = 0; i < params.length && i < numberOfParams; i++) {
1849 result.push(undefinedToNull(params[i]));
1851 if (params.length < numberOfParams) {
1852 for (let i = params.length; i < numberOfParams; i++) {
1861 sendNotification: (type, ...params) => {
1862 throwIfClosedOrDisposed();
1865 if (Is2.string(type)) {
1867 switch (params.length) {
1869 messageParams = null;
1872 messageParams = params[0];
1875 messageParams = params;
1879 method = type.method;
1880 messageParams = computeMessageParams(type, params);
1882 let notificationMessage = {
1885 params: messageParams
1887 traceSendingNotification(notificationMessage);
1888 messageWriter.write(notificationMessage);
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};
1898 notificationHandlers[type.method] = {type, handler};
1902 onProgress: (_type, token, handler) => {
1903 if (progressHandlers.has(token)) {
1904 throw new Error(`Progress handler for token ${token} already registered`);
1906 progressHandlers.set(token, handler);
1909 progressHandlers.delete(token);
1913 sendProgress: (_type, token, value) => {
1914 connection.sendNotification(ProgressNotification.type, {token, value});
1916 onUnhandledProgress: unhandledProgressEmitter.event,
1917 sendRequest: (type, ...params) => {
1918 throwIfClosedOrDisposed();
1919 throwIfNotListening();
1923 if (Is2.string(type)) {
1925 switch (params.length) {
1927 messageParams = null;
1930 if (cancellation_1.CancellationToken.is(params[0])) {
1931 messageParams = null;
1934 messageParams = undefinedToNull(params[0]);
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]);
1944 messageParams = params.slice(0, last).map((value) => undefinedToNull(value));
1947 messageParams = params.map((value) => undefinedToNull(value));
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;
1957 let id = sequenceNumber++;
1958 let result = new Promise((resolve, reject) => {
1959 let requestMessage = {
1963 params: messageParams
1965 let responsePromise = {method, timerStart: Date.now(), resolve, reject};
1966 traceSendingRequest(requestMessage);
1968 messageWriter.write(requestMessage);
1970 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason"));
1971 responsePromise = null;
1973 if (responsePromise) {
1974 responsePromises[String(id)] = responsePromise;
1978 token.onCancellationRequested(() => {
1979 connection.sendNotification(CancelNotification.type, {id});
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};
1992 requestHandlers[type.method] = {type, handler};
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;
2003 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2004 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2008 traceFormat = _traceFormat;
2009 if (trace === Trace.Off) {
2014 if (_sendNotification && !isClosed() && !isDisposed()) {
2015 connection.sendNotification(SetTraceNotification.type, {value: Trace.toString(_value)});
2018 onError: errorEmitter.event,
2019 onClose: closeEmitter.event,
2020 onUnhandledNotification: unhandledNotificationEmitter.event,
2021 onDispose: disposeEmitter.event,
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);
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();
2038 if (Is2.func(messageReader.dispose)) {
2039 messageReader.dispose();
2043 throwIfClosedOrDisposed();
2045 state = ConnectionState.Listening;
2046 messageReader.listen(callback);
2049 console.log("inspect");
2052 connection.onNotification(LogTraceNotification.type, (params) => {
2053 if (trace === Trace.Off || !tracer) {
2056 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : void 0);
2058 connection.onNotification(ProgressNotification.type, (params) => {
2059 const handler = progressHandlers.get(params.token);
2061 handler(params.value);
2063 unhandledProgressEmitter.fire(params);
2068 function isMessageReader(value) {
2069 return value.listen !== void 0 && value.read === void 0;
2071 function isMessageWriter(value) {
2072 return value.write !== void 0 && value.end === void 0;
2074 function createMessageConnection(input, output, logger, strategy) {
2076 logger = exports2.NullLogger;
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);
2082 exports2.createMessageConnection = createMessageConnection;
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,
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,
2111 FoldingRange: () => FoldingRange,
2112 FoldingRangeKind: () => FoldingRangeKind,
2113 FormattingOptions: () => FormattingOptions,
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
2141 (function(Position3) {
2142 function create(line, character) {
2143 return {line, character};
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);
2151 })(Position2 || (Position2 = {}));
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};
2160 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
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);
2169 })(Range2 || (Range2 = {}));
2171 (function(Location3) {
2172 function create(uri, range) {
2173 return {uri, range};
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));
2181 })(Location2 || (Location2 = {}));
2183 (function(LocationLink2) {
2184 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
2185 return {targetUri, targetRange, targetSelectionRange, originSelectionRange};
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));
2192 LocationLink2.is = is;
2193 })(LocationLink || (LocationLink = {}));
2196 function create(red, green, blue, alpha) {
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);
2210 })(Color || (Color = {}));
2211 var ColorInformation;
2212 (function(ColorInformation2) {
2213 function create(range, color) {
2219 ColorInformation2.create = create;
2220 function is(value) {
2221 var candidate = value;
2222 return Range2.is(candidate.range) && Color.is(candidate.color);
2224 ColorInformation2.is = is;
2225 })(ColorInformation || (ColorInformation = {}));
2226 var ColorPresentation;
2227 (function(ColorPresentation2) {
2228 function create(label, textEdit, additionalTextEdits) {
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));
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 = {}));
2249 (function(FoldingRange2) {
2250 function create(startLine, endLine, startCharacter, endCharacter, kind) {
2255 if (Is2.defined(startCharacter)) {
2256 result.startCharacter = startCharacter;
2258 if (Is2.defined(endCharacter)) {
2259 result.endCharacter = endCharacter;
2261 if (Is2.defined(kind)) {
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));
2271 FoldingRange2.is = is;
2272 })(FoldingRange || (FoldingRange = {}));
2273 var DiagnosticRelatedInformation;
2274 (function(DiagnosticRelatedInformation2) {
2275 function create(location, message) {
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);
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 = {}));
2296 (function(DiagnosticTag2) {
2297 DiagnosticTag2.Unnecessary = 1;
2298 DiagnosticTag2.Deprecated = 2;
2299 })(DiagnosticTag || (DiagnosticTag = {}));
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;
2307 if (Is2.defined(code)) {
2310 if (Is2.defined(source)) {
2311 result.source = source;
2313 if (Is2.defined(relatedInformation)) {
2314 result.relatedInformation = relatedInformation;
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));
2323 Diagnostic3.is = is;
2324 })(Diagnostic2 || (Diagnostic2 = {}));
2326 (function(Command3) {
2327 function create(title, command) {
2329 for (var _i = 2; _i < arguments.length; _i++) {
2330 args[_i - 2] = arguments[_i];
2332 var result = {title, command};
2333 if (Is2.defined(args) && args.length > 0) {
2334 result.arguments = args;
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);
2344 })(Command2 || (Command2 = {}));
2346 (function(TextEdit2) {
2347 function replace(range, newText) {
2348 return {range, newText};
2350 TextEdit2.replace = replace;
2351 function insert(position, newText) {
2352 return {range: {start: position, end: position}, newText};
2354 TextEdit2.insert = insert;
2355 function del(range) {
2356 return {range, newText: ""};
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);
2364 })(TextEdit || (TextEdit = {}));
2365 var TextDocumentEdit;
2366 (function(TextDocumentEdit2) {
2367 function create(textDocument, edits) {
2368 return {textDocument, edits};
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);
2375 TextDocumentEdit2.is = is;
2376 })(TextDocumentEdit || (TextDocumentEdit = {}));
2378 (function(CreateFile2) {
2379 function create(uri, options) {
2384 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
2385 result.options = options;
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)));
2394 CreateFile2.is = is;
2395 })(CreateFile || (CreateFile = {}));
2397 (function(RenameFile2) {
2398 function create(oldUri, newUri, options) {
2404 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
2405 result.options = options;
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)));
2414 RenameFile2.is = is;
2415 })(RenameFile || (RenameFile = {}));
2417 (function(DeleteFile2) {
2418 function create(uri, options) {
2423 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
2424 result.options = options;
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)));
2433 DeleteFile2.is = is;
2434 })(DeleteFile || (DeleteFile = {}));
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);
2443 return TextDocumentEdit.is(change);
2447 WorkspaceEdit2.is = is;
2448 })(WorkspaceEdit || (WorkspaceEdit = {}));
2449 var TextEditChangeImpl = function() {
2450 function TextEditChangeImpl2(edits) {
2453 TextEditChangeImpl2.prototype.insert = function(position, newText) {
2454 this.edits.push(TextEdit.insert(position, newText));
2456 TextEditChangeImpl2.prototype.replace = function(range, newText) {
2457 this.edits.push(TextEdit.replace(range, newText));
2459 TextEditChangeImpl2.prototype.delete = function(range) {
2460 this.edits.push(TextEdit.del(range));
2462 TextEditChangeImpl2.prototype.add = function(edit) {
2463 this.edits.push(edit);
2465 TextEditChangeImpl2.prototype.all = function() {
2468 TextEditChangeImpl2.prototype.clear = function() {
2469 this.edits.splice(0, this.edits.length);
2471 return TextEditChangeImpl2;
2473 var WorkspaceChange = function() {
2474 function WorkspaceChange2(workspaceEdit) {
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;
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;
2494 Object.defineProperty(WorkspaceChange2.prototype, "edit", {
2496 return this._workspaceEdit;
2501 WorkspaceChange2.prototype.getTextEditChange = function(key) {
2502 if (VersionedTextDocumentIdentifier2.is(key)) {
2503 if (!this._workspaceEdit) {
2504 this._workspaceEdit = {
2508 if (!this._workspaceEdit.documentChanges) {
2509 throw new Error("Workspace edit is not configured for document changes.");
2511 var textDocument = key;
2512 var result = this._textEditChanges[textDocument.uri];
2515 var textDocumentEdit = {
2519 this._workspaceEdit.documentChanges.push(textDocumentEdit);
2520 result = new TextEditChangeImpl(edits);
2521 this._textEditChanges[textDocument.uri] = result;
2525 if (!this._workspaceEdit) {
2526 this._workspaceEdit = {
2527 changes: Object.create(null)
2530 if (!this._workspaceEdit.changes) {
2531 throw new Error("Workspace edit is not configured for normal text edit changes.");
2533 var result = this._textEditChanges[key];
2536 this._workspaceEdit.changes[key] = edits;
2537 result = new TextEditChangeImpl(edits);
2538 this._textEditChanges[key] = result;
2543 WorkspaceChange2.prototype.createFile = function(uri, options) {
2544 this.checkDocumentChanges();
2545 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
2547 WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, options) {
2548 this.checkDocumentChanges();
2549 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
2551 WorkspaceChange2.prototype.deleteFile = function(uri, options) {
2552 this.checkDocumentChanges();
2553 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
2555 WorkspaceChange2.prototype.checkDocumentChanges = function() {
2556 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
2557 throw new Error("Workspace edit is not configured for document changes.");
2560 return WorkspaceChange2;
2562 var TextDocumentIdentifier2;
2563 (function(TextDocumentIdentifier3) {
2564 function create(uri) {
2567 TextDocumentIdentifier3.create = create;
2568 function is(value) {
2569 var candidate = value;
2570 return Is2.defined(candidate) && Is2.string(candidate.uri);
2572 TextDocumentIdentifier3.is = is;
2573 })(TextDocumentIdentifier2 || (TextDocumentIdentifier2 = {}));
2574 var VersionedTextDocumentIdentifier2;
2575 (function(VersionedTextDocumentIdentifier3) {
2576 function create(uri, version) {
2577 return {uri, version};
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));
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};
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);
2596 TextDocumentItem2.is = is;
2597 })(TextDocumentItem || (TextDocumentItem = {}));
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;
2608 MarkupKind2.is = is;
2609 })(MarkupKind || (MarkupKind = {}));
2611 (function(MarkupContent2) {
2612 function is(value) {
2613 var candidate = value;
2614 return Is2.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is2.string(candidate.value);
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 = {}));
2656 (function(CompletionItem2) {
2657 function create(label) {
2660 CompletionItem2.create = create;
2661 })(CompletionItem || (CompletionItem = {}));
2663 (function(CompletionList2) {
2664 function create(items, isIncomplete) {
2665 return {items: items ? items : [], isIncomplete: !!isIncomplete};
2667 CompletionList2.create = create;
2668 })(CompletionList || (CompletionList = {}));
2670 (function(MarkedString2) {
2671 function fromPlainText(plainText) {
2672 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
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);
2679 MarkedString2.is = is;
2680 })(MarkedString || (MarkedString = {}));
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));
2688 })(Hover || (Hover = {}));
2689 var ParameterInformation;
2690 (function(ParameterInformation2) {
2691 function create(label, documentation) {
2692 return documentation ? {label, documentation} : {label};
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];
2703 var result = {label};
2704 if (Is2.defined(documentation)) {
2705 result.documentation = documentation;
2707 if (Is2.defined(parameters)) {
2708 result.parameters = parameters;
2710 result.parameters = [];
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)) {
2731 DocumentHighlight2.create = create;
2732 })(DocumentHighlight || (DocumentHighlight = {}));
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 = {}));
2763 (function(SymbolTag2) {
2764 SymbolTag2.Deprecated = 1;
2765 })(SymbolTag || (SymbolTag = {}));
2766 var SymbolInformation;
2767 (function(SymbolInformation2) {
2768 function create(name, kind, range, uri, containerName) {
2772 location: {uri, range}
2774 if (containerName) {
2775 result.containerName = containerName;
2779 SymbolInformation2.create = create;
2780 })(SymbolInformation || (SymbolInformation = {}));
2782 (function(DocumentSymbol2) {
2783 function create(name, detail, kind, range, selectionRange, children) {
2791 if (children !== void 0) {
2792 result.children = children;
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));
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) {
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));
2829 CodeActionContext3.is = is;
2830 })(CodeActionContext2 || (CodeActionContext2 = {}));
2832 (function(CodeAction3) {
2833 function create(title, commandOrEdit, kind) {
2834 var result = {title};
2835 if (Command2.is(commandOrEdit)) {
2836 result.command = commandOrEdit;
2838 result.edit = commandOrEdit;
2840 if (kind !== void 0) {
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));
2850 CodeAction3.is = is;
2851 })(CodeAction2 || (CodeAction2 = {}));
2853 (function(CodeLens2) {
2854 function create(range, data) {
2855 var result = {range};
2856 if (Is2.defined(data)) {
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));
2867 })(CodeLens || (CodeLens = {}));
2868 var FormattingOptions;
2869 (function(FormattingOptions2) {
2870 function create(tabSize, insertSpaces) {
2871 return {tabSize, insertSpaces};
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);
2878 FormattingOptions2.is = is;
2879 })(FormattingOptions || (FormattingOptions = {}));
2881 (function(DocumentLink2) {
2882 function create(range, target, data) {
2883 return {range, target, data};
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));
2890 DocumentLink2.is = is;
2891 })(DocumentLink || (DocumentLink = {}));
2893 (function(SelectionRange2) {
2894 function create(range, parent) {
2895 return {range, parent};
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));
2902 SelectionRange2.is = is;
2903 })(SelectionRange || (SelectionRange = {}));
2904 var EOL = ["\n", "\r\n", "\r"];
2906 (function(TextDocument3) {
2907 function create(uri, languageId, version, content) {
2908 return new FullTextDocument(uri, languageId, version, content);
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;
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;
2921 return a.range.start.character - b.range.start.character;
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);
2933 throw new Error("Overlapping edit");
2935 lastModifiedOffset = startOffset;
2939 TextDocument3.applyEdits = applyEdits;
2940 function mergeSort(data, compare) {
2941 if (data.length <= 1) {
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);
2952 while (leftIdx < left.length && rightIdx < right.length) {
2953 var ret = compare(left[leftIdx], right[rightIdx]);
2955 data[i++] = left[leftIdx++];
2957 data[i++] = right[rightIdx++];
2960 while (leftIdx < left.length) {
2961 data[i++] = left[leftIdx++];
2963 while (rightIdx < right.length) {
2964 data[i++] = right[rightIdx++];
2968 })(TextDocument2 || (TextDocument2 = {}));
2969 var FullTextDocument = function() {
2970 function FullTextDocument2(uri, languageId, version, content) {
2972 this._languageId = languageId;
2973 this._version = version;
2974 this._content = content;
2975 this._lineOffsets = void 0;
2977 Object.defineProperty(FullTextDocument2.prototype, "uri", {
2984 Object.defineProperty(FullTextDocument2.prototype, "languageId", {
2986 return this._languageId;
2991 Object.defineProperty(FullTextDocument2.prototype, "version", {
2993 return this._version;
2998 FullTextDocument2.prototype.getText = function(range) {
3000 var start = this.offsetAt(range.start);
3001 var end = this.offsetAt(range.end);
3002 return this._content.substring(start, end);
3004 return this._content;
3006 FullTextDocument2.prototype.update = function(event, version) {
3007 this._content = event.text;
3008 this._version = version;
3009 this._lineOffsets = void 0;
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++) {
3018 lineOffsets.push(i);
3019 isLineStart = false;
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") {
3027 if (isLineStart && text.length > 0) {
3028 lineOffsets.push(text.length);
3030 this._lineOffsets = lineOffsets;
3032 return this._lineOffsets;
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;
3039 return Position2.create(0, offset);
3041 while (low < high) {
3042 var mid = Math.floor((low + high) / 2);
3043 if (lineOffsets[mid] > offset) {
3050 return Position2.create(line, offset - lineOffsets[line]);
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) {
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);
3063 Object.defineProperty(FullTextDocument2.prototype, "lineCount", {
3065 return this.getLineOffsets().length;
3070 return FullTextDocument2;
3074 var toString = Object.prototype.toString;
3075 function defined(value) {
3076 return typeof value !== "undefined";
3078 Is3.defined = defined;
3079 function undefined2(value) {
3080 return typeof value === "undefined";
3082 Is3.undefined = undefined2;
3083 function boolean(value) {
3084 return value === true || value === false;
3086 Is3.boolean = boolean;
3087 function string(value) {
3088 return toString.call(value) === "[object String]";
3090 Is3.string = string;
3091 function number(value) {
3092 return toString.call(value) === "[object Number]";
3094 Is3.number = number;
3095 function func(value) {
3096 return toString.call(value) === "[object Function]";
3099 function objectLiteral(value) {
3100 return value !== null && typeof value === "object";
3102 Is3.objectLiteral = objectLiteral;
3103 function typedArray(value, check) {
3104 return Array.isArray(value) && value.every(check);
3106 Is3.typedArray = typedArray;
3107 })(Is2 || (Is2 = {}));
3110 // node_modules/vscode-languageserver-protocol/lib/utils/is.js
3111 var require_is2 = __commonJS((exports2) => {
3113 Object.defineProperty(exports2, "__esModule", {value: true});
3114 function boolean(value) {
3115 return value === true || value === false;
3117 exports2.boolean = boolean;
3118 function string(value) {
3119 return typeof value === "string" || value instanceof String;
3121 exports2.string = string;
3122 function number(value) {
3123 return typeof value === "number" || value instanceof Number;
3125 exports2.number = number;
3126 function error(value) {
3127 return value instanceof Error;
3129 exports2.error = error;
3130 function func(value) {
3131 return typeof value === "function";
3133 exports2.func = func;
3134 function array(value) {
3135 return Array.isArray(value);
3137 exports2.array = array;
3138 function stringArray(value) {
3139 return array(value) && value.every((elem) => string(elem));
3141 exports2.stringArray = stringArray;
3142 function typedArray(value, check) {
3143 return Array.isArray(value) && value.every(check);
3145 exports2.typedArray = typedArray;
3146 function objectLiteral(value) {
3147 return value !== null && typeof value === "object";
3149 exports2.objectLiteral = objectLiteral;
3152 // node_modules/vscode-languageserver-protocol/lib/messages.js
3153 var require_messages2 = __commonJS((exports2) => {
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) {
3162 exports2.ProtocolRequestType0 = ProtocolRequestType0;
3163 var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
3164 constructor(method) {
3168 exports2.ProtocolRequestType = ProtocolRequestType;
3169 var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
3170 constructor(method) {
3174 exports2.ProtocolNotificationType = ProtocolNotificationType;
3175 var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
3176 constructor(method) {
3180 exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
3183 // node_modules/vscode-languageserver-protocol/lib/protocol.implementation.js
3184 var require_protocol_implementation = __commonJS((exports2) => {
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 = {}));
3197 // node_modules/vscode-languageserver-protocol/lib/protocol.typeDefinition.js
3198 var require_protocol_typeDefinition = __commonJS((exports2) => {
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 = {}));
3211 // node_modules/vscode-languageserver-protocol/lib/protocol.workspaceFolders.js
3212 var require_protocol_workspaceFolders = __commonJS((exports2) => {
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 = {}));
3226 // node_modules/vscode-languageserver-protocol/lib/protocol.configuration.js
3227 var require_protocol_configuration = __commonJS((exports2) => {
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 = {}));
3237 // node_modules/vscode-languageserver-protocol/lib/protocol.colorProvider.js
3238 var require_protocol_colorProvider = __commonJS((exports2) => {
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 = {}));
3255 // node_modules/vscode-languageserver-protocol/lib/protocol.foldingRange.js
3256 var require_protocol_foldingRange = __commonJS((exports2) => {
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 = {}));
3275 // node_modules/vscode-languageserver-protocol/lib/protocol.declaration.js
3276 var require_protocol_declaration = __commonJS((exports2) => {
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 = {}));
3289 // node_modules/vscode-languageserver-protocol/lib/protocol.selectionRange.js
3290 var require_protocol_selectionRange = __commonJS((exports2) => {
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 = {}));
3303 // node_modules/vscode-languageserver-protocol/lib/protocol.progress.js
3304 var require_protocol_progress = __commonJS((exports2) => {
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 = {}));
3323 // node_modules/vscode-languageserver-protocol/lib/protocol.js
3324 var require_protocol = __commonJS((exports2) => {
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);
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)) {
3366 for (let elem of value) {
3367 if (!Is2.string(elem) && !DocumentFilter2.is(elem)) {
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;
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));
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));
3418 WorkDoneProgressOptions2.is = is;
3419 function hasWorkDoneProgress(value) {
3420 const candidate = value;
3421 return candidate && Is2.boolean(candidate.workDoneProgress);
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 = {}));
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 = {}));
3519 (function(FileChangeType2) {
3520 FileChangeType2.Created = 1;
3521 FileChangeType2.Changed = 2;
3522 FileChangeType2.Deleted = 3;
3523 })(FileChangeType = exports2.FileChangeType || (exports2.FileChangeType = {}));
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 = {}));
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 = {}));
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 = {}));
3657 // node_modules/vscode-languageserver-protocol/lib/protocol.callHierarchy.proposed.js
3658 var require_protocol_callHierarchy_proposed = __commonJS((exports2) => {
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 = {}));
3679 // node_modules/vscode-languageserver-protocol/lib/protocol.sematicTokens.proposed.js
3680 var require_protocol_sematicTokens_proposed = __commonJS((exports2) => {
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 = {}));
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");
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 = {}));
3745 // node_modules/vscode-languageserver-protocol/lib/main.js
3746 var require_main3 = __commonJS((exports2) => {
3748 function __export2(m) {
3750 if (!exports2.hasOwnProperty(p))
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();
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);
3826 exports2.createProtocolConnection = createProtocolConnection;
3829 // entry-ns:index.ts
3831 activate: () => activate,
3832 deactivate: () => deactivate
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());
3842 var import_fs = __toModule(require("fs"));
3843 var import_path = __toModule(require("path"));
3845 function exists(file) {
3846 return new Promise((resolve, _reject) => {
3847 import_fs.default.exists(file, (value) => {
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");
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, "\\$&");
3875 var PatternParser = class {
3876 constructor(value, mode = "pattern") {
3880 this.stopChar = mode === "pattern" ? void 0 : "}";
3882 makeTextNode(start) {
3883 return {type: NodeType.text, value: escapeRegExpCharacters(this.value.substring(start, this.index))};
3886 let start = this.index;
3888 while ((ch = this.value[this.index]) !== this.stopChar) {
3891 if (start < this.index) {
3892 return this.makeTextNode(start);
3895 return {type: NodeType.separator};
3899 return {type: NodeType.questionMark};
3901 if (this.value[this.index + 1] === "*") {
3903 return {type: NodeType.globStar};
3906 return {type: NodeType.star};
3909 if (start < this.index) {
3910 return this.makeTextNode(start);
3912 const bracketParser = new PatternParser(this.value.substring(this.index + 1), "brace");
3913 const alternatives = [];
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}`);
3919 alternatives.push(node);
3921 this.index = this.index + bracketParser.index + 2;
3922 return {type: NodeType.brace, alternatives};
3925 if (this.mode === "brace") {
3926 if (start < this.index) {
3927 let result = this.makeTextNode(start);
3937 const firstIndex = this.index;
3938 while (this.index < this.value.length) {
3939 const ch2 = this.value[this.index];
3940 if (this.index === firstIndex) {
3950 buffer.push(escapeRegExpCharacters(ch2));
3953 } else if (ch2 === "-") {
3955 } else if (ch2 === "]") {
3957 return {type: NodeType.bracket, value: buffer.join("")};
3959 buffer.push(escapeRegExpCharacters(ch2));
3963 throw new Error(`Invalid glob pattern ${this.index}. Stopped at ${this.index}`);
3968 return start === this.index ? void 0 : this.makeTextNode(start);
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:
3980 case NodeType.questionMark:
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: {
3990 for (const child of node.alternatives) {
3991 buffer.push(convertNode(child));
3993 return `(?:${buffer.join("|")})`;
3998 const buffer = ["^"];
3999 let parser = new PatternParser(pattern);
4001 while ((node = parser.next()) !== void 0) {
4002 buffer.push(convertNode(node));
4004 return buffer.length > 0 ? new RegExp(buffer.join("")) : void 0;
4010 function toOSPath(path3) {
4011 if (process.platform === "win32") {
4012 path3 = path3.replace(/^\/(\w)\//, "$1:\\");
4013 return path3.replace(/\//g, "\\");
4018 function toPosixPath(path3) {
4019 if (process.platform !== "win32") {
4022 return path3.replace(/\\/g, "/");
4024 var Semaphore = class {
4025 constructor(capacity = 1) {
4026 if (capacity <= 0) {
4027 throw new Error("Capacity must be greater than 0");
4029 this._capacity = capacity;
4034 return new Promise((resolve, reject) => {
4035 this._waiting.push({thunk, resolve, reject});
4040 return this._active;
4043 if (this._waiting.length === 0 || this._active === this._capacity) {
4046 setImmediate(() => this.doRunNext());
4049 if (this._waiting.length === 0 || this._active === this._capacity) {
4052 const next = this._waiting.shift();
4054 if (this._active > this._capacity) {
4055 throw new Error(`To many thunks active`);
4058 const result = next.thunk();
4059 if (result instanceof Promise) {
4060 result.then((value) => {
4062 next.resolve(value);
4071 next.resolve(result);
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 {
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);
4095 this.statusItem.text = "compiling";
4096 this.statusItem.isProgress = true;
4097 this.statusItem.show();
4098 import_coc.workspace.nvim.call("setqflist", [[]], true);
4101 task.onExit((code) => {
4103 import_coc.window.showMessage(`Eslint found issues`, "warning");
4107 task.onStdout((lines) => {
4108 for (let line of lines) {
4112 task.onStderr((lines) => {
4113 import_coc.window.showMessage(`TSC error: ` + lines.join("\n"), "error");
4115 this.disposables.push(import_coc2.Disposable.create(() => {
4119 async start(options) {
4120 return await this.task.start(options);
4123 this.statusItem.hide();
4126 let ms = line.match(errorRegex);
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;
4135 lnum: Number(ms[2]),
4137 text: `${ms[4]} [${ms[6]}]`,
4138 type: /error/i.test(ms[5]) ? "E" : "W"
4142 import_coc.workspace.nvim.call("setqflist", [[item], "a"]);
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", ["."]);
4151 args: args.concat(["-f", "unix", "--no-color"]),
4156 import_coc.disposeAll(this.disposables);
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;
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 = {}));
4174 const toString = Object.prototype.toString;
4175 function boolean(value) {
4176 return value === true || value === false;
4178 Is2.boolean = boolean;
4179 function string(value) {
4180 return toString.call(value) === "[object String]";
4182 Is2.string = string;
4183 function objectLiteral(value) {
4184 return value !== null && value !== void 0 && !Array.isArray(value) && typeof value === "object";
4186 Is2.objectLiteral = objectLiteral;
4187 })(Is || (Is = {}));
4189 (function(ValidateItem2) {
4191 const candidate = item;
4192 return candidate && Is.string(candidate.language) && (Is.boolean(candidate.autoFix) || candidate.autoFix === void 0);
4194 ValidateItem2.is = is;
4195 })(ValidateItem || (ValidateItem = {}));
4196 var LegacyDirectoryItem;
4197 (function(LegacyDirectoryItem2) {
4199 const candidate = item;
4200 return candidate && Is.string(candidate.directory) && Is.boolean(candidate.changeProcessCWD);
4202 LegacyDirectoryItem2.is = is;
4203 })(LegacyDirectoryItem || (LegacyDirectoryItem = {}));
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;
4214 })(ModeEnum || (ModeEnum = {}));
4216 (function(ModeItem2) {
4218 const candidate = item;
4219 return candidate && ModeEnum.is(candidate.mode);
4222 })(ModeItem || (ModeItem = {}));
4224 (function(DirectoryItem2) {
4226 const candidate = item;
4227 return candidate && Is.string(candidate.directory) && (Is.boolean(candidate["!cwd"]) || candidate["!cwd"] === void 0);
4229 DirectoryItem2.is = is;
4230 })(DirectoryItem || (DirectoryItem = {}));
4232 (function(PatternItem2) {
4234 const candidate = item;
4235 return candidate && Is.string(candidate.pattern) && (Is.boolean(candidate["!cwd"]) || candidate["!cwd"] === void 0);
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;
4249 switch (value.toLowerCase()) {
4250 case CodeActionsOnSaveMode2.problems:
4251 return CodeActionsOnSaveMode2.problems;
4253 return CodeActionsOnSaveMode2.all;
4256 CodeActionsOnSaveMode2.from = from;
4257 })(CodeActionsOnSaveMode || (CodeActionsOnSaveMode = {}));
4259 (function(Validate2) {
4260 Validate2["on"] = "on";
4261 Validate2["off"] = "off";
4262 Validate2["probe"] = "probe";
4263 })(Validate || (Validate = {}));
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;
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;
4283 return ESLintSeverity2.off;
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 = {}));
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) {
4334 case ConfirmExecutionResult2.denied:
4336 case ConfirmExecutionResult2.confirmationPending:
4338 case ConfirmExecutionResult2.disabled:
4340 case ConfirmExecutionResult2.approved:
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]);
4359 const selected = await import_coc3.window.showQuickpick(folders.map((folder) => {
4362 if (selected === -1) {
4365 return folders[selected];
4367 function createDefaultConfiguration() {
4368 const folders = import_coc3.workspace.workspaceFolders;
4370 import_coc3.window.showErrorMessage("An ESLint configuration can only be generated if VS Code is opened on a workspace folder.");
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))) {
4382 if (noConfigFolders.length === 0) {
4383 if (folders.length === 1) {
4384 import_coc3.window.showInformationMessage("The workspace already contains an ESLint configuration file.");
4386 import_coc3.window.showInformationMessage("All workspace folders already contain an ESLint configuration file.");
4390 pickFolder(noConfigFolders, "Select a workspace folder to generate a ESLint configuration for").then(async (folder) => {
4394 const folderRootPath = import_coc3.Uri.parse(folder.uri).fsPath;
4395 const terminal = await import_coc3.workspace.createTerminal({
4396 name: `ESLint init`,
4399 const eslintCommand = await findEslint(folderRootPath);
4400 terminal.sendText(`${eslintCommand} --init`);
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;
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) {
4417 } else if (ValidateItem.is(item) && item.language === languageId) {
4422 const uri = textDocument.uri.toString();
4423 if (probeFailed.has(uri)) {
4424 return Validate.off;
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;
4434 return Validate.off;
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();
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) {
4451 params: {libraryPath: params.libraryPath, scope: params.scope},
4453 editorErrorUri: void 0,
4454 codeActionProvider: void 0,
4455 diagnostics: import_coc3.languages.createDiagnosticCollection()
4457 libraryPath2ExecutionInfo.set(params.libraryPath, value);
4459 value.result = result;
4462 function updateStatusInfo(param) {
4463 globalStatus = param.state;
4464 let info = resource2ResourceInfo.get(param.uri);
4465 if (info === void 0) {
4467 executionInfo: void 0,
4470 resource2ResourceInfo.set(param.uri, info);
4472 info.status = param.state;
4475 function getExecutionInfo(doc, strict) {
4476 if (doc == void 0) {
4479 const info = resource2ResourceInfo.get(doc.uri);
4480 if (info !== void 0) {
4481 return info.executionInfo;
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];
4492 function clearInfo(info) {
4493 info.diagnostics.clear();
4494 if (info.codeActionProvider !== void 0) {
4495 info.codeActionProvider.dispose();
4498 function clearDiagnosticState(params) {
4499 const info = libraryPath2ExecutionInfo.get(params.libraryPath);
4500 if (info === void 0) {
4505 function clearAllDiagnosticState() {
4506 for (const info of Array.from(libraryPath2ExecutionInfo.values())) {
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());
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);
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?
4523 Press 'Allow Everywhere' to remember the choice for all workspaces. Use 'Disable' to disable ESLint for this session.`;
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?
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?
4529 Press 'Always Allow' to remember the choice for all workspaces. Use 'Cancel' to disable ESLint for this session.`;
4531 const messageItems = [
4532 {title: "Allow Everywhere", value: 4},
4533 {title: "Allow", value: 3},
4534 {title: "Deny", value: 1},
4535 {title: "Disable", value: 2}
4537 const item = await import_coc3.window.showInformationMessage(message, ...messageItems);
4538 if (item === void 0) {
4541 if (item.value === 2) {
4542 disabledLibraries.add(params.libraryPath);
4543 updateExecutionInfo(params, 3);
4544 clearDiagnosticState(params);
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();
4561 client && client.sendNotification(import_vscode_languageserver_protocol.DidChangeConfigurationNotification.type, {settings: {}});
4563 async function resetLibraryConfirmations(client, context, update) {
4565 {label: "Reset ESLint library decisions for this workspace", kind: "session"},
4566 {label: "Reset all ESLint library decisions", kind: "all"}
4568 if (eslintAlwaysAllowExecutionState) {
4569 items.splice(1, 0, {label: "Reset Always Allow all ESlint libraries decision", kind: "alwaysAllow"});
4571 const selectedIdx = await import_coc3.window.showQuickpick(items.map((o) => o.label), "Clear library confirmations");
4572 if (selectedIdx == -1) {
4575 let selected = items[selectedIdx];
4576 switch (selected.kind) {
4578 eslintExecutionState.libs = {};
4579 eslintAlwaysAllowExecutionState = false;
4582 eslintAlwaysAllowExecutionState = false;
4585 if (sessionState.size === 1) {
4586 const param = sessionState.values().next().value;
4587 await askForLibraryConfirmation(client, context, param, update);
4590 for (const lib of sessionState.keys()) {
4591 delete eslintExecutionState.libs[lib];
4596 context.globalState.update(eslintExecutionKey, eslintExecutionState);
4597 context.globalState.update(eslintAlwaysAllowExecutionKey, eslintAlwaysAllowExecutionState);
4598 disabledLibraries.clear();
4599 libraryPath2ExecutionInfo.clear();
4600 resource2ResourceInfo.clear();
4601 workspaceFolder2ExecutionInfos.clear();
4603 client && client.sendNotification(import_vscode_languageserver_protocol.DidChangeConfigurationNotification.type, {settings: {}});
4605 function activate(context) {
4606 eslintExecutionState = context.globalState.get(eslintExecutionKey, {libs: {}});
4607 eslintAlwaysAllowExecutionState = context.globalState.get(eslintAlwaysAllowExecutionKey, false);
4608 function didOpenTextDocument(textDocument) {
4612 if (computeValidate(textDocument) !== Validate.off) {
4613 openListener.dispose();
4614 configurationListener.dispose();
4616 realActivate(context);
4619 function configurationChanged() {
4623 for (const textDocument of import_coc3.workspace.textDocuments) {
4624 if (computeValidate(textDocument) !== Validate.off) {
4625 openListener.dispose();
4626 configurationListener.dispose();
4628 realActivate(context);
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);
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.`);
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.");
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);
4654 context.subscriptions.push(import_coc3.commands.registerCommand("eslint.createConfig", createDefaultConfiguration));
4655 context.subscriptions.push(new task_default());
4656 configurationChanged();
4658 var CodeActionsOnSave;
4659 (function(CodeActionsOnSave2) {
4660 function isExplicitlyDisabled(setting) {
4661 if (setting === void 0 || setting === null || Array.isArray(setting)) {
4664 return setting["source.fixAll.eslint"] === false;
4666 CodeActionsOnSave2.isExplicitlyDisabled = isExplicitlyDisabled;
4667 function getSourceFixAll(setting) {
4668 if (setting === null) {
4671 if (Array.isArray(setting)) {
4672 return setting.includes("source.fixAll") ? true : void 0;
4674 return setting["source.fixAll"];
4677 CodeActionsOnSave2.getSourceFixAll = getSourceFixAll;
4678 function getSourceFixAllESLint(setting) {
4679 if (setting === null) {
4681 } else if (Array.isArray(setting)) {
4682 return setting.includes("source.fixAll.eslint") ? true : void 0;
4684 return setting["source.fixAll.eslint"];
4687 CodeActionsOnSave2.getSourceFixAllESLint = getSourceFixAllESLint;
4688 function setSourceFixAllESLint(setting, value) {
4689 if (setting === null) {
4691 } else if (Array.isArray(setting)) {
4692 const index = setting.indexOf("source.fixAll.eslint");
4693 if (value === true) {
4695 setting.push("source.fixAll.eslint");
4699 setting.splice(index, 1);
4703 setting["source.fixAll.eslint"] = value;
4706 CodeActionsOnSave2.setSourceFixAllESLint = setSourceFixAllESLint;
4707 })(CodeActionsOnSave || (CodeActionsOnSave = {}));
4708 function realActivate(context) {
4709 const statusBarItem = import_coc3.window.createStatusBarItem(0);
4710 context.subscriptions.push(statusBarItem);
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";
4723 text = "Eslint warning";
4726 text = "Eslint error";
4729 text = "Eslint denied";
4732 text = "Eslint disabled";
4735 text = "ESLint not approved or denied yet.";
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();
4745 statusBarItem.hide();
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) {
4755 if (lastExecutionInfo.codeActionProvider !== void 0) {
4756 lastExecutionInfo.codeActionProvider.dispose();
4757 lastExecutionInfo.codeActionProvider = void 0;
4759 if (lastExecutionInfo.editorErrorUri !== void 0) {
4760 lastExecutionInfo.diagnostics.delete(lastExecutionInfo.editorErrorUri.toString());
4761 lastExecutionInfo.editorErrorUri = void 0;
4763 lastExecutionInfo = void 0;
4765 function handleEditor(doc2) {
4767 const uri = doc2.uri;
4768 const resourceInfo = resource2ResourceInfo.get(uri);
4769 if (resourceInfo === void 0) {
4772 const info = resourceInfo.executionInfo;
4773 if (info === void 0) {
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());
4785 info.editorErrorUri = import_coc3.Uri.parse(errorUri);
4786 if (info.codeActionProvider !== void 0) {
4787 info.codeActionProvider.dispose();
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) {
4794 title: "ESLint: Manage Library Execution",
4795 kind: import_vscode_languageserver_protocol.CodeActionKind.QuickFix
4797 result.isPreferred = true;
4799 title: "Manage Library Execution",
4800 command: "eslint.manageLibraryExecution",
4801 arguments: [info.params]
4808 }, "eslint-library");
4810 lastExecutionInfo = info;
4812 function findApplicableStatus(editor) {
4814 if (editor !== void 0) {
4815 const resourceInfo = resource2ResourceInfo.get(editor.uri);
4816 if (resourceInfo !== void 0) {
4817 return [resourceInfo.status, true];
4819 const workspaceFolder = import_coc3.workspace.getWorkspaceFolder(editor.uri);
4820 if (workspaceFolder !== void 0) {
4821 candidates = workspaceFolder2ExecutionInfos.get(workspaceFolder.uri.toString());
4824 if (candidates === void 0) {
4825 candidates = libraryPath2ExecutionInfo.values();
4828 for (const info of candidates) {
4829 if (result === void 0) {
4830 result = info.result;
4832 if (info.result === 2) {
4833 result = info.result;
4835 } else if (info.result === 1 || info.result === 3) {
4836 result = info.result;
4840 return [result !== void 0 ? ConfirmExecutionResult.toStatus(result) : 1, false];
4842 const executionInfo = getExecutionInfo(doc, true);
4843 if (lastExecutionInfo !== executionInfo) {
4844 clearLastExecutionInfo();
4846 if (doc && doc.attached && flaggedLanguages.has(doc.filetype)) {
4849 clearLastExecutionInfo();
4851 const [status, isValidated] = findApplicableStatus(doc);
4852 updateStatusBar(status, isValidated);
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);
4863 env.DEBUG = "eslint:*,-eslint:code-path";
4867 env.NODE_ENV = nodeEnv;
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}}
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,
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")
4893 initializationFailedHandler: (error) => {
4894 client.error("Server initialization failed.", error);
4895 client.outputChannel.show(true);
4899 error: (error, message, count) => {
4900 return defaultErrorHandler.error(error, message, count);
4903 if (serverCalledProcessExit) {
4904 return import_coc3.CloseAction.DoNotRestart;
4906 return defaultErrorHandler.closed();
4910 didOpen: (document, next) => {
4911 if (import_coc3.workspace.match([packageJsonFilter], document) || import_coc3.workspace.match([configFileFilter], document) || computeValidate(document) !== Validate.off) {
4913 syncedDocuments.set(document.uri, document);
4917 didChange: (event, next) => {
4918 if (syncedDocuments.has(event.textDocument.uri)) {
4922 willSave: (event, next) => {
4923 if (syncedDocuments.has(event.document.uri)) {
4927 willSaveWaitUntil: (event, next) => {
4928 if (syncedDocuments.has(event.document.uri)) {
4931 return Promise.resolve([]);
4934 didSave: (document, next) => {
4935 if (syncedDocuments.has(document.uri)) {
4939 didClose: (document, next) => {
4940 const uri = document.uri;
4941 if (syncedDocuments.has(uri)) {
4942 syncedDocuments.delete(uri);
4946 provideCodeActions: (document, range, context2, token, next) => {
4947 if (!syncedDocuments.has(document.uri.toString())) {
4950 if (context2.only !== void 0 && !supportedQuickFixKinds.has(context2.only[0])) {
4953 if (context2.only === void 0 && (!context2.diagnostics || context2.diagnostics.length === 0)) {
4956 const eslintDiagnostics = [];
4957 for (const diagnostic of context2.diagnostics) {
4958 if (diagnostic.source === "eslint") {
4959 eslintDiagnostics.push(diagnostic);
4962 if (context2.only === void 0 && eslintDiagnostics.length === 0) {
4965 const newContext = Object.assign({}, context2, {diagnostics: eslintDiagnostics});
4966 return next(document, range, newContext, token);
4969 didChangeWatchedFile: (event, next) => {
4970 probeFailed.clear();
4973 didChangeConfiguration: (sections, next) => {
4976 configuration: async (params, _token, _next) => {
4977 if (params.items === void 0) {
4981 for (const item of params.items) {
4982 if (item.section || !item.scopeUri) {
4986 const resource = item.scopeUri;
4987 const config = import_coc3.workspace.getConfiguration("eslint", resource);
4988 const workspaceFolder = import_coc3.workspace.getWorkspaceFolder(resource);
4990 validate: Validate.off,
4991 packageManager: config.get("packageManager", "npm"),
4994 mode: CodeActionsOnSaveMode.all
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,
5005 disableRuleComment: config.get("codeAction.disableRuleComment", {enable: true, location: "separateLine"}),
5006 showDocumentation: config.get("codeAction.showDocumentation", {enable: true})
5009 const document = syncedDocuments.get(item.scopeUri);
5010 if (document === void 0) {
5011 result.push(settings);
5014 if (config.get("enabled", true)) {
5015 settings.validate = computeValidate(document);
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));
5022 if (workspaceFolder !== void 0) {
5023 settings.workspaceFolder = {
5024 name: workspaceFolder.name,
5025 uri: workspaceFolder.uri
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) {
5036 if (Is.string(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"];
5046 } else if (PatternItem.is(entry)) {
5047 pattern = entry.pattern;
5048 if (entry["!cwd"] !== void 0) {
5049 noCWD = entry["!cwd"];
5051 } else if (ModeItem.is(entry)) {
5052 workingDirectory = entry;
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);
5065 if (directory.charAt(directory.length - 1) !== import_path2.default.sep) {
5066 directory = directory + import_path2.default.sep;
5068 if (filePath.startsWith(directory)) {
5069 itemValue = directory;
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);
5075 if (pattern.charAt(pattern.length - 1) !== import_path2.default.posix.sep) {
5076 pattern = pattern + import_path2.default.posix.sep;
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];
5088 if (itemValue !== void 0) {
5089 if (workingDirectory === void 0 || ModeItem.is(workingDirectory)) {
5090 workingDirectory = {directory: itemValue, "!cwd": noCWD};
5092 if (workingDirectory.directory.length < itemValue.length) {
5093 workingDirectory.directory = itemValue;
5094 workingDirectory["!cwd"] = noCWD;
5099 settings.workingDirectory = workingDirectory;
5101 result.push(settings);
5110 client = new import_coc3.LanguageClient("ESLint", serverOptions, clientOptions);
5112 import_coc3.window.showErrorMessage(`The ESLint extension couldn't be started. See the ESLint output channel for details.`);
5115 import_coc3.workspace.registerAutocmd({
5117 event: "BufWritePre",
5118 arglist: [`+expand('<abuf>')`],
5119 callback: async (bufnr) => {
5120 let doc = import_coc3.workspace.getDocument(bufnr);
5121 if (!doc || !doc.attached)
5123 if (computeValidate(doc.textDocument) == Validate.off)
5125 const config = import_coc3.workspace.getConfiguration("eslint", doc.uri);
5126 if (config.get("autoFixOnSave", false)) {
5131 range: import_coc3.Range.create(0, 0, doc.textDocument.lineCount, 0),
5133 only: [`${import_vscode_languageserver_protocol.CodeActionKind.SourceFixAll}.eslint`],
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);
5146 import_coc3.workspace.onDidChangeConfiguration(() => {
5147 probeFailed.clear();
5148 for (const textDocument of syncedDocuments.values()) {
5149 if (computeValidate(textDocument) === Validate.off) {
5151 const provider = client.getFeature(import_vscode_languageserver_protocol.DidCloseTextDocumentNotification.method).getProvider(textDocument);
5152 provider == null ? void 0 : provider.send(textDocument);
5157 for (const textDocument of import_coc3.workspace.textDocuments) {
5158 if (!syncedDocuments.has(textDocument.uri.toString()) && computeValidate(textDocument) !== Validate.off) {
5160 const provider = client.getFeature(import_vscode_languageserver_protocol.DidOpenTextDocumentNotification.method).getProvider(textDocument);
5161 provider == null ? void 0 : provider.send(textDocument);
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;
5176 client.info(stopped);
5177 serverRunning = false;
5179 updateStatusBar((globalStatus != null ? globalStatus : serverRunning === false) ? 3 : 1, true);
5181 client.onReady().then(() => {
5182 client.onNotification(ShowOutputChannel.type, () => {
5183 client.outputChannel.show();
5185 client.onNotification(StatusNotification.type, (params) => {
5186 updateStatusInfo(params);
5187 updateStatusBarAndDiagnostics();
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();
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) {
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.`
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.`
5216 let resourceInfo = resource2ResourceInfo.get(params.document.uri);
5217 if (resourceInfo === void 0) {
5220 executionInfo: void 0
5222 resource2ResourceInfo.set(params.document.uri, resourceInfo);
5224 resourceInfo.status = 2;
5226 updateStatusBarAndDiagnostics();
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"
5240 const globalInstall = {
5241 npm: "npm install -g eslint",
5242 pnpm: "pnpm install -g eslint",
5243 yarn: "yarn global add eslint"
5245 const isPackageManagerNpm = packageManager === "npm";
5246 const outputItem = {
5247 title: "Go to output",
5250 if (workspaceFolder) {
5253 `Failed to load the ESLint library for the document ${uri.fsPath}`,
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.`,
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 = {};
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);
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);
5292 client.onRequest(OpenESLintDocRequest.type, (params) => {
5293 import_coc3.commands.executeCommand("vscode.open", import_coc3.Uri.parse(params.url));
5296 client.onRequest(ProbeFailedRequest.type, (params) => {
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);
5306 client.onRequest(ConfirmExecution.type, async (params) => {
5307 return confirmationSemaphore.lock(async () => {
5309 sessionState.set(params.libraryPath, params);
5311 if (disabledLibraries.has(params.libraryPath)) {
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);
5323 result = result != null ? result : 2;
5324 let executionInfo = libraryPath2ExecutionInfo.get(params.libraryPath);
5325 if (executionInfo === void 0) {
5329 codeActionProvider: void 0,
5330 diagnostics: import_coc3.languages.createDiagnosticCollection(),
5331 editorErrorUri: void 0
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) {
5340 workspaceFolder2ExecutionInfos.set(key, infos);
5342 infos.push(executionInfo);
5345 executionInfo.result = result;
5347 let resourceInfo = resource2ResourceInfo.get(params.uri);
5348 if (resourceInfo === void 0) {
5350 status: ConfirmExecutionResult.toStatus(result),
5353 resource2ResourceInfo.set(params.uri, resourceInfo);
5355 resourceInfo.status = ConfirmExecutionResult.toStatus(result);
5357 updateStatusBarAndDiagnostics();
5365 if (onActivateCommands) {
5366 onActivateCommands.forEach((command) => command.dispose());
5367 onActivateCommands = void 0;
5369 context.subscriptions.push(client.start(), import_coc3.events.on("BufEnter", () => {
5370 updateStatusBarAndDiagnostics();
5371 }), import_coc3.workspace.registerTextDocumentContentProvider("eslint-error", {
5372 provideTextDocumentContent: () => {
5374 "ESLint is disabled since its execution has not been approved or rejected yet.",
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",
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) {
5390 const textDocument = {
5392 version: doc.version
5395 command: "eslint.applyAllFixes",
5396 arguments: [textDocument]
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.");
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);
5409 if (globalStatus === 1 || globalStatus === 2 || globalStatus === 3) {
5410 client.outputChannel.show();
5413 if (globalStatus === 6) {
5414 await resetLibraryConfirmations(client, context, updateStatusBarAndDiagnostics);
5419 if (globalStatus === 4) {
5420 if (libraryPath2ExecutionInfo.size === 1) {
5421 candidate = libraryPath2ExecutionInfo.keys().next().value;
5424 if (globalStatus === 5) {
5425 if (disabledLibraries.size === 1) {
5426 candidate = disabledLibraries.keys().next().value;
5427 toRemove = disabledLibraries;
5430 if (candidate !== void 0) {
5431 if (sessionState.has(candidate)) {
5432 if (toRemove !== void 0) {
5433 toRemove.delete(candidate);
5435 await askForLibraryConfirmation(client, context, sessionState.get(candidate), updateStatusBarAndDiagnostics);
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);
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);
5451 import_coc3.window.showInformationMessage(doc && doc.attached ? "No ESLint library execution information found for current buffer." : "No ESLint library execution information found.");
5456 function deactivate() {
5457 if (onActivateCommands) {
5458 onActivateCommands.forEach((command) => command.dispose());
5461 //# sourceMappingURL=index.js.map