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-languageserver/lib/common/utils/is.js
36 var require_is = __commonJS((exports2) => {
38 Object.defineProperty(exports2, "__esModule", {value: true});
39 exports2.thenable = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
40 function boolean(value) {
41 return value === true || value === false;
43 exports2.boolean = boolean;
44 function string(value) {
45 return typeof value === "string" || value instanceof String;
47 exports2.string = string;
48 function number(value) {
49 return typeof value === "number" || value instanceof Number;
51 exports2.number = number;
52 function error(value) {
53 return value instanceof Error;
55 exports2.error = error;
56 function func(value) {
57 return typeof value === "function";
60 function array(value) {
61 return Array.isArray(value);
63 exports2.array = array;
64 function stringArray(value) {
65 return array(value) && value.every((elem) => string(elem));
67 exports2.stringArray = stringArray;
68 function typedArray(value, check) {
69 return Array.isArray(value) && value.every(check);
71 exports2.typedArray = typedArray;
72 function thenable(value) {
73 return value && func(value.then);
75 exports2.thenable = thenable;
78 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/ral.js
79 var require_ral = __commonJS((exports2) => {
81 Object.defineProperty(exports2, "__esModule", {value: true});
84 if (_ral === void 0) {
85 throw new Error(`No runtime abstraction layer installed`);
90 function install(ral) {
92 throw new Error(`No runtime abstraction layer provided`);
96 RAL2.install = install;
97 })(RAL || (RAL = {}));
98 exports2.default = RAL;
101 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/disposable.js
102 var require_disposable = __commonJS((exports2) => {
104 Object.defineProperty(exports2, "__esModule", {value: true});
105 exports2.Disposable = void 0;
107 (function(Disposable2) {
108 function create(func) {
113 Disposable2.create = create;
114 })(Disposable = exports2.Disposable || (exports2.Disposable = {}));
117 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
118 var require_messageBuffer = __commonJS((exports2) => {
120 Object.defineProperty(exports2, "__esModule", {value: true});
121 exports2.AbstractMessageBuffer = void 0;
125 var AbstractMessageBuffer = class {
126 constructor(encoding = "utf-8") {
127 this._encoding = encoding;
129 this._totalLength = 0;
132 return this._encoding;
135 const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk;
136 this._chunks.push(toAppend);
137 this._totalLength += toAppend.byteLength;
140 if (this._chunks.length === 0) {
146 let chunkBytesRead = 0;
148 while (chunkIndex < this._chunks.length) {
149 const chunk = this._chunks[chunkIndex];
152 while (offset < chunk.length) {
153 const value = chunk[offset];
185 chunkBytesRead += chunk.byteLength;
191 const buffer = this._read(chunkBytesRead + offset);
192 const result = new Map();
193 const headers = this.toString(buffer, "ascii").split(CRLF);
194 if (headers.length < 2) {
197 for (let i = 0; i < headers.length - 2; i++) {
198 const header = headers[i];
199 const index = header.indexOf(":");
201 throw new Error("Message header must separate key and value using :");
203 const key = header.substr(0, index);
204 const value = header.substr(index + 1).trim();
205 result.set(key, value);
209 tryReadBody(length) {
210 if (this._totalLength < length) {
213 return this._read(length);
215 get numberOfBytes() {
216 return this._totalLength;
219 if (byteCount === 0) {
220 return this.emptyBuffer();
222 if (byteCount > this._totalLength) {
223 throw new Error(`Cannot read so many bytes!`);
225 if (this._chunks[0].byteLength === byteCount) {
226 const chunk = this._chunks[0];
227 this._chunks.shift();
228 this._totalLength -= byteCount;
229 return this.asNative(chunk);
231 if (this._chunks[0].byteLength > byteCount) {
232 const chunk = this._chunks[0];
233 const result2 = this.asNative(chunk, byteCount);
234 this._chunks[0] = chunk.slice(byteCount);
235 this._totalLength -= byteCount;
238 const result = this.allocNative(byteCount);
239 let resultOffset = 0;
241 while (byteCount > 0) {
242 const chunk = this._chunks[chunkIndex];
243 if (chunk.byteLength > byteCount) {
244 const chunkPart = chunk.slice(0, byteCount);
245 result.set(chunkPart, resultOffset);
246 resultOffset += byteCount;
247 this._chunks[chunkIndex] = chunk.slice(byteCount);
248 this._totalLength -= byteCount;
249 byteCount -= byteCount;
251 result.set(chunk, resultOffset);
252 resultOffset += chunk.byteLength;
253 this._chunks.shift();
254 this._totalLength -= chunk.byteLength;
255 byteCount -= chunk.byteLength;
261 exports2.AbstractMessageBuffer = AbstractMessageBuffer;
264 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/node/ril.js
265 var require_ril = __commonJS((exports2) => {
267 Object.defineProperty(exports2, "__esModule", {value: true});
268 var ral_1 = require_ral();
269 var util_1 = require("util");
270 var disposable_1 = require_disposable();
271 var messageBuffer_1 = require_messageBuffer();
272 var MessageBuffer = class extends messageBuffer_1.AbstractMessageBuffer {
273 constructor(encoding = "utf-8") {
277 return MessageBuffer.emptyBuffer;
279 fromString(value, encoding) {
280 return Buffer.from(value, encoding);
282 toString(value, encoding) {
283 if (value instanceof Buffer) {
284 return value.toString(encoding);
286 return new util_1.TextDecoder(encoding).decode(value);
289 asNative(buffer, length) {
290 if (length === void 0) {
291 return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
293 return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
296 allocNative(length) {
297 return Buffer.allocUnsafe(length);
300 MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
301 var ReadableStreamWrapper = class {
302 constructor(stream) {
303 this.stream = stream;
306 this.stream.on("close", listener);
307 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
310 this.stream.on("error", listener);
311 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
314 this.stream.on("end", listener);
315 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
318 this.stream.on("data", listener);
319 return disposable_1.Disposable.create(() => this.stream.off("data", listener));
322 var WritableStreamWrapper = class {
323 constructor(stream) {
324 this.stream = stream;
327 this.stream.on("close", listener);
328 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
331 this.stream.on("error", listener);
332 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
335 this.stream.on("end", listener);
336 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
338 write(data, encoding) {
339 return new Promise((resolve, reject) => {
340 const callback = (error) => {
341 if (error === void 0 || error === null) {
347 if (typeof data === "string") {
348 this.stream.write(data, encoding, callback);
350 this.stream.write(data, callback);
358 var _ril = Object.freeze({
359 messageBuffer: Object.freeze({
360 create: (encoding) => new MessageBuffer(encoding)
362 applicationJson: Object.freeze({
363 encoder: Object.freeze({
364 name: "application/json",
365 encode: (msg, options) => {
367 return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options.charset));
369 return Promise.reject(err);
373 decoder: Object.freeze({
374 name: "application/json",
375 decode: (buffer, options) => {
377 if (buffer instanceof Buffer) {
378 return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
380 return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
383 return Promise.reject(err);
388 stream: Object.freeze({
389 asReadableStream: (stream) => new ReadableStreamWrapper(stream),
390 asWritableStream: (stream) => new WritableStreamWrapper(stream)
393 timer: Object.freeze({
394 setTimeout(callback, ms, ...args) {
395 return setTimeout(callback, ms, ...args);
397 clearTimeout(handle) {
398 clearTimeout(handle);
400 setImmediate(callback, ...args) {
401 return setImmediate(callback, ...args);
403 clearImmediate(handle) {
404 clearImmediate(handle);
413 ral_1.default.install(_ril);
415 RIL2.install = install;
416 })(RIL || (RIL = {}));
417 exports2.default = RIL;
420 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/is.js
421 var require_is2 = __commonJS((exports2) => {
423 Object.defineProperty(exports2, "__esModule", {value: true});
424 exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
425 function boolean(value) {
426 return value === true || value === false;
428 exports2.boolean = boolean;
429 function string(value) {
430 return typeof value === "string" || value instanceof String;
432 exports2.string = string;
433 function number(value) {
434 return typeof value === "number" || value instanceof Number;
436 exports2.number = number;
437 function error(value) {
438 return value instanceof Error;
440 exports2.error = error;
441 function func(value) {
442 return typeof value === "function";
444 exports2.func = func;
445 function array(value) {
446 return Array.isArray(value);
448 exports2.array = array;
449 function stringArray(value) {
450 return array(value) && value.every((elem) => string(elem));
452 exports2.stringArray = stringArray;
455 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/messages.js
456 var require_messages = __commonJS((exports2) => {
458 Object.defineProperty(exports2, "__esModule", {value: true});
459 exports2.isResponseMessage = exports2.isNotificationMessage = exports2.isRequestMessage = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
460 var is = require_is2();
462 (function(ErrorCodes2) {
463 ErrorCodes2.ParseError = -32700;
464 ErrorCodes2.InvalidRequest = -32600;
465 ErrorCodes2.MethodNotFound = -32601;
466 ErrorCodes2.InvalidParams = -32602;
467 ErrorCodes2.InternalError = -32603;
468 ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099;
469 ErrorCodes2.serverErrorStart = ErrorCodes2.jsonrpcReservedErrorRangeStart;
470 ErrorCodes2.MessageWriteError = -32099;
471 ErrorCodes2.MessageReadError = -32098;
472 ErrorCodes2.ServerNotInitialized = -32002;
473 ErrorCodes2.UnknownErrorCode = -32001;
474 ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3;
475 ErrorCodes2.serverErrorEnd = ErrorCodes2.jsonrpcReservedErrorRangeEnd;
476 })(ErrorCodes = exports2.ErrorCodes || (exports2.ErrorCodes = {}));
477 var ResponseError = class extends Error {
478 constructor(code, message, data) {
480 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
482 Object.setPrototypeOf(this, ResponseError.prototype);
487 message: this.message,
492 exports2.ResponseError = ResponseError;
493 var ParameterStructures = class {
498 return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
504 exports2.ParameterStructures = ParameterStructures;
505 ParameterStructures.auto = new ParameterStructures("auto");
506 ParameterStructures.byPosition = new ParameterStructures("byPosition");
507 ParameterStructures.byName = new ParameterStructures("byName");
508 var AbstractMessageSignature = class {
509 constructor(method, numberOfParams) {
510 this.method = method;
511 this.numberOfParams = numberOfParams;
513 get parameterStructures() {
514 return ParameterStructures.auto;
517 exports2.AbstractMessageSignature = AbstractMessageSignature;
518 var RequestType0 = class extends AbstractMessageSignature {
519 constructor(method) {
523 exports2.RequestType0 = RequestType0;
524 var RequestType = class extends AbstractMessageSignature {
525 constructor(method, _parameterStructures = ParameterStructures.auto) {
527 this._parameterStructures = _parameterStructures;
529 get parameterStructures() {
530 return this._parameterStructures;
533 exports2.RequestType = RequestType;
534 var RequestType1 = class extends AbstractMessageSignature {
535 constructor(method, _parameterStructures = ParameterStructures.auto) {
537 this._parameterStructures = _parameterStructures;
539 get parameterStructures() {
540 return this._parameterStructures;
543 exports2.RequestType1 = RequestType1;
544 var RequestType2 = class extends AbstractMessageSignature {
545 constructor(method) {
549 exports2.RequestType2 = RequestType2;
550 var RequestType3 = class extends AbstractMessageSignature {
551 constructor(method) {
555 exports2.RequestType3 = RequestType3;
556 var RequestType4 = class extends AbstractMessageSignature {
557 constructor(method) {
561 exports2.RequestType4 = RequestType4;
562 var RequestType5 = class extends AbstractMessageSignature {
563 constructor(method) {
567 exports2.RequestType5 = RequestType5;
568 var RequestType6 = class extends AbstractMessageSignature {
569 constructor(method) {
573 exports2.RequestType6 = RequestType6;
574 var RequestType7 = class extends AbstractMessageSignature {
575 constructor(method) {
579 exports2.RequestType7 = RequestType7;
580 var RequestType8 = class extends AbstractMessageSignature {
581 constructor(method) {
585 exports2.RequestType8 = RequestType8;
586 var RequestType9 = class extends AbstractMessageSignature {
587 constructor(method) {
591 exports2.RequestType9 = RequestType9;
592 var NotificationType = class extends AbstractMessageSignature {
593 constructor(method, _parameterStructures = ParameterStructures.auto) {
595 this._parameterStructures = _parameterStructures;
597 get parameterStructures() {
598 return this._parameterStructures;
601 exports2.NotificationType = NotificationType;
602 var NotificationType0 = class extends AbstractMessageSignature {
603 constructor(method) {
607 exports2.NotificationType0 = NotificationType0;
608 var NotificationType1 = class extends AbstractMessageSignature {
609 constructor(method, _parameterStructures = ParameterStructures.auto) {
611 this._parameterStructures = _parameterStructures;
613 get parameterStructures() {
614 return this._parameterStructures;
617 exports2.NotificationType1 = NotificationType1;
618 var NotificationType2 = class extends AbstractMessageSignature {
619 constructor(method) {
623 exports2.NotificationType2 = NotificationType2;
624 var NotificationType3 = class extends AbstractMessageSignature {
625 constructor(method) {
629 exports2.NotificationType3 = NotificationType3;
630 var NotificationType4 = class extends AbstractMessageSignature {
631 constructor(method) {
635 exports2.NotificationType4 = NotificationType4;
636 var NotificationType5 = class extends AbstractMessageSignature {
637 constructor(method) {
641 exports2.NotificationType5 = NotificationType5;
642 var NotificationType6 = class extends AbstractMessageSignature {
643 constructor(method) {
647 exports2.NotificationType6 = NotificationType6;
648 var NotificationType7 = class extends AbstractMessageSignature {
649 constructor(method) {
653 exports2.NotificationType7 = NotificationType7;
654 var NotificationType8 = class extends AbstractMessageSignature {
655 constructor(method) {
659 exports2.NotificationType8 = NotificationType8;
660 var NotificationType9 = class extends AbstractMessageSignature {
661 constructor(method) {
665 exports2.NotificationType9 = NotificationType9;
666 function isRequestMessage(message) {
667 const candidate = message;
668 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
670 exports2.isRequestMessage = isRequestMessage;
671 function isNotificationMessage(message) {
672 const candidate = message;
673 return candidate && is.string(candidate.method) && message.id === void 0;
675 exports2.isNotificationMessage = isNotificationMessage;
676 function isResponseMessage(message) {
677 const candidate = message;
678 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
680 exports2.isResponseMessage = isResponseMessage;
683 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/events.js
684 var require_events = __commonJS((exports2) => {
686 Object.defineProperty(exports2, "__esModule", {value: true});
687 exports2.Emitter = exports2.Event = void 0;
688 var ral_1 = require_ral();
691 const _disposable = {dispose() {
693 Event2.None = function() {
696 })(Event = exports2.Event || (exports2.Event = {}));
697 var CallbackList = class {
698 add(callback, context = null, bucket) {
699 if (!this._callbacks) {
700 this._callbacks = [];
703 this._callbacks.push(callback);
704 this._contexts.push(context);
705 if (Array.isArray(bucket)) {
706 bucket.push({dispose: () => this.remove(callback, context)});
709 remove(callback, context = null) {
710 if (!this._callbacks) {
713 let foundCallbackWithDifferentContext = false;
714 for (let i = 0, len = this._callbacks.length; i < len; i++) {
715 if (this._callbacks[i] === callback) {
716 if (this._contexts[i] === context) {
717 this._callbacks.splice(i, 1);
718 this._contexts.splice(i, 1);
721 foundCallbackWithDifferentContext = true;
725 if (foundCallbackWithDifferentContext) {
726 throw new Error("When adding a listener with a context, you should remove it with the same context");
730 if (!this._callbacks) {
733 const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
734 for (let i = 0, len = callbacks.length; i < len; i++) {
736 ret.push(callbacks[i].apply(contexts[i], args));
738 ral_1.default().console.error(e);
744 return !this._callbacks || this._callbacks.length === 0;
747 this._callbacks = void 0;
748 this._contexts = void 0;
751 var Emitter = class {
752 constructor(_options) {
753 this._options = _options;
757 this._event = (listener, thisArgs, disposables) => {
758 if (!this._callbacks) {
759 this._callbacks = new CallbackList();
761 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
762 this._options.onFirstListenerAdd(this);
764 this._callbacks.add(listener, thisArgs);
767 if (!this._callbacks) {
770 this._callbacks.remove(listener, thisArgs);
771 result.dispose = Emitter._noop;
772 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
773 this._options.onLastListenerRemove(this);
777 if (Array.isArray(disposables)) {
778 disposables.push(result);
786 if (this._callbacks) {
787 this._callbacks.invoke.call(this._callbacks, event);
791 if (this._callbacks) {
792 this._callbacks.dispose();
793 this._callbacks = void 0;
797 exports2.Emitter = Emitter;
798 Emitter._noop = function() {
802 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/cancellation.js
803 var require_cancellation = __commonJS((exports2) => {
805 Object.defineProperty(exports2, "__esModule", {value: true});
806 exports2.CancellationTokenSource = exports2.CancellationToken = void 0;
807 var ral_1 = require_ral();
808 var Is = require_is2();
809 var events_1 = require_events();
810 var CancellationToken;
811 (function(CancellationToken2) {
812 CancellationToken2.None = Object.freeze({
813 isCancellationRequested: false,
814 onCancellationRequested: events_1.Event.None
816 CancellationToken2.Cancelled = Object.freeze({
817 isCancellationRequested: true,
818 onCancellationRequested: events_1.Event.None
821 const candidate = value;
822 return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
824 CancellationToken2.is = is;
825 })(CancellationToken = exports2.CancellationToken || (exports2.CancellationToken = {}));
826 var shortcutEvent = Object.freeze(function(callback, context) {
827 const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
829 ral_1.default().timer.clearTimeout(handle);
832 var MutableToken = class {
834 this._isCancelled = false;
837 if (!this._isCancelled) {
838 this._isCancelled = true;
840 this._emitter.fire(void 0);
845 get isCancellationRequested() {
846 return this._isCancelled;
848 get onCancellationRequested() {
849 if (this._isCancelled) {
850 return shortcutEvent;
852 if (!this._emitter) {
853 this._emitter = new events_1.Emitter();
855 return this._emitter.event;
859 this._emitter.dispose();
860 this._emitter = void 0;
864 var CancellationTokenSource = class {
867 this._token = new MutableToken();
873 this._token = CancellationToken.Cancelled;
875 this._token.cancel();
880 this._token = CancellationToken.None;
881 } else if (this._token instanceof MutableToken) {
882 this._token.dispose();
886 exports2.CancellationTokenSource = CancellationTokenSource;
889 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/messageReader.js
890 var require_messageReader = __commonJS((exports2) => {
892 Object.defineProperty(exports2, "__esModule", {value: true});
893 exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0;
894 var ral_1 = require_ral();
895 var Is = require_is2();
896 var events_1 = require_events();
898 (function(MessageReader2) {
900 let candidate = value;
901 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
903 MessageReader2.is = is;
904 })(MessageReader = exports2.MessageReader || (exports2.MessageReader = {}));
905 var AbstractMessageReader = class {
907 this.errorEmitter = new events_1.Emitter();
908 this.closeEmitter = new events_1.Emitter();
909 this.partialMessageEmitter = new events_1.Emitter();
912 this.errorEmitter.dispose();
913 this.closeEmitter.dispose();
916 return this.errorEmitter.event;
919 this.errorEmitter.fire(this.asError(error));
922 return this.closeEmitter.event;
925 this.closeEmitter.fire(void 0);
927 get onPartialMessage() {
928 return this.partialMessageEmitter.event;
930 firePartialMessage(info) {
931 this.partialMessageEmitter.fire(info);
934 if (error instanceof Error) {
937 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`);
941 exports2.AbstractMessageReader = AbstractMessageReader;
942 var ResolvedMessageReaderOptions;
943 (function(ResolvedMessageReaderOptions2) {
944 function fromOptions(options) {
949 const contentDecoders = new Map();
950 let contentTypeDecoder;
951 const contentTypeDecoders = new Map();
952 if (options === void 0 || typeof options === "string") {
953 charset = options !== null && options !== void 0 ? options : "utf-8";
955 charset = (_a2 = options.charset) !== null && _a2 !== void 0 ? _a2 : "utf-8";
956 if (options.contentDecoder !== void 0) {
957 contentDecoder = options.contentDecoder;
958 contentDecoders.set(contentDecoder.name, contentDecoder);
960 if (options.contentDecoders !== void 0) {
961 for (const decoder of options.contentDecoders) {
962 contentDecoders.set(decoder.name, decoder);
965 if (options.contentTypeDecoder !== void 0) {
966 contentTypeDecoder = options.contentTypeDecoder;
967 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
969 if (options.contentTypeDecoders !== void 0) {
970 for (const decoder of options.contentTypeDecoders) {
971 contentTypeDecoders.set(decoder.name, decoder);
975 if (contentTypeDecoder === void 0) {
976 contentTypeDecoder = ral_1.default().applicationJson.decoder;
977 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
979 return {charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders};
981 ResolvedMessageReaderOptions2.fromOptions = fromOptions;
982 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
983 var ReadableStreamMessageReader = class extends AbstractMessageReader {
984 constructor(readable, options) {
986 this.readable = readable;
987 this.options = ResolvedMessageReaderOptions.fromOptions(options);
988 this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
989 this._partialMessageTimeout = 1e4;
990 this.nextMessageLength = -1;
991 this.messageToken = 0;
993 set partialMessageTimeout(timeout) {
994 this._partialMessageTimeout = timeout;
996 get partialMessageTimeout() {
997 return this._partialMessageTimeout;
1000 this.nextMessageLength = -1;
1001 this.messageToken = 0;
1002 this.partialMessageTimer = void 0;
1003 this.callback = callback;
1004 const result = this.readable.onData((data) => {
1007 this.readable.onError((error) => this.fireError(error));
1008 this.readable.onClose(() => this.fireClose());
1012 this.buffer.append(data);
1014 if (this.nextMessageLength === -1) {
1015 const headers = this.buffer.tryReadHeaders();
1019 const contentLength = headers.get("Content-Length");
1020 if (!contentLength) {
1021 throw new Error("Header must provide a Content-Length property.");
1023 const length = parseInt(contentLength);
1024 if (isNaN(length)) {
1025 throw new Error("Content-Length value must be a number.");
1027 this.nextMessageLength = length;
1029 const body = this.buffer.tryReadBody(this.nextMessageLength);
1030 if (body === void 0) {
1031 this.setPartialMessageTimer();
1034 this.clearPartialMessageTimer();
1035 this.nextMessageLength = -1;
1037 if (this.options.contentDecoder !== void 0) {
1038 p = this.options.contentDecoder.decode(body);
1040 p = Promise.resolve(body);
1043 this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
1046 this.fireError(error);
1049 this.fireError(error);
1053 clearPartialMessageTimer() {
1054 if (this.partialMessageTimer) {
1055 ral_1.default().timer.clearTimeout(this.partialMessageTimer);
1056 this.partialMessageTimer = void 0;
1059 setPartialMessageTimer() {
1060 this.clearPartialMessageTimer();
1061 if (this._partialMessageTimeout <= 0) {
1064 this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
1065 this.partialMessageTimer = void 0;
1066 if (token === this.messageToken) {
1067 this.firePartialMessage({messageToken: token, waitingTime: timeout});
1068 this.setPartialMessageTimer();
1070 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
1073 exports2.ReadableStreamMessageReader = ReadableStreamMessageReader;
1076 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/semaphore.js
1077 var require_semaphore = __commonJS((exports2) => {
1079 Object.defineProperty(exports2, "__esModule", {value: true});
1080 exports2.Semaphore = void 0;
1081 var ral_1 = require_ral();
1082 var Semaphore = class {
1083 constructor(capacity = 1) {
1084 if (capacity <= 0) {
1085 throw new Error("Capacity must be greater than 0");
1087 this._capacity = capacity;
1092 return new Promise((resolve, reject) => {
1093 this._waiting.push({thunk, resolve, reject});
1098 return this._active;
1101 if (this._waiting.length === 0 || this._active === this._capacity) {
1104 ral_1.default().timer.setImmediate(() => this.doRunNext());
1107 if (this._waiting.length === 0 || this._active === this._capacity) {
1110 const next = this._waiting.shift();
1112 if (this._active > this._capacity) {
1113 throw new Error(`To many thunks active`);
1116 const result = next.thunk();
1117 if (result instanceof Promise) {
1118 result.then((value) => {
1120 next.resolve(value);
1129 next.resolve(result);
1139 exports2.Semaphore = Semaphore;
1142 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/messageWriter.js
1143 var require_messageWriter = __commonJS((exports2) => {
1145 Object.defineProperty(exports2, "__esModule", {value: true});
1146 exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0;
1147 var ral_1 = require_ral();
1148 var Is = require_is2();
1149 var semaphore_1 = require_semaphore();
1150 var events_1 = require_events();
1151 var ContentLength = "Content-Length: ";
1154 (function(MessageWriter2) {
1155 function is(value) {
1156 let candidate = value;
1157 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write);
1159 MessageWriter2.is = is;
1160 })(MessageWriter = exports2.MessageWriter || (exports2.MessageWriter = {}));
1161 var AbstractMessageWriter = class {
1163 this.errorEmitter = new events_1.Emitter();
1164 this.closeEmitter = new events_1.Emitter();
1167 this.errorEmitter.dispose();
1168 this.closeEmitter.dispose();
1171 return this.errorEmitter.event;
1173 fireError(error, message, count) {
1174 this.errorEmitter.fire([this.asError(error), message, count]);
1177 return this.closeEmitter.event;
1180 this.closeEmitter.fire(void 0);
1183 if (error instanceof Error) {
1186 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : "unknown"}`);
1190 exports2.AbstractMessageWriter = AbstractMessageWriter;
1191 var ResolvedMessageWriterOptions;
1192 (function(ResolvedMessageWriterOptions2) {
1193 function fromOptions(options) {
1195 if (options === void 0 || typeof options === "string") {
1196 return {charset: options !== null && options !== void 0 ? options : "utf-8", contentTypeEncoder: ral_1.default().applicationJson.encoder};
1198 return {charset: (_a2 = options.charset) !== null && _a2 !== void 0 ? _a2 : "utf-8", contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder};
1201 ResolvedMessageWriterOptions2.fromOptions = fromOptions;
1202 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
1203 var WriteableStreamMessageWriter = class extends AbstractMessageWriter {
1204 constructor(writable, options) {
1206 this.writable = writable;
1207 this.options = ResolvedMessageWriterOptions.fromOptions(options);
1208 this.errorCount = 0;
1209 this.writeSemaphore = new semaphore_1.Semaphore(1);
1210 this.writable.onError((error) => this.fireError(error));
1211 this.writable.onClose(() => this.fireClose());
1214 return this.writeSemaphore.lock(async () => {
1215 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
1216 if (this.options.contentEncoder !== void 0) {
1217 return this.options.contentEncoder.encode(buffer);
1222 return payload.then((buffer) => {
1224 headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
1226 return this.doWrite(msg, headers, buffer);
1228 this.fireError(error);
1233 async doWrite(msg, headers, data) {
1235 await this.writable.write(headers.join(""), "ascii");
1236 return this.writable.write(data);
1238 this.handleError(error, msg);
1239 return Promise.reject(error);
1242 handleError(error, msg) {
1244 this.fireError(error, msg, this.errorCount);
1247 this.writable.end();
1250 exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
1253 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/linkedMap.js
1254 var require_linkedMap = __commonJS((exports2) => {
1256 Object.defineProperty(exports2, "__esModule", {value: true});
1257 exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
1262 Touch2.AsOld = Touch2.First;
1264 Touch2.AsNew = Touch2.Last;
1265 })(Touch = exports2.Touch || (exports2.Touch = {}));
1266 var LinkedMap = class {
1268 this[Symbol.toStringTag] = "LinkedMap";
1269 this._map = new Map();
1270 this._head = void 0;
1271 this._tail = void 0;
1277 this._head = void 0;
1278 this._tail = void 0;
1283 return !this._head && !this._tail;
1290 return (_a2 = this._head) === null || _a2 === void 0 ? void 0 : _a2.value;
1294 return (_a2 = this._tail) === null || _a2 === void 0 ? void 0 : _a2.value;
1297 return this._map.has(key);
1299 get(key, touch = Touch.None) {
1300 const item = this._map.get(key);
1304 if (touch !== Touch.None) {
1305 this.touch(item, touch);
1309 set(key, value, touch = Touch.None) {
1310 let item = this._map.get(key);
1313 if (touch !== Touch.None) {
1314 this.touch(item, touch);
1317 item = {key, value, next: void 0, previous: void 0};
1320 this.addItemLast(item);
1323 this.addItemFirst(item);
1326 this.addItemLast(item);
1329 this.addItemLast(item);
1332 this._map.set(key, item);
1338 return !!this.remove(key);
1341 const item = this._map.get(key);
1345 this._map.delete(key);
1346 this.removeItem(item);
1351 if (!this._head && !this._tail) {
1354 if (!this._head || !this._tail) {
1355 throw new Error("Invalid list");
1357 const item = this._head;
1358 this._map.delete(item.key);
1359 this.removeItem(item);
1363 forEach(callbackfn, thisArg) {
1364 const state = this._state;
1365 let current = this._head;
1368 callbackfn.bind(thisArg)(current.value, current.key, this);
1370 callbackfn(current.value, current.key, this);
1372 if (this._state !== state) {
1373 throw new Error(`LinkedMap got modified during iteration.`);
1375 current = current.next;
1380 const state = this._state;
1381 let current = this._head;
1383 [Symbol.iterator]() {
1387 if (map._state !== state) {
1388 throw new Error(`LinkedMap got modified during iteration.`);
1391 const result = {value: current.key, done: false};
1392 current = current.next;
1395 return {value: void 0, done: true};
1403 const state = this._state;
1404 let current = this._head;
1406 [Symbol.iterator]() {
1410 if (map._state !== state) {
1411 throw new Error(`LinkedMap got modified during iteration.`);
1414 const result = {value: current.value, done: false};
1415 current = current.next;
1418 return {value: void 0, done: true};
1426 const state = this._state;
1427 let current = this._head;
1429 [Symbol.iterator]() {
1433 if (map._state !== state) {
1434 throw new Error(`LinkedMap got modified during iteration.`);
1437 const result = {value: [current.key, current.value], done: false};
1438 current = current.next;
1441 return {value: void 0, done: true};
1447 [Symbol.iterator]() {
1448 return this.entries();
1451 if (newSize >= this.size) {
1454 if (newSize === 0) {
1458 let current = this._head;
1459 let currentSize = this.size;
1460 while (current && currentSize > newSize) {
1461 this._map.delete(current.key);
1462 current = current.next;
1465 this._head = current;
1466 this._size = currentSize;
1468 current.previous = void 0;
1472 addItemFirst(item) {
1473 if (!this._head && !this._tail) {
1475 } else if (!this._head) {
1476 throw new Error("Invalid list");
1478 item.next = this._head;
1479 this._head.previous = item;
1485 if (!this._head && !this._tail) {
1487 } else if (!this._tail) {
1488 throw new Error("Invalid list");
1490 item.previous = this._tail;
1491 this._tail.next = item;
1497 if (item === this._head && item === this._tail) {
1498 this._head = void 0;
1499 this._tail = void 0;
1500 } else if (item === this._head) {
1502 throw new Error("Invalid list");
1504 item.next.previous = void 0;
1505 this._head = item.next;
1506 } else if (item === this._tail) {
1507 if (!item.previous) {
1508 throw new Error("Invalid list");
1510 item.previous.next = void 0;
1511 this._tail = item.previous;
1513 const next = item.next;
1514 const previous = item.previous;
1515 if (!next || !previous) {
1516 throw new Error("Invalid list");
1518 next.previous = previous;
1519 previous.next = next;
1522 item.previous = void 0;
1525 touch(item, touch) {
1526 if (!this._head || !this._tail) {
1527 throw new Error("Invalid list");
1529 if (touch !== Touch.First && touch !== Touch.Last) {
1532 if (touch === Touch.First) {
1533 if (item === this._head) {
1536 const next = item.next;
1537 const previous = item.previous;
1538 if (item === this._tail) {
1539 previous.next = void 0;
1540 this._tail = previous;
1542 next.previous = previous;
1543 previous.next = next;
1545 item.previous = void 0;
1546 item.next = this._head;
1547 this._head.previous = item;
1550 } else if (touch === Touch.Last) {
1551 if (item === this._tail) {
1554 const next = item.next;
1555 const previous = item.previous;
1556 if (item === this._head) {
1557 next.previous = void 0;
1560 next.previous = previous;
1561 previous.next = next;
1564 item.previous = this._tail;
1565 this._tail.next = item;
1572 this.forEach((value, key) => {
1573 data.push([key, value]);
1579 for (const [key, value] of data) {
1580 this.set(key, value);
1584 exports2.LinkedMap = LinkedMap;
1585 var LRUCache = class extends LinkedMap {
1586 constructor(limit, ratio = 1) {
1588 this._limit = limit;
1589 this._ratio = Math.min(Math.max(0, ratio), 1);
1595 this._limit = limit;
1602 this._ratio = Math.min(Math.max(0, ratio), 1);
1605 get(key, touch = Touch.AsNew) {
1606 return super.get(key, touch);
1609 return super.get(key, Touch.None);
1612 super.set(key, value, Touch.Last);
1617 if (this.size > this._limit) {
1618 this.trimOld(Math.round(this._limit * this._ratio));
1622 exports2.LRUCache = LRUCache;
1625 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/connection.js
1626 var require_connection = __commonJS((exports2) => {
1628 Object.defineProperty(exports2, "__esModule", {value: true});
1629 exports2.createMessageConnection = exports2.ConnectionOptions = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.NullLogger = exports2.ProgressType = void 0;
1630 var ral_1 = require_ral();
1631 var Is = require_is2();
1632 var messages_1 = require_messages();
1633 var linkedMap_1 = require_linkedMap();
1634 var events_1 = require_events();
1635 var cancellation_1 = require_cancellation();
1636 var CancelNotification;
1637 (function(CancelNotification2) {
1638 CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest");
1639 })(CancelNotification || (CancelNotification = {}));
1640 var ProgressNotification;
1641 (function(ProgressNotification2) {
1642 ProgressNotification2.type = new messages_1.NotificationType("$/progress");
1643 })(ProgressNotification || (ProgressNotification = {}));
1644 var ProgressType = class {
1648 exports2.ProgressType = ProgressType;
1649 var StarRequestHandler;
1650 (function(StarRequestHandler2) {
1651 function is(value) {
1652 return Is.func(value);
1654 StarRequestHandler2.is = is;
1655 })(StarRequestHandler || (StarRequestHandler = {}));
1656 exports2.NullLogger = Object.freeze({
1668 Trace2[Trace2["Off"] = 0] = "Off";
1669 Trace2[Trace2["Messages"] = 1] = "Messages";
1670 Trace2[Trace2["Verbose"] = 2] = "Verbose";
1671 })(Trace = exports2.Trace || (exports2.Trace = {}));
1673 function fromString(value) {
1674 if (!Is.string(value)) {
1677 value = value.toLowerCase();
1682 return Trace2.Messages;
1684 return Trace2.Verbose;
1689 Trace2.fromString = fromString;
1690 function toString(value) {
1694 case Trace2.Messages:
1696 case Trace2.Verbose:
1702 Trace2.toString = toString;
1703 })(Trace = exports2.Trace || (exports2.Trace = {}));
1705 (function(TraceFormat2) {
1706 TraceFormat2["Text"] = "text";
1707 TraceFormat2["JSON"] = "json";
1708 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1709 (function(TraceFormat2) {
1710 function fromString(value) {
1711 value = value.toLowerCase();
1712 if (value === "json") {
1713 return TraceFormat2.JSON;
1715 return TraceFormat2.Text;
1718 TraceFormat2.fromString = fromString;
1719 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1720 var SetTraceNotification;
1721 (function(SetTraceNotification2) {
1722 SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace");
1723 })(SetTraceNotification = exports2.SetTraceNotification || (exports2.SetTraceNotification = {}));
1724 var LogTraceNotification;
1725 (function(LogTraceNotification2) {
1726 LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace");
1727 })(LogTraceNotification = exports2.LogTraceNotification || (exports2.LogTraceNotification = {}));
1728 var ConnectionErrors;
1729 (function(ConnectionErrors2) {
1730 ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed";
1731 ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed";
1732 ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
1733 })(ConnectionErrors = exports2.ConnectionErrors || (exports2.ConnectionErrors = {}));
1734 var ConnectionError = class extends Error {
1735 constructor(code, message) {
1738 Object.setPrototypeOf(this, ConnectionError.prototype);
1741 exports2.ConnectionError = ConnectionError;
1742 var ConnectionStrategy;
1743 (function(ConnectionStrategy2) {
1744 function is(value) {
1745 const candidate = value;
1746 return candidate && Is.func(candidate.cancelUndispatched);
1748 ConnectionStrategy2.is = is;
1749 })(ConnectionStrategy = exports2.ConnectionStrategy || (exports2.ConnectionStrategy = {}));
1750 var CancellationReceiverStrategy;
1751 (function(CancellationReceiverStrategy2) {
1752 CancellationReceiverStrategy2.Message = Object.freeze({
1753 createCancellationTokenSource(_) {
1754 return new cancellation_1.CancellationTokenSource();
1757 function is(value) {
1758 const candidate = value;
1759 return candidate && Is.func(candidate.createCancellationTokenSource);
1761 CancellationReceiverStrategy2.is = is;
1762 })(CancellationReceiverStrategy = exports2.CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = {}));
1763 var CancellationSenderStrategy;
1764 (function(CancellationSenderStrategy2) {
1765 CancellationSenderStrategy2.Message = Object.freeze({
1766 sendCancellation(conn, id) {
1767 conn.sendNotification(CancelNotification.type, {id});
1772 function is(value) {
1773 const candidate = value;
1774 return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
1776 CancellationSenderStrategy2.is = is;
1777 })(CancellationSenderStrategy = exports2.CancellationSenderStrategy || (exports2.CancellationSenderStrategy = {}));
1778 var CancellationStrategy;
1779 (function(CancellationStrategy2) {
1780 CancellationStrategy2.Message = Object.freeze({
1781 receiver: CancellationReceiverStrategy.Message,
1782 sender: CancellationSenderStrategy.Message
1784 function is(value) {
1785 const candidate = value;
1786 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
1788 CancellationStrategy2.is = is;
1789 })(CancellationStrategy = exports2.CancellationStrategy || (exports2.CancellationStrategy = {}));
1790 var ConnectionOptions;
1791 (function(ConnectionOptions2) {
1792 function is(value) {
1793 const candidate = value;
1794 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
1796 ConnectionOptions2.is = is;
1797 })(ConnectionOptions = exports2.ConnectionOptions || (exports2.ConnectionOptions = {}));
1798 var ConnectionState;
1799 (function(ConnectionState2) {
1800 ConnectionState2[ConnectionState2["New"] = 1] = "New";
1801 ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening";
1802 ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed";
1803 ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed";
1804 })(ConnectionState || (ConnectionState = {}));
1805 function createMessageConnection(messageReader, messageWriter, _logger, options) {
1806 const logger = _logger !== void 0 ? _logger : exports2.NullLogger;
1807 let sequenceNumber = 0;
1808 let notificationSquenceNumber = 0;
1809 let unknownResponseSquenceNumber = 0;
1810 const version = "2.0";
1811 let starRequestHandler = void 0;
1812 const requestHandlers = Object.create(null);
1813 let starNotificationHandler = void 0;
1814 const notificationHandlers = Object.create(null);
1815 const progressHandlers = new Map();
1817 let messageQueue = new linkedMap_1.LinkedMap();
1818 let responsePromises = Object.create(null);
1819 let requestTokens = Object.create(null);
1820 let trace = Trace.Off;
1821 let traceFormat = TraceFormat.Text;
1823 let state = ConnectionState.New;
1824 const errorEmitter = new events_1.Emitter();
1825 const closeEmitter = new events_1.Emitter();
1826 const unhandledNotificationEmitter = new events_1.Emitter();
1827 const unhandledProgressEmitter = new events_1.Emitter();
1828 const disposeEmitter = new events_1.Emitter();
1829 const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message;
1830 function createRequestQueueKey(id) {
1832 throw new Error(`Can't send requests with id null since the response can't be correlated.`);
1834 return "req-" + id.toString();
1836 function createResponseQueueKey(id) {
1838 return "res-unknown-" + (++unknownResponseSquenceNumber).toString();
1840 return "res-" + id.toString();
1843 function createNotificationQueueKey() {
1844 return "not-" + (++notificationSquenceNumber).toString();
1846 function addMessageToQueue(queue, message) {
1847 if (messages_1.isRequestMessage(message)) {
1848 queue.set(createRequestQueueKey(message.id), message);
1849 } else if (messages_1.isResponseMessage(message)) {
1850 queue.set(createResponseQueueKey(message.id), message);
1852 queue.set(createNotificationQueueKey(), message);
1855 function cancelUndispatched(_message) {
1858 function isListening() {
1859 return state === ConnectionState.Listening;
1861 function isClosed() {
1862 return state === ConnectionState.Closed;
1864 function isDisposed() {
1865 return state === ConnectionState.Disposed;
1867 function closeHandler() {
1868 if (state === ConnectionState.New || state === ConnectionState.Listening) {
1869 state = ConnectionState.Closed;
1870 closeEmitter.fire(void 0);
1873 function readErrorHandler(error) {
1874 errorEmitter.fire([error, void 0, void 0]);
1876 function writeErrorHandler(data) {
1877 errorEmitter.fire(data);
1879 messageReader.onClose(closeHandler);
1880 messageReader.onError(readErrorHandler);
1881 messageWriter.onClose(closeHandler);
1882 messageWriter.onError(writeErrorHandler);
1883 function triggerMessageQueue() {
1884 if (timer || messageQueue.size === 0) {
1887 timer = ral_1.default().timer.setImmediate(() => {
1889 processMessageQueue();
1892 function processMessageQueue() {
1893 if (messageQueue.size === 0) {
1896 const message = messageQueue.shift();
1898 if (messages_1.isRequestMessage(message)) {
1899 handleRequest(message);
1900 } else if (messages_1.isNotificationMessage(message)) {
1901 handleNotification(message);
1902 } else if (messages_1.isResponseMessage(message)) {
1903 handleResponse(message);
1905 handleInvalidMessage(message);
1908 triggerMessageQueue();
1911 const callback = (message) => {
1913 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
1914 const key = createRequestQueueKey(message.params.id);
1915 const toCancel = messageQueue.get(key);
1916 if (messages_1.isRequestMessage(toCancel)) {
1917 const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
1918 const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
1919 if (response && (response.error !== void 0 || response.result !== void 0)) {
1920 messageQueue.delete(key);
1921 response.id = toCancel.id;
1922 traceSendingResponse(response, message.method, Date.now());
1923 messageWriter.write(response);
1928 addMessageToQueue(messageQueue, message);
1930 triggerMessageQueue();
1933 function handleRequest(requestMessage) {
1937 function reply(resultOrError, method, startTime2) {
1940 id: requestMessage.id
1942 if (resultOrError instanceof messages_1.ResponseError) {
1943 message.error = resultOrError.toJson();
1945 message.result = resultOrError === void 0 ? null : resultOrError;
1947 traceSendingResponse(message, method, startTime2);
1948 messageWriter.write(message);
1950 function replyError(error, method, startTime2) {
1953 id: requestMessage.id,
1954 error: error.toJson()
1956 traceSendingResponse(message, method, startTime2);
1957 messageWriter.write(message);
1959 function replySuccess(result, method, startTime2) {
1960 if (result === void 0) {
1965 id: requestMessage.id,
1968 traceSendingResponse(message, method, startTime2);
1969 messageWriter.write(message);
1971 traceReceivedRequest(requestMessage);
1972 const element = requestHandlers[requestMessage.method];
1976 type = element.type;
1977 requestHandler = element.handler;
1979 const startTime = Date.now();
1980 if (requestHandler || starRequestHandler) {
1981 const tokenKey = String(requestMessage.id);
1982 const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
1983 requestTokens[tokenKey] = cancellationSource;
1986 if (requestHandler) {
1987 if (requestMessage.params === void 0) {
1988 if (type !== void 0 && type.numberOfParams !== 0) {
1989 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
1992 handlerResult = requestHandler(cancellationSource.token);
1993 } else if (Array.isArray(requestMessage.params)) {
1994 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) {
1995 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
1998 handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
2000 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2001 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
2004 handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
2006 } else if (starRequestHandler) {
2007 handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
2009 const promise = handlerResult;
2010 if (!handlerResult) {
2011 delete requestTokens[tokenKey];
2012 replySuccess(handlerResult, requestMessage.method, startTime);
2013 } else if (promise.then) {
2014 promise.then((resultOrError) => {
2015 delete requestTokens[tokenKey];
2016 reply(resultOrError, requestMessage.method, startTime);
2018 delete requestTokens[tokenKey];
2019 if (error instanceof messages_1.ResponseError) {
2020 replyError(error, requestMessage.method, startTime);
2021 } else if (error && Is.string(error.message)) {
2022 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2024 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2028 delete requestTokens[tokenKey];
2029 reply(handlerResult, requestMessage.method, startTime);
2032 delete requestTokens[tokenKey];
2033 if (error instanceof messages_1.ResponseError) {
2034 reply(error, requestMessage.method, startTime);
2035 } else if (error && Is.string(error.message)) {
2036 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2038 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2042 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
2045 function handleResponse(responseMessage) {
2049 if (responseMessage.id === null) {
2050 if (responseMessage.error) {
2051 logger.error(`Received response message without id: Error is:
2052 ${JSON.stringify(responseMessage.error, void 0, 4)}`);
2054 logger.error(`Received response message without id. No further error information provided.`);
2057 const key = String(responseMessage.id);
2058 const responsePromise = responsePromises[key];
2059 traceReceivedResponse(responseMessage, responsePromise);
2060 if (responsePromise) {
2061 delete responsePromises[key];
2063 if (responseMessage.error) {
2064 const error = responseMessage.error;
2065 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
2066 } else if (responseMessage.result !== void 0) {
2067 responsePromise.resolve(responseMessage.result);
2069 throw new Error("Should never happen.");
2072 if (error.message) {
2073 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
2075 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
2081 function handleNotification(message) {
2086 let notificationHandler;
2087 if (message.method === CancelNotification.type.method) {
2088 notificationHandler = (params) => {
2089 const id = params.id;
2090 const source = requestTokens[String(id)];
2096 const element = notificationHandlers[message.method];
2098 notificationHandler = element.handler;
2099 type = element.type;
2102 if (notificationHandler || starNotificationHandler) {
2104 traceReceivedNotification(message);
2105 if (notificationHandler) {
2106 if (message.params === void 0) {
2107 if (type !== void 0) {
2108 if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
2109 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
2112 notificationHandler();
2113 } else if (Array.isArray(message.params)) {
2114 if (type !== void 0) {
2115 if (type.parameterStructures === messages_1.ParameterStructures.byName) {
2116 logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
2118 if (type.numberOfParams !== message.params.length) {
2119 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
2122 notificationHandler(...message.params);
2124 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2125 logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
2127 notificationHandler(message.params);
2129 } else if (starNotificationHandler) {
2130 starNotificationHandler(message.method, message.params);
2133 if (error.message) {
2134 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
2136 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
2140 unhandledNotificationEmitter.fire(message);
2143 function handleInvalidMessage(message) {
2145 logger.error("Received empty message.");
2148 logger.error(`Received message which is neither a response nor a notification message:
2149 ${JSON.stringify(message, null, 4)}`);
2150 const responseMessage = message;
2151 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
2152 const key = String(responseMessage.id);
2153 const responseHandler = responsePromises[key];
2154 if (responseHandler) {
2155 responseHandler.reject(new Error("The received response has neither a result nor an error property."));
2159 function traceSendingRequest(message) {
2160 if (trace === Trace.Off || !tracer) {
2163 if (traceFormat === TraceFormat.Text) {
2165 if (trace === Trace.Verbose && message.params) {
2166 data = `Params: ${JSON.stringify(message.params, null, 4)}
2170 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
2172 logLSPMessage("send-request", message);
2175 function traceSendingNotification(message) {
2176 if (trace === Trace.Off || !tracer) {
2179 if (traceFormat === TraceFormat.Text) {
2181 if (trace === Trace.Verbose) {
2182 if (message.params) {
2183 data = `Params: ${JSON.stringify(message.params, null, 4)}
2187 data = "No parameters provided.\n\n";
2190 tracer.log(`Sending notification '${message.method}'.`, data);
2192 logLSPMessage("send-notification", message);
2195 function traceSendingResponse(message, method, startTime) {
2196 if (trace === Trace.Off || !tracer) {
2199 if (traceFormat === TraceFormat.Text) {
2201 if (trace === Trace.Verbose) {
2202 if (message.error && message.error.data) {
2203 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2207 if (message.result) {
2208 data = `Result: ${JSON.stringify(message.result, null, 4)}
2211 } else if (message.error === void 0) {
2212 data = "No result returned.\n\n";
2216 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
2218 logLSPMessage("send-response", message);
2221 function traceReceivedRequest(message) {
2222 if (trace === Trace.Off || !tracer) {
2225 if (traceFormat === TraceFormat.Text) {
2227 if (trace === Trace.Verbose && message.params) {
2228 data = `Params: ${JSON.stringify(message.params, null, 4)}
2232 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
2234 logLSPMessage("receive-request", message);
2237 function traceReceivedNotification(message) {
2238 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
2241 if (traceFormat === TraceFormat.Text) {
2243 if (trace === Trace.Verbose) {
2244 if (message.params) {
2245 data = `Params: ${JSON.stringify(message.params, null, 4)}
2249 data = "No parameters provided.\n\n";
2252 tracer.log(`Received notification '${message.method}'.`, data);
2254 logLSPMessage("receive-notification", message);
2257 function traceReceivedResponse(message, responsePromise) {
2258 if (trace === Trace.Off || !tracer) {
2261 if (traceFormat === TraceFormat.Text) {
2263 if (trace === Trace.Verbose) {
2264 if (message.error && message.error.data) {
2265 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2269 if (message.result) {
2270 data = `Result: ${JSON.stringify(message.result, null, 4)}
2273 } else if (message.error === void 0) {
2274 data = "No result returned.\n\n";
2278 if (responsePromise) {
2279 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
2280 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
2282 tracer.log(`Received response ${message.id} without active response promise.`, data);
2285 logLSPMessage("receive-response", message);
2288 function logLSPMessage(type, message) {
2289 if (!tracer || trace === Trace.Off) {
2292 const lspMessage = {
2296 timestamp: Date.now()
2298 tracer.log(lspMessage);
2300 function throwIfClosedOrDisposed() {
2302 throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed.");
2305 throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed.");
2308 function throwIfListening() {
2309 if (isListening()) {
2310 throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
2313 function throwIfNotListening() {
2314 if (!isListening()) {
2315 throw new Error("Call listen() first.");
2318 function undefinedToNull(param) {
2319 if (param === void 0) {
2325 function nullToUndefined(param) {
2326 if (param === null) {
2332 function isNamedParam(param) {
2333 return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object";
2335 function computeSingleParam(parameterStructures, param) {
2336 switch (parameterStructures) {
2337 case messages_1.ParameterStructures.auto:
2338 if (isNamedParam(param)) {
2339 return nullToUndefined(param);
2341 return [undefinedToNull(param)];
2344 case messages_1.ParameterStructures.byName:
2345 if (!isNamedParam(param)) {
2346 throw new Error(`Recevied parameters by name but param is not an object literal.`);
2348 return nullToUndefined(param);
2349 case messages_1.ParameterStructures.byPosition:
2350 return [undefinedToNull(param)];
2352 throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
2355 function computeMessageParams(type, params) {
2357 const numberOfParams = type.numberOfParams;
2358 switch (numberOfParams) {
2363 result = computeSingleParam(type.parameterStructures, params[0]);
2367 for (let i = 0; i < params.length && i < numberOfParams; i++) {
2368 result.push(undefinedToNull(params[i]));
2370 if (params.length < numberOfParams) {
2371 for (let i = params.length; i < numberOfParams; i++) {
2379 const connection = {
2380 sendNotification: (type, ...args) => {
2381 throwIfClosedOrDisposed();
2384 if (Is.string(type)) {
2386 const first = args[0];
2388 let parameterStructures = messages_1.ParameterStructures.auto;
2389 if (messages_1.ParameterStructures.is(first)) {
2391 parameterStructures = first;
2393 let paramEnd = args.length;
2394 const numberOfParams = paramEnd - paramStart;
2395 switch (numberOfParams) {
2397 messageParams = void 0;
2400 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2403 if (parameterStructures === messages_1.ParameterStructures.byName) {
2404 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
2406 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2410 const params = args;
2411 method = type.method;
2412 messageParams = computeMessageParams(type, params);
2414 const notificationMessage = {
2417 params: messageParams
2419 traceSendingNotification(notificationMessage);
2420 messageWriter.write(notificationMessage);
2422 onNotification: (type, handler) => {
2423 throwIfClosedOrDisposed();
2425 if (Is.func(type)) {
2426 starNotificationHandler = type;
2427 } else if (handler) {
2428 if (Is.string(type)) {
2430 notificationHandlers[type] = {type: void 0, handler};
2432 method = type.method;
2433 notificationHandlers[type.method] = {type, handler};
2438 if (method !== void 0) {
2439 delete notificationHandlers[method];
2441 starNotificationHandler = void 0;
2446 onProgress: (_type, token, handler) => {
2447 if (progressHandlers.has(token)) {
2448 throw new Error(`Progress handler for token ${token} already registered`);
2450 progressHandlers.set(token, handler);
2453 progressHandlers.delete(token);
2457 sendProgress: (_type, token, value) => {
2458 connection.sendNotification(ProgressNotification.type, {token, value});
2460 onUnhandledProgress: unhandledProgressEmitter.event,
2461 sendRequest: (type, ...args) => {
2462 throwIfClosedOrDisposed();
2463 throwIfNotListening();
2467 if (Is.string(type)) {
2469 const first = args[0];
2470 const last = args[args.length - 1];
2472 let parameterStructures = messages_1.ParameterStructures.auto;
2473 if (messages_1.ParameterStructures.is(first)) {
2475 parameterStructures = first;
2477 let paramEnd = args.length;
2478 if (cancellation_1.CancellationToken.is(last)) {
2479 paramEnd = paramEnd - 1;
2482 const numberOfParams = paramEnd - paramStart;
2483 switch (numberOfParams) {
2485 messageParams = void 0;
2488 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2491 if (parameterStructures === messages_1.ParameterStructures.byName) {
2492 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
2494 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2498 const params = args;
2499 method = type.method;
2500 messageParams = computeMessageParams(type, params);
2501 const numberOfParams = type.numberOfParams;
2502 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0;
2504 const id = sequenceNumber++;
2507 disposable = token.onCancellationRequested(() => {
2508 cancellationStrategy.sender.sendCancellation(connection, id);
2511 const result = new Promise((resolve, reject) => {
2512 const requestMessage = {
2516 params: messageParams
2518 const resolveWithCleanup = (r) => {
2520 cancellationStrategy.sender.cleanup(id);
2521 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2523 const rejectWithCleanup = (r) => {
2525 cancellationStrategy.sender.cleanup(id);
2526 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2528 let responsePromise = {method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup};
2529 traceSendingRequest(requestMessage);
2531 messageWriter.write(requestMessage);
2533 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason"));
2534 responsePromise = null;
2536 if (responsePromise) {
2537 responsePromises[String(id)] = responsePromise;
2542 onRequest: (type, handler) => {
2543 throwIfClosedOrDisposed();
2545 if (StarRequestHandler.is(type)) {
2547 starRequestHandler = type;
2548 } else if (Is.string(type)) {
2550 if (handler !== void 0) {
2552 requestHandlers[type] = {handler, type: void 0};
2555 if (handler !== void 0) {
2556 method = type.method;
2557 requestHandlers[type.method] = {type, handler};
2562 if (method === null) {
2565 if (method !== void 0) {
2566 delete requestHandlers[method];
2568 starRequestHandler = void 0;
2573 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
2574 let _sendNotification = false;
2575 let _traceFormat = TraceFormat.Text;
2576 if (sendNotificationOrTraceOptions !== void 0) {
2577 if (Is.boolean(sendNotificationOrTraceOptions)) {
2578 _sendNotification = sendNotificationOrTraceOptions;
2580 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2581 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2585 traceFormat = _traceFormat;
2586 if (trace === Trace.Off) {
2591 if (_sendNotification && !isClosed() && !isDisposed()) {
2592 connection.sendNotification(SetTraceNotification.type, {value: Trace.toString(_value)});
2595 onError: errorEmitter.event,
2596 onClose: closeEmitter.event,
2597 onUnhandledNotification: unhandledNotificationEmitter.event,
2598 onDispose: disposeEmitter.event,
2600 messageWriter.end();
2606 state = ConnectionState.Disposed;
2607 disposeEmitter.fire(void 0);
2608 const error = new Error("Connection got disposed.");
2609 Object.keys(responsePromises).forEach((key) => {
2610 responsePromises[key].reject(error);
2612 responsePromises = Object.create(null);
2613 requestTokens = Object.create(null);
2614 messageQueue = new linkedMap_1.LinkedMap();
2615 if (Is.func(messageWriter.dispose)) {
2616 messageWriter.dispose();
2618 if (Is.func(messageReader.dispose)) {
2619 messageReader.dispose();
2623 throwIfClosedOrDisposed();
2625 state = ConnectionState.Listening;
2626 messageReader.listen(callback);
2629 ral_1.default().console.log("inspect");
2632 connection.onNotification(LogTraceNotification.type, (params) => {
2633 if (trace === Trace.Off || !tracer) {
2636 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : void 0);
2638 connection.onNotification(ProgressNotification.type, (params) => {
2639 const handler = progressHandlers.get(params.token);
2641 handler(params.value);
2643 unhandledProgressEmitter.fire(params);
2648 exports2.createMessageConnection = createMessageConnection;
2651 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/common/api.js
2652 var require_api = __commonJS((exports2) => {
2654 Object.defineProperty(exports2, "__esModule", {value: true});
2655 exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.ProgressType = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.RAL = void 0;
2656 exports2.CancellationStrategy = void 0;
2657 var messages_1 = require_messages();
2658 Object.defineProperty(exports2, "RequestType", {enumerable: true, get: function() {
2659 return messages_1.RequestType;
2661 Object.defineProperty(exports2, "RequestType0", {enumerable: true, get: function() {
2662 return messages_1.RequestType0;
2664 Object.defineProperty(exports2, "RequestType1", {enumerable: true, get: function() {
2665 return messages_1.RequestType1;
2667 Object.defineProperty(exports2, "RequestType2", {enumerable: true, get: function() {
2668 return messages_1.RequestType2;
2670 Object.defineProperty(exports2, "RequestType3", {enumerable: true, get: function() {
2671 return messages_1.RequestType3;
2673 Object.defineProperty(exports2, "RequestType4", {enumerable: true, get: function() {
2674 return messages_1.RequestType4;
2676 Object.defineProperty(exports2, "RequestType5", {enumerable: true, get: function() {
2677 return messages_1.RequestType5;
2679 Object.defineProperty(exports2, "RequestType6", {enumerable: true, get: function() {
2680 return messages_1.RequestType6;
2682 Object.defineProperty(exports2, "RequestType7", {enumerable: true, get: function() {
2683 return messages_1.RequestType7;
2685 Object.defineProperty(exports2, "RequestType8", {enumerable: true, get: function() {
2686 return messages_1.RequestType8;
2688 Object.defineProperty(exports2, "RequestType9", {enumerable: true, get: function() {
2689 return messages_1.RequestType9;
2691 Object.defineProperty(exports2, "ResponseError", {enumerable: true, get: function() {
2692 return messages_1.ResponseError;
2694 Object.defineProperty(exports2, "ErrorCodes", {enumerable: true, get: function() {
2695 return messages_1.ErrorCodes;
2697 Object.defineProperty(exports2, "NotificationType", {enumerable: true, get: function() {
2698 return messages_1.NotificationType;
2700 Object.defineProperty(exports2, "NotificationType0", {enumerable: true, get: function() {
2701 return messages_1.NotificationType0;
2703 Object.defineProperty(exports2, "NotificationType1", {enumerable: true, get: function() {
2704 return messages_1.NotificationType1;
2706 Object.defineProperty(exports2, "NotificationType2", {enumerable: true, get: function() {
2707 return messages_1.NotificationType2;
2709 Object.defineProperty(exports2, "NotificationType3", {enumerable: true, get: function() {
2710 return messages_1.NotificationType3;
2712 Object.defineProperty(exports2, "NotificationType4", {enumerable: true, get: function() {
2713 return messages_1.NotificationType4;
2715 Object.defineProperty(exports2, "NotificationType5", {enumerable: true, get: function() {
2716 return messages_1.NotificationType5;
2718 Object.defineProperty(exports2, "NotificationType6", {enumerable: true, get: function() {
2719 return messages_1.NotificationType6;
2721 Object.defineProperty(exports2, "NotificationType7", {enumerable: true, get: function() {
2722 return messages_1.NotificationType7;
2724 Object.defineProperty(exports2, "NotificationType8", {enumerable: true, get: function() {
2725 return messages_1.NotificationType8;
2727 Object.defineProperty(exports2, "NotificationType9", {enumerable: true, get: function() {
2728 return messages_1.NotificationType9;
2730 Object.defineProperty(exports2, "ParameterStructures", {enumerable: true, get: function() {
2731 return messages_1.ParameterStructures;
2733 var disposable_1 = require_disposable();
2734 Object.defineProperty(exports2, "Disposable", {enumerable: true, get: function() {
2735 return disposable_1.Disposable;
2737 var events_1 = require_events();
2738 Object.defineProperty(exports2, "Event", {enumerable: true, get: function() {
2739 return events_1.Event;
2741 Object.defineProperty(exports2, "Emitter", {enumerable: true, get: function() {
2742 return events_1.Emitter;
2744 var cancellation_1 = require_cancellation();
2745 Object.defineProperty(exports2, "CancellationTokenSource", {enumerable: true, get: function() {
2746 return cancellation_1.CancellationTokenSource;
2748 Object.defineProperty(exports2, "CancellationToken", {enumerable: true, get: function() {
2749 return cancellation_1.CancellationToken;
2751 var messageReader_1 = require_messageReader();
2752 Object.defineProperty(exports2, "MessageReader", {enumerable: true, get: function() {
2753 return messageReader_1.MessageReader;
2755 Object.defineProperty(exports2, "AbstractMessageReader", {enumerable: true, get: function() {
2756 return messageReader_1.AbstractMessageReader;
2758 Object.defineProperty(exports2, "ReadableStreamMessageReader", {enumerable: true, get: function() {
2759 return messageReader_1.ReadableStreamMessageReader;
2761 var messageWriter_1 = require_messageWriter();
2762 Object.defineProperty(exports2, "MessageWriter", {enumerable: true, get: function() {
2763 return messageWriter_1.MessageWriter;
2765 Object.defineProperty(exports2, "AbstractMessageWriter", {enumerable: true, get: function() {
2766 return messageWriter_1.AbstractMessageWriter;
2768 Object.defineProperty(exports2, "WriteableStreamMessageWriter", {enumerable: true, get: function() {
2769 return messageWriter_1.WriteableStreamMessageWriter;
2771 var connection_1 = require_connection();
2772 Object.defineProperty(exports2, "ConnectionStrategy", {enumerable: true, get: function() {
2773 return connection_1.ConnectionStrategy;
2775 Object.defineProperty(exports2, "ConnectionOptions", {enumerable: true, get: function() {
2776 return connection_1.ConnectionOptions;
2778 Object.defineProperty(exports2, "NullLogger", {enumerable: true, get: function() {
2779 return connection_1.NullLogger;
2781 Object.defineProperty(exports2, "createMessageConnection", {enumerable: true, get: function() {
2782 return connection_1.createMessageConnection;
2784 Object.defineProperty(exports2, "ProgressType", {enumerable: true, get: function() {
2785 return connection_1.ProgressType;
2787 Object.defineProperty(exports2, "Trace", {enumerable: true, get: function() {
2788 return connection_1.Trace;
2790 Object.defineProperty(exports2, "TraceFormat", {enumerable: true, get: function() {
2791 return connection_1.TraceFormat;
2793 Object.defineProperty(exports2, "SetTraceNotification", {enumerable: true, get: function() {
2794 return connection_1.SetTraceNotification;
2796 Object.defineProperty(exports2, "LogTraceNotification", {enumerable: true, get: function() {
2797 return connection_1.LogTraceNotification;
2799 Object.defineProperty(exports2, "ConnectionErrors", {enumerable: true, get: function() {
2800 return connection_1.ConnectionErrors;
2802 Object.defineProperty(exports2, "ConnectionError", {enumerable: true, get: function() {
2803 return connection_1.ConnectionError;
2805 Object.defineProperty(exports2, "CancellationReceiverStrategy", {enumerable: true, get: function() {
2806 return connection_1.CancellationReceiverStrategy;
2808 Object.defineProperty(exports2, "CancellationSenderStrategy", {enumerable: true, get: function() {
2809 return connection_1.CancellationSenderStrategy;
2811 Object.defineProperty(exports2, "CancellationStrategy", {enumerable: true, get: function() {
2812 return connection_1.CancellationStrategy;
2814 var ral_1 = require_ral();
2815 exports2.RAL = ral_1.default;
2818 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/lib/node/main.js
2819 var require_main = __commonJS((exports2) => {
2821 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
2824 Object.defineProperty(o, k2, {enumerable: true, get: function() {
2827 } : function(o, m, k, k2) {
2832 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
2834 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
2835 __createBinding(exports3, m, p);
2837 Object.defineProperty(exports2, "__esModule", {value: true});
2838 exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0;
2839 var ril_1 = require_ril();
2840 ril_1.default.install();
2841 var api_1 = require_api();
2842 var path = require("path");
2843 var os = require("os");
2844 var crypto_1 = require("crypto");
2845 var net_1 = require("net");
2846 __exportStar2(require_api(), exports2);
2847 var IPCMessageReader = class extends api_1.AbstractMessageReader {
2848 constructor(process2) {
2850 this.process = process2;
2851 let eventEmitter = this.process;
2852 eventEmitter.on("error", (error) => this.fireError(error));
2853 eventEmitter.on("close", () => this.fireClose());
2856 this.process.on("message", callback);
2857 return api_1.Disposable.create(() => this.process.off("message", callback));
2860 exports2.IPCMessageReader = IPCMessageReader;
2861 var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
2862 constructor(process2) {
2864 this.process = process2;
2865 this.errorCount = 0;
2866 let eventEmitter = this.process;
2867 eventEmitter.on("error", (error) => this.fireError(error));
2868 eventEmitter.on("close", () => this.fireClose);
2872 if (typeof this.process.send === "function") {
2873 this.process.send(msg, void 0, void 0, (error) => {
2876 this.handleError(error, msg);
2878 this.errorCount = 0;
2882 return Promise.resolve();
2884 this.handleError(error, msg);
2885 return Promise.reject(error);
2888 handleError(error, msg) {
2890 this.fireError(error, msg, this.errorCount);
2895 exports2.IPCMessageWriter = IPCMessageWriter;
2896 var SocketMessageReader = class extends api_1.ReadableStreamMessageReader {
2897 constructor(socket, encoding = "utf-8") {
2898 super(ril_1.default().stream.asReadableStream(socket), encoding);
2901 exports2.SocketMessageReader = SocketMessageReader;
2902 var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2903 constructor(socket, options) {
2904 super(ril_1.default().stream.asWritableStream(socket), options);
2905 this.socket = socket;
2909 this.socket.destroy();
2912 exports2.SocketMessageWriter = SocketMessageWriter;
2913 var StreamMessageReader = class extends api_1.ReadableStreamMessageReader {
2914 constructor(readble, encoding) {
2915 super(ril_1.default().stream.asReadableStream(readble), encoding);
2918 exports2.StreamMessageReader = StreamMessageReader;
2919 var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2920 constructor(writable, options) {
2921 super(ril_1.default().stream.asWritableStream(writable), options);
2924 exports2.StreamMessageWriter = StreamMessageWriter;
2925 var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"];
2926 var safeIpcPathLengths = new Map([
2930 function generateRandomPipeName() {
2931 const randomSuffix = crypto_1.randomBytes(21).toString("hex");
2932 if (process.platform === "win32") {
2933 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
2936 if (XDG_RUNTIME_DIR) {
2937 result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
2939 result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
2941 const limit = safeIpcPathLengths.get(process.platform);
2942 if (limit !== void 0 && result.length >= limit) {
2943 ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
2947 exports2.generateRandomPipeName = generateRandomPipeName;
2948 function createClientPipeTransport(pipeName, encoding = "utf-8") {
2950 const connected = new Promise((resolve, _reject) => {
2951 connectResolve = resolve;
2953 return new Promise((resolve, reject) => {
2954 let server = net_1.createServer((socket) => {
2957 new SocketMessageReader(socket, encoding),
2958 new SocketMessageWriter(socket, encoding)
2961 server.on("error", reject);
2962 server.listen(pipeName, () => {
2963 server.removeListener("error", reject);
2965 onConnected: () => {
2972 exports2.createClientPipeTransport = createClientPipeTransport;
2973 function createServerPipeTransport(pipeName, encoding = "utf-8") {
2974 const socket = net_1.createConnection(pipeName);
2976 new SocketMessageReader(socket, encoding),
2977 new SocketMessageWriter(socket, encoding)
2980 exports2.createServerPipeTransport = createServerPipeTransport;
2981 function createClientSocketTransport(port, encoding = "utf-8") {
2983 const connected = new Promise((resolve, _reject) => {
2984 connectResolve = resolve;
2986 return new Promise((resolve, reject) => {
2987 const server = net_1.createServer((socket) => {
2990 new SocketMessageReader(socket, encoding),
2991 new SocketMessageWriter(socket, encoding)
2994 server.on("error", reject);
2995 server.listen(port, "127.0.0.1", () => {
2996 server.removeListener("error", reject);
2998 onConnected: () => {
3005 exports2.createClientSocketTransport = createClientSocketTransport;
3006 function createServerSocketTransport(port, encoding = "utf-8") {
3007 const socket = net_1.createConnection(port, "127.0.0.1");
3009 new SocketMessageReader(socket, encoding),
3010 new SocketMessageWriter(socket, encoding)
3013 exports2.createServerSocketTransport = createServerSocketTransport;
3014 function isReadableStream(value) {
3015 const candidate = value;
3016 return candidate.read !== void 0 && candidate.addListener !== void 0;
3018 function isWritableStream(value) {
3019 const candidate = value;
3020 return candidate.write !== void 0 && candidate.addListener !== void 0;
3022 function createMessageConnection(input, output, logger, options) {
3024 logger = api_1.NullLogger;
3026 const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
3027 const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
3028 if (api_1.ConnectionStrategy.is(options)) {
3029 options = {connectionStrategy: options};
3031 return api_1.createMessageConnection(reader, writer, logger, options);
3033 exports2.createMessageConnection = createMessageConnection;
3036 // node_modules/vscode-languageserver/node_modules/vscode-jsonrpc/node.js
3037 var require_node = __commonJS((exports2, module2) => {
3039 module2.exports = require_main();
3042 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-types/lib/esm/main.js
3043 var require_main2 = __commonJS((exports2) => {
3044 __export(exports2, {
3045 AnnotatedTextEdit: () => AnnotatedTextEdit,
3046 ChangeAnnotation: () => ChangeAnnotation,
3047 ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier,
3048 CodeAction: () => CodeAction,
3049 CodeActionContext: () => CodeActionContext,
3050 CodeActionKind: () => CodeActionKind,
3051 CodeDescription: () => CodeDescription,
3052 CodeLens: () => CodeLens,
3054 ColorInformation: () => ColorInformation,
3055 ColorPresentation: () => ColorPresentation,
3056 Command: () => Command,
3057 CompletionItem: () => CompletionItem,
3058 CompletionItemKind: () => CompletionItemKind,
3059 CompletionItemTag: () => CompletionItemTag,
3060 CompletionList: () => CompletionList,
3061 CreateFile: () => CreateFile,
3062 DeleteFile: () => DeleteFile,
3063 Diagnostic: () => Diagnostic,
3064 DiagnosticRelatedInformation: () => DiagnosticRelatedInformation,
3065 DiagnosticSeverity: () => DiagnosticSeverity,
3066 DiagnosticTag: () => DiagnosticTag,
3067 DocumentHighlight: () => DocumentHighlight,
3068 DocumentHighlightKind: () => DocumentHighlightKind,
3069 DocumentLink: () => DocumentLink,
3070 DocumentSymbol: () => DocumentSymbol,
3072 FoldingRange: () => FoldingRange,
3073 FoldingRangeKind: () => FoldingRangeKind,
3074 FormattingOptions: () => FormattingOptions,
3076 InsertReplaceEdit: () => InsertReplaceEdit,
3077 InsertTextFormat: () => InsertTextFormat,
3078 InsertTextMode: () => InsertTextMode,
3079 Location: () => Location,
3080 LocationLink: () => LocationLink,
3081 MarkedString: () => MarkedString,
3082 MarkupContent: () => MarkupContent,
3083 MarkupKind: () => MarkupKind,
3084 OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier,
3085 ParameterInformation: () => ParameterInformation,
3086 Position: () => Position,
3088 RenameFile: () => RenameFile,
3089 SelectionRange: () => SelectionRange,
3090 SignatureInformation: () => SignatureInformation,
3091 SymbolInformation: () => SymbolInformation,
3092 SymbolKind: () => SymbolKind,
3093 SymbolTag: () => SymbolTag,
3094 TextDocument: () => TextDocument2,
3095 TextDocumentEdit: () => TextDocumentEdit,
3096 TextDocumentIdentifier: () => TextDocumentIdentifier,
3097 TextDocumentItem: () => TextDocumentItem,
3098 TextEdit: () => TextEdit,
3099 VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier,
3100 WorkspaceChange: () => WorkspaceChange,
3101 WorkspaceEdit: () => WorkspaceEdit,
3102 integer: () => integer,
3103 uinteger: () => uinteger
3107 (function(integer2) {
3108 integer2.MIN_VALUE = -2147483648;
3109 integer2.MAX_VALUE = 2147483647;
3110 })(integer || (integer = {}));
3112 (function(uinteger2) {
3113 uinteger2.MIN_VALUE = 0;
3114 uinteger2.MAX_VALUE = 2147483647;
3115 })(uinteger || (uinteger = {}));
3117 (function(Position2) {
3118 function create(line, character) {
3119 if (line === Number.MAX_VALUE) {
3120 line = uinteger.MAX_VALUE;
3122 if (character === Number.MAX_VALUE) {
3123 character = uinteger.MAX_VALUE;
3125 return {line, character};
3127 Position2.create = create;
3128 function is(value) {
3129 var candidate = value;
3130 return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
3133 })(Position || (Position = {}));
3136 function create(one, two, three, four) {
3137 if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
3138 return {start: Position.create(one, two), end: Position.create(three, four)};
3139 } else if (Position.is(one) && Position.is(two)) {
3140 return {start: one, end: two};
3142 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
3145 Range2.create = create;
3146 function is(value) {
3147 var candidate = value;
3148 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
3151 })(Range || (Range = {}));
3153 (function(Location2) {
3154 function create(uri, range) {
3155 return {uri, range};
3157 Location2.create = create;
3158 function is(value) {
3159 var candidate = value;
3160 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3163 })(Location || (Location = {}));
3165 (function(LocationLink2) {
3166 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
3167 return {targetUri, targetRange, targetSelectionRange, originSelectionRange};
3169 LocationLink2.create = create;
3170 function is(value) {
3171 var candidate = value;
3172 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3174 LocationLink2.is = is;
3175 })(LocationLink || (LocationLink = {}));
3178 function create(red, green, blue, alpha) {
3186 Color2.create = create;
3187 function is(value) {
3188 var candidate = value;
3189 return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
3192 })(Color || (Color = {}));
3193 var ColorInformation;
3194 (function(ColorInformation2) {
3195 function create(range, color) {
3201 ColorInformation2.create = create;
3202 function is(value) {
3203 var candidate = value;
3204 return Range.is(candidate.range) && Color.is(candidate.color);
3206 ColorInformation2.is = is;
3207 })(ColorInformation || (ColorInformation = {}));
3208 var ColorPresentation;
3209 (function(ColorPresentation2) {
3210 function create(label, textEdit, additionalTextEdits) {
3217 ColorPresentation2.create = create;
3218 function is(value) {
3219 var candidate = value;
3220 return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
3222 ColorPresentation2.is = is;
3223 })(ColorPresentation || (ColorPresentation = {}));
3224 var FoldingRangeKind;
3225 (function(FoldingRangeKind2) {
3226 FoldingRangeKind2["Comment"] = "comment";
3227 FoldingRangeKind2["Imports"] = "imports";
3228 FoldingRangeKind2["Region"] = "region";
3229 })(FoldingRangeKind || (FoldingRangeKind = {}));
3231 (function(FoldingRange2) {
3232 function create(startLine, endLine, startCharacter, endCharacter, kind) {
3237 if (Is.defined(startCharacter)) {
3238 result.startCharacter = startCharacter;
3240 if (Is.defined(endCharacter)) {
3241 result.endCharacter = endCharacter;
3243 if (Is.defined(kind)) {
3248 FoldingRange2.create = create;
3249 function is(value) {
3250 var candidate = value;
3251 return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
3253 FoldingRange2.is = is;
3254 })(FoldingRange || (FoldingRange = {}));
3255 var DiagnosticRelatedInformation;
3256 (function(DiagnosticRelatedInformation2) {
3257 function create(location, message) {
3263 DiagnosticRelatedInformation2.create = create;
3264 function is(value) {
3265 var candidate = value;
3266 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
3268 DiagnosticRelatedInformation2.is = is;
3269 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
3270 var DiagnosticSeverity;
3271 (function(DiagnosticSeverity2) {
3272 DiagnosticSeverity2.Error = 1;
3273 DiagnosticSeverity2.Warning = 2;
3274 DiagnosticSeverity2.Information = 3;
3275 DiagnosticSeverity2.Hint = 4;
3276 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
3278 (function(DiagnosticTag2) {
3279 DiagnosticTag2.Unnecessary = 1;
3280 DiagnosticTag2.Deprecated = 2;
3281 })(DiagnosticTag || (DiagnosticTag = {}));
3282 var CodeDescription;
3283 (function(CodeDescription2) {
3284 function is(value) {
3285 var candidate = value;
3286 return candidate !== void 0 && candidate !== null && Is.string(candidate.href);
3288 CodeDescription2.is = is;
3289 })(CodeDescription || (CodeDescription = {}));
3291 (function(Diagnostic2) {
3292 function create(range, message, severity, code, source, relatedInformation) {
3293 var result = {range, message};
3294 if (Is.defined(severity)) {
3295 result.severity = severity;
3297 if (Is.defined(code)) {
3300 if (Is.defined(source)) {
3301 result.source = source;
3303 if (Is.defined(relatedInformation)) {
3304 result.relatedInformation = relatedInformation;
3308 Diagnostic2.create = create;
3309 function is(value) {
3311 var candidate = value;
3312 return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a2 = candidate.codeDescription) === null || _a2 === void 0 ? void 0 : _a2.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
3314 Diagnostic2.is = is;
3315 })(Diagnostic || (Diagnostic = {}));
3317 (function(Command2) {
3318 function create(title, command) {
3320 for (var _i = 2; _i < arguments.length; _i++) {
3321 args[_i - 2] = arguments[_i];
3323 var result = {title, command};
3324 if (Is.defined(args) && args.length > 0) {
3325 result.arguments = args;
3329 Command2.create = create;
3330 function is(value) {
3331 var candidate = value;
3332 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
3335 })(Command || (Command = {}));
3337 (function(TextEdit2) {
3338 function replace(range, newText) {
3339 return {range, newText};
3341 TextEdit2.replace = replace;
3342 function insert(position, newText) {
3343 return {range: {start: position, end: position}, newText};
3345 TextEdit2.insert = insert;
3346 function del(range) {
3347 return {range, newText: ""};
3349 TextEdit2.del = del;
3350 function is(value) {
3351 var candidate = value;
3352 return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
3355 })(TextEdit || (TextEdit = {}));
3356 var ChangeAnnotation;
3357 (function(ChangeAnnotation2) {
3358 function create(label, needsConfirmation, description) {
3359 var result = {label};
3360 if (needsConfirmation !== void 0) {
3361 result.needsConfirmation = needsConfirmation;
3363 if (description !== void 0) {
3364 result.description = description;
3368 ChangeAnnotation2.create = create;
3369 function is(value) {
3370 var candidate = value;
3371 return candidate !== void 0 && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
3373 ChangeAnnotation2.is = is;
3374 })(ChangeAnnotation || (ChangeAnnotation = {}));
3375 var ChangeAnnotationIdentifier;
3376 (function(ChangeAnnotationIdentifier2) {
3377 function is(value) {
3378 var candidate = value;
3379 return typeof candidate === "string";
3381 ChangeAnnotationIdentifier2.is = is;
3382 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
3383 var AnnotatedTextEdit;
3384 (function(AnnotatedTextEdit2) {
3385 function replace(range, newText, annotation) {
3386 return {range, newText, annotationId: annotation};
3388 AnnotatedTextEdit2.replace = replace;
3389 function insert(position, newText, annotation) {
3390 return {range: {start: position, end: position}, newText, annotationId: annotation};
3392 AnnotatedTextEdit2.insert = insert;
3393 function del(range, annotation) {
3394 return {range, newText: "", annotationId: annotation};
3396 AnnotatedTextEdit2.del = del;
3397 function is(value) {
3398 var candidate = value;
3399 return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
3401 AnnotatedTextEdit2.is = is;
3402 })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
3403 var TextDocumentEdit;
3404 (function(TextDocumentEdit2) {
3405 function create(textDocument, edits) {
3406 return {textDocument, edits};
3408 TextDocumentEdit2.create = create;
3409 function is(value) {
3410 var candidate = value;
3411 return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
3413 TextDocumentEdit2.is = is;
3414 })(TextDocumentEdit || (TextDocumentEdit = {}));
3416 (function(CreateFile2) {
3417 function create(uri, options, annotation) {
3422 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3423 result.options = options;
3425 if (annotation !== void 0) {
3426 result.annotationId = annotation;
3430 CreateFile2.create = create;
3431 function is(value) {
3432 var candidate = value;
3433 return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3435 CreateFile2.is = is;
3436 })(CreateFile || (CreateFile = {}));
3438 (function(RenameFile2) {
3439 function create(oldUri, newUri, options, annotation) {
3445 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3446 result.options = options;
3448 if (annotation !== void 0) {
3449 result.annotationId = annotation;
3453 RenameFile2.create = create;
3454 function is(value) {
3455 var candidate = value;
3456 return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3458 RenameFile2.is = is;
3459 })(RenameFile || (RenameFile = {}));
3461 (function(DeleteFile2) {
3462 function create(uri, options, annotation) {
3467 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
3468 result.options = options;
3470 if (annotation !== void 0) {
3471 result.annotationId = annotation;
3475 DeleteFile2.create = create;
3476 function is(value) {
3477 var candidate = value;
3478 return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3480 DeleteFile2.is = is;
3481 })(DeleteFile || (DeleteFile = {}));
3483 (function(WorkspaceEdit2) {
3484 function is(value) {
3485 var candidate = value;
3486 return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) {
3487 if (Is.string(change.kind)) {
3488 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
3490 return TextDocumentEdit.is(change);
3494 WorkspaceEdit2.is = is;
3495 })(WorkspaceEdit || (WorkspaceEdit = {}));
3496 var TextEditChangeImpl = function() {
3497 function TextEditChangeImpl2(edits, changeAnnotations) {
3499 this.changeAnnotations = changeAnnotations;
3501 TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) {
3504 if (annotation === void 0) {
3505 edit = TextEdit.insert(position, newText);
3506 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3508 edit = AnnotatedTextEdit.insert(position, newText, annotation);
3510 this.assertChangeAnnotations(this.changeAnnotations);
3511 id = this.changeAnnotations.manage(annotation);
3512 edit = AnnotatedTextEdit.insert(position, newText, id);
3514 this.edits.push(edit);
3515 if (id !== void 0) {
3519 TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) {
3522 if (annotation === void 0) {
3523 edit = TextEdit.replace(range, newText);
3524 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3526 edit = AnnotatedTextEdit.replace(range, newText, annotation);
3528 this.assertChangeAnnotations(this.changeAnnotations);
3529 id = this.changeAnnotations.manage(annotation);
3530 edit = AnnotatedTextEdit.replace(range, newText, id);
3532 this.edits.push(edit);
3533 if (id !== void 0) {
3537 TextEditChangeImpl2.prototype.delete = function(range, annotation) {
3540 if (annotation === void 0) {
3541 edit = TextEdit.del(range);
3542 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3544 edit = AnnotatedTextEdit.del(range, annotation);
3546 this.assertChangeAnnotations(this.changeAnnotations);
3547 id = this.changeAnnotations.manage(annotation);
3548 edit = AnnotatedTextEdit.del(range, id);
3550 this.edits.push(edit);
3551 if (id !== void 0) {
3555 TextEditChangeImpl2.prototype.add = function(edit) {
3556 this.edits.push(edit);
3558 TextEditChangeImpl2.prototype.all = function() {
3561 TextEditChangeImpl2.prototype.clear = function() {
3562 this.edits.splice(0, this.edits.length);
3564 TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) {
3565 if (value === void 0) {
3566 throw new Error("Text edit change is not configured to manage change annotations.");
3569 return TextEditChangeImpl2;
3571 var ChangeAnnotations = function() {
3572 function ChangeAnnotations2(annotations) {
3573 this._annotations = annotations === void 0 ? Object.create(null) : annotations;
3577 ChangeAnnotations2.prototype.all = function() {
3578 return this._annotations;
3580 Object.defineProperty(ChangeAnnotations2.prototype, "size", {
3587 ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) {
3589 if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
3590 id = idOrAnnotation;
3593 annotation = idOrAnnotation;
3595 if (this._annotations[id] !== void 0) {
3596 throw new Error("Id " + id + " is already in use.");
3598 if (annotation === void 0) {
3599 throw new Error("No annotation provided for id " + id);
3601 this._annotations[id] = annotation;
3605 ChangeAnnotations2.prototype.nextId = function() {
3607 return this._counter.toString();
3609 return ChangeAnnotations2;
3611 var WorkspaceChange = function() {
3612 function WorkspaceChange2(workspaceEdit) {
3614 this._textEditChanges = Object.create(null);
3615 if (workspaceEdit !== void 0) {
3616 this._workspaceEdit = workspaceEdit;
3617 if (workspaceEdit.documentChanges) {
3618 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
3619 workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3620 workspaceEdit.documentChanges.forEach(function(change) {
3621 if (TextDocumentEdit.is(change)) {
3622 var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
3623 _this._textEditChanges[change.textDocument.uri] = textEditChange;
3626 } else if (workspaceEdit.changes) {
3627 Object.keys(workspaceEdit.changes).forEach(function(key) {
3628 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
3629 _this._textEditChanges[key] = textEditChange;
3633 this._workspaceEdit = {};
3636 Object.defineProperty(WorkspaceChange2.prototype, "edit", {
3638 this.initDocumentChanges();
3639 if (this._changeAnnotations !== void 0) {
3640 if (this._changeAnnotations.size === 0) {
3641 this._workspaceEdit.changeAnnotations = void 0;
3643 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3646 return this._workspaceEdit;
3651 WorkspaceChange2.prototype.getTextEditChange = function(key) {
3652 if (OptionalVersionedTextDocumentIdentifier.is(key)) {
3653 this.initDocumentChanges();
3654 if (this._workspaceEdit.documentChanges === void 0) {
3655 throw new Error("Workspace edit is not configured for document changes.");
3657 var textDocument = {uri: key.uri, version: key.version};
3658 var result = this._textEditChanges[textDocument.uri];
3661 var textDocumentEdit = {
3665 this._workspaceEdit.documentChanges.push(textDocumentEdit);
3666 result = new TextEditChangeImpl(edits, this._changeAnnotations);
3667 this._textEditChanges[textDocument.uri] = result;
3672 if (this._workspaceEdit.changes === void 0) {
3673 throw new Error("Workspace edit is not configured for normal text edit changes.");
3675 var result = this._textEditChanges[key];
3678 this._workspaceEdit.changes[key] = edits;
3679 result = new TextEditChangeImpl(edits);
3680 this._textEditChanges[key] = result;
3685 WorkspaceChange2.prototype.initDocumentChanges = function() {
3686 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3687 this._changeAnnotations = new ChangeAnnotations();
3688 this._workspaceEdit.documentChanges = [];
3689 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3692 WorkspaceChange2.prototype.initChanges = function() {
3693 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3694 this._workspaceEdit.changes = Object.create(null);
3697 WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
3698 this.initDocumentChanges();
3699 if (this._workspaceEdit.documentChanges === void 0) {
3700 throw new Error("Workspace edit is not configured for document changes.");
3703 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3704 annotation = optionsOrAnnotation;
3706 options = optionsOrAnnotation;
3710 if (annotation === void 0) {
3711 operation = CreateFile.create(uri, options);
3713 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3714 operation = CreateFile.create(uri, options, id);
3716 this._workspaceEdit.documentChanges.push(operation);
3717 if (id !== void 0) {
3721 WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) {
3722 this.initDocumentChanges();
3723 if (this._workspaceEdit.documentChanges === void 0) {
3724 throw new Error("Workspace edit is not configured for document changes.");
3727 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3728 annotation = optionsOrAnnotation;
3730 options = optionsOrAnnotation;
3734 if (annotation === void 0) {
3735 operation = RenameFile.create(oldUri, newUri, options);
3737 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3738 operation = RenameFile.create(oldUri, newUri, options, id);
3740 this._workspaceEdit.documentChanges.push(operation);
3741 if (id !== void 0) {
3745 WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) {
3746 this.initDocumentChanges();
3747 if (this._workspaceEdit.documentChanges === void 0) {
3748 throw new Error("Workspace edit is not configured for document changes.");
3751 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3752 annotation = optionsOrAnnotation;
3754 options = optionsOrAnnotation;
3758 if (annotation === void 0) {
3759 operation = DeleteFile.create(uri, options);
3761 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3762 operation = DeleteFile.create(uri, options, id);
3764 this._workspaceEdit.documentChanges.push(operation);
3765 if (id !== void 0) {
3769 return WorkspaceChange2;
3771 var TextDocumentIdentifier;
3772 (function(TextDocumentIdentifier2) {
3773 function create(uri) {
3776 TextDocumentIdentifier2.create = create;
3777 function is(value) {
3778 var candidate = value;
3779 return Is.defined(candidate) && Is.string(candidate.uri);
3781 TextDocumentIdentifier2.is = is;
3782 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
3783 var VersionedTextDocumentIdentifier;
3784 (function(VersionedTextDocumentIdentifier2) {
3785 function create(uri, version) {
3786 return {uri, version};
3788 VersionedTextDocumentIdentifier2.create = create;
3789 function is(value) {
3790 var candidate = value;
3791 return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
3793 VersionedTextDocumentIdentifier2.is = is;
3794 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
3795 var OptionalVersionedTextDocumentIdentifier;
3796 (function(OptionalVersionedTextDocumentIdentifier2) {
3797 function create(uri, version) {
3798 return {uri, version};
3800 OptionalVersionedTextDocumentIdentifier2.create = create;
3801 function is(value) {
3802 var candidate = value;
3803 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
3805 OptionalVersionedTextDocumentIdentifier2.is = is;
3806 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
3807 var TextDocumentItem;
3808 (function(TextDocumentItem2) {
3809 function create(uri, languageId, version, text) {
3810 return {uri, languageId, version, text};
3812 TextDocumentItem2.create = create;
3813 function is(value) {
3814 var candidate = value;
3815 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
3817 TextDocumentItem2.is = is;
3818 })(TextDocumentItem || (TextDocumentItem = {}));
3820 (function(MarkupKind2) {
3821 MarkupKind2.PlainText = "plaintext";
3822 MarkupKind2.Markdown = "markdown";
3823 })(MarkupKind || (MarkupKind = {}));
3824 (function(MarkupKind2) {
3825 function is(value) {
3826 var candidate = value;
3827 return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
3829 MarkupKind2.is = is;
3830 })(MarkupKind || (MarkupKind = {}));
3832 (function(MarkupContent2) {
3833 function is(value) {
3834 var candidate = value;
3835 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
3837 MarkupContent2.is = is;
3838 })(MarkupContent || (MarkupContent = {}));
3839 var CompletionItemKind;
3840 (function(CompletionItemKind2) {
3841 CompletionItemKind2.Text = 1;
3842 CompletionItemKind2.Method = 2;
3843 CompletionItemKind2.Function = 3;
3844 CompletionItemKind2.Constructor = 4;
3845 CompletionItemKind2.Field = 5;
3846 CompletionItemKind2.Variable = 6;
3847 CompletionItemKind2.Class = 7;
3848 CompletionItemKind2.Interface = 8;
3849 CompletionItemKind2.Module = 9;
3850 CompletionItemKind2.Property = 10;
3851 CompletionItemKind2.Unit = 11;
3852 CompletionItemKind2.Value = 12;
3853 CompletionItemKind2.Enum = 13;
3854 CompletionItemKind2.Keyword = 14;
3855 CompletionItemKind2.Snippet = 15;
3856 CompletionItemKind2.Color = 16;
3857 CompletionItemKind2.File = 17;
3858 CompletionItemKind2.Reference = 18;
3859 CompletionItemKind2.Folder = 19;
3860 CompletionItemKind2.EnumMember = 20;
3861 CompletionItemKind2.Constant = 21;
3862 CompletionItemKind2.Struct = 22;
3863 CompletionItemKind2.Event = 23;
3864 CompletionItemKind2.Operator = 24;
3865 CompletionItemKind2.TypeParameter = 25;
3866 })(CompletionItemKind || (CompletionItemKind = {}));
3867 var InsertTextFormat;
3868 (function(InsertTextFormat2) {
3869 InsertTextFormat2.PlainText = 1;
3870 InsertTextFormat2.Snippet = 2;
3871 })(InsertTextFormat || (InsertTextFormat = {}));
3872 var CompletionItemTag;
3873 (function(CompletionItemTag2) {
3874 CompletionItemTag2.Deprecated = 1;
3875 })(CompletionItemTag || (CompletionItemTag = {}));
3876 var InsertReplaceEdit;
3877 (function(InsertReplaceEdit2) {
3878 function create(newText, insert, replace) {
3879 return {newText, insert, replace};
3881 InsertReplaceEdit2.create = create;
3882 function is(value) {
3883 var candidate = value;
3884 return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
3886 InsertReplaceEdit2.is = is;
3887 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
3889 (function(InsertTextMode2) {
3890 InsertTextMode2.asIs = 1;
3891 InsertTextMode2.adjustIndentation = 2;
3892 })(InsertTextMode || (InsertTextMode = {}));
3894 (function(CompletionItem2) {
3895 function create(label) {
3898 CompletionItem2.create = create;
3899 })(CompletionItem || (CompletionItem = {}));
3901 (function(CompletionList2) {
3902 function create(items, isIncomplete) {
3903 return {items: items ? items : [], isIncomplete: !!isIncomplete};
3905 CompletionList2.create = create;
3906 })(CompletionList || (CompletionList = {}));
3908 (function(MarkedString2) {
3909 function fromPlainText(plainText) {
3910 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
3912 MarkedString2.fromPlainText = fromPlainText;
3913 function is(value) {
3914 var candidate = value;
3915 return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
3917 MarkedString2.is = is;
3918 })(MarkedString || (MarkedString = {}));
3921 function is(value) {
3922 var candidate = value;
3923 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
3926 })(Hover || (Hover = {}));
3927 var ParameterInformation;
3928 (function(ParameterInformation2) {
3929 function create(label, documentation) {
3930 return documentation ? {label, documentation} : {label};
3932 ParameterInformation2.create = create;
3933 })(ParameterInformation || (ParameterInformation = {}));
3934 var SignatureInformation;
3935 (function(SignatureInformation2) {
3936 function create(label, documentation) {
3937 var parameters = [];
3938 for (var _i = 2; _i < arguments.length; _i++) {
3939 parameters[_i - 2] = arguments[_i];
3941 var result = {label};
3942 if (Is.defined(documentation)) {
3943 result.documentation = documentation;
3945 if (Is.defined(parameters)) {
3946 result.parameters = parameters;
3948 result.parameters = [];
3952 SignatureInformation2.create = create;
3953 })(SignatureInformation || (SignatureInformation = {}));
3954 var DocumentHighlightKind;
3955 (function(DocumentHighlightKind2) {
3956 DocumentHighlightKind2.Text = 1;
3957 DocumentHighlightKind2.Read = 2;
3958 DocumentHighlightKind2.Write = 3;
3959 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
3960 var DocumentHighlight;
3961 (function(DocumentHighlight2) {
3962 function create(range, kind) {
3963 var result = {range};
3964 if (Is.number(kind)) {
3969 DocumentHighlight2.create = create;
3970 })(DocumentHighlight || (DocumentHighlight = {}));
3972 (function(SymbolKind2) {
3973 SymbolKind2.File = 1;
3974 SymbolKind2.Module = 2;
3975 SymbolKind2.Namespace = 3;
3976 SymbolKind2.Package = 4;
3977 SymbolKind2.Class = 5;
3978 SymbolKind2.Method = 6;
3979 SymbolKind2.Property = 7;
3980 SymbolKind2.Field = 8;
3981 SymbolKind2.Constructor = 9;
3982 SymbolKind2.Enum = 10;
3983 SymbolKind2.Interface = 11;
3984 SymbolKind2.Function = 12;
3985 SymbolKind2.Variable = 13;
3986 SymbolKind2.Constant = 14;
3987 SymbolKind2.String = 15;
3988 SymbolKind2.Number = 16;
3989 SymbolKind2.Boolean = 17;
3990 SymbolKind2.Array = 18;
3991 SymbolKind2.Object = 19;
3992 SymbolKind2.Key = 20;
3993 SymbolKind2.Null = 21;
3994 SymbolKind2.EnumMember = 22;
3995 SymbolKind2.Struct = 23;
3996 SymbolKind2.Event = 24;
3997 SymbolKind2.Operator = 25;
3998 SymbolKind2.TypeParameter = 26;
3999 })(SymbolKind || (SymbolKind = {}));
4001 (function(SymbolTag2) {
4002 SymbolTag2.Deprecated = 1;
4003 })(SymbolTag || (SymbolTag = {}));
4004 var SymbolInformation;
4005 (function(SymbolInformation2) {
4006 function create(name, kind, range, uri, containerName) {
4010 location: {uri, range}
4012 if (containerName) {
4013 result.containerName = containerName;
4017 SymbolInformation2.create = create;
4018 })(SymbolInformation || (SymbolInformation = {}));
4020 (function(DocumentSymbol2) {
4021 function create(name, detail, kind, range, selectionRange, children) {
4029 if (children !== void 0) {
4030 result.children = children;
4034 DocumentSymbol2.create = create;
4035 function is(value) {
4036 var candidate = value;
4037 return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
4039 DocumentSymbol2.is = is;
4040 })(DocumentSymbol || (DocumentSymbol = {}));
4042 (function(CodeActionKind2) {
4043 CodeActionKind2.Empty = "";
4044 CodeActionKind2.QuickFix = "quickfix";
4045 CodeActionKind2.Refactor = "refactor";
4046 CodeActionKind2.RefactorExtract = "refactor.extract";
4047 CodeActionKind2.RefactorInline = "refactor.inline";
4048 CodeActionKind2.RefactorRewrite = "refactor.rewrite";
4049 CodeActionKind2.Source = "source";
4050 CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
4051 CodeActionKind2.SourceFixAll = "source.fixAll";
4052 })(CodeActionKind || (CodeActionKind = {}));
4053 var CodeActionContext;
4054 (function(CodeActionContext2) {
4055 function create(diagnostics, only) {
4056 var result = {diagnostics};
4057 if (only !== void 0 && only !== null) {
4062 CodeActionContext2.create = create;
4063 function is(value) {
4064 var candidate = value;
4065 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
4067 CodeActionContext2.is = is;
4068 })(CodeActionContext || (CodeActionContext = {}));
4070 (function(CodeAction2) {
4071 function create(title, kindOrCommandOrEdit, kind) {
4072 var result = {title};
4073 var checkKind = true;
4074 if (typeof kindOrCommandOrEdit === "string") {
4076 result.kind = kindOrCommandOrEdit;
4077 } else if (Command.is(kindOrCommandOrEdit)) {
4078 result.command = kindOrCommandOrEdit;
4080 result.edit = kindOrCommandOrEdit;
4082 if (checkKind && kind !== void 0) {
4087 CodeAction2.create = create;
4088 function is(value) {
4089 var candidate = value;
4090 return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4092 CodeAction2.is = is;
4093 })(CodeAction || (CodeAction = {}));
4095 (function(CodeLens2) {
4096 function create(range, data) {
4097 var result = {range};
4098 if (Is.defined(data)) {
4103 CodeLens2.create = create;
4104 function is(value) {
4105 var candidate = value;
4106 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4109 })(CodeLens || (CodeLens = {}));
4110 var FormattingOptions;
4111 (function(FormattingOptions2) {
4112 function create(tabSize, insertSpaces) {
4113 return {tabSize, insertSpaces};
4115 FormattingOptions2.create = create;
4116 function is(value) {
4117 var candidate = value;
4118 return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
4120 FormattingOptions2.is = is;
4121 })(FormattingOptions || (FormattingOptions = {}));
4123 (function(DocumentLink2) {
4124 function create(range, target, data) {
4125 return {range, target, data};
4127 DocumentLink2.create = create;
4128 function is(value) {
4129 var candidate = value;
4130 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
4132 DocumentLink2.is = is;
4133 })(DocumentLink || (DocumentLink = {}));
4135 (function(SelectionRange2) {
4136 function create(range, parent) {
4137 return {range, parent};
4139 SelectionRange2.create = create;
4140 function is(value) {
4141 var candidate = value;
4142 return candidate !== void 0 && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
4144 SelectionRange2.is = is;
4145 })(SelectionRange || (SelectionRange = {}));
4146 var EOL = ["\n", "\r\n", "\r"];
4148 (function(TextDocument3) {
4149 function create(uri, languageId, version, content) {
4150 return new FullTextDocument2(uri, languageId, version, content);
4152 TextDocument3.create = create;
4153 function is(value) {
4154 var candidate = value;
4155 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
4157 TextDocument3.is = is;
4158 function applyEdits(document, edits) {
4159 var text = document.getText();
4160 var sortedEdits = mergeSort2(edits, function(a, b) {
4161 var diff = a.range.start.line - b.range.start.line;
4163 return a.range.start.character - b.range.start.character;
4167 var lastModifiedOffset = text.length;
4168 for (var i = sortedEdits.length - 1; i >= 0; i--) {
4169 var e = sortedEdits[i];
4170 var startOffset = document.offsetAt(e.range.start);
4171 var endOffset = document.offsetAt(e.range.end);
4172 if (endOffset <= lastModifiedOffset) {
4173 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
4175 throw new Error("Overlapping edit");
4177 lastModifiedOffset = startOffset;
4181 TextDocument3.applyEdits = applyEdits;
4182 function mergeSort2(data, compare) {
4183 if (data.length <= 1) {
4186 var p = data.length / 2 | 0;
4187 var left = data.slice(0, p);
4188 var right = data.slice(p);
4189 mergeSort2(left, compare);
4190 mergeSort2(right, compare);
4194 while (leftIdx < left.length && rightIdx < right.length) {
4195 var ret = compare(left[leftIdx], right[rightIdx]);
4197 data[i++] = left[leftIdx++];
4199 data[i++] = right[rightIdx++];
4202 while (leftIdx < left.length) {
4203 data[i++] = left[leftIdx++];
4205 while (rightIdx < right.length) {
4206 data[i++] = right[rightIdx++];
4210 })(TextDocument2 || (TextDocument2 = {}));
4211 var FullTextDocument2 = function() {
4212 function FullTextDocument3(uri, languageId, version, content) {
4214 this._languageId = languageId;
4215 this._version = version;
4216 this._content = content;
4217 this._lineOffsets = void 0;
4219 Object.defineProperty(FullTextDocument3.prototype, "uri", {
4226 Object.defineProperty(FullTextDocument3.prototype, "languageId", {
4228 return this._languageId;
4233 Object.defineProperty(FullTextDocument3.prototype, "version", {
4235 return this._version;
4240 FullTextDocument3.prototype.getText = function(range) {
4242 var start = this.offsetAt(range.start);
4243 var end = this.offsetAt(range.end);
4244 return this._content.substring(start, end);
4246 return this._content;
4248 FullTextDocument3.prototype.update = function(event, version) {
4249 this._content = event.text;
4250 this._version = version;
4251 this._lineOffsets = void 0;
4253 FullTextDocument3.prototype.getLineOffsets = function() {
4254 if (this._lineOffsets === void 0) {
4255 var lineOffsets = [];
4256 var text = this._content;
4257 var isLineStart = true;
4258 for (var i = 0; i < text.length; i++) {
4260 lineOffsets.push(i);
4261 isLineStart = false;
4263 var ch = text.charAt(i);
4264 isLineStart = ch === "\r" || ch === "\n";
4265 if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
4269 if (isLineStart && text.length > 0) {
4270 lineOffsets.push(text.length);
4272 this._lineOffsets = lineOffsets;
4274 return this._lineOffsets;
4276 FullTextDocument3.prototype.positionAt = function(offset) {
4277 offset = Math.max(Math.min(offset, this._content.length), 0);
4278 var lineOffsets = this.getLineOffsets();
4279 var low = 0, high = lineOffsets.length;
4281 return Position.create(0, offset);
4283 while (low < high) {
4284 var mid = Math.floor((low + high) / 2);
4285 if (lineOffsets[mid] > offset) {
4292 return Position.create(line, offset - lineOffsets[line]);
4294 FullTextDocument3.prototype.offsetAt = function(position) {
4295 var lineOffsets = this.getLineOffsets();
4296 if (position.line >= lineOffsets.length) {
4297 return this._content.length;
4298 } else if (position.line < 0) {
4301 var lineOffset = lineOffsets[position.line];
4302 var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
4303 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
4305 Object.defineProperty(FullTextDocument3.prototype, "lineCount", {
4307 return this.getLineOffsets().length;
4312 return FullTextDocument3;
4316 var toString = Object.prototype.toString;
4317 function defined(value) {
4318 return typeof value !== "undefined";
4320 Is2.defined = defined;
4321 function undefined2(value) {
4322 return typeof value === "undefined";
4324 Is2.undefined = undefined2;
4325 function boolean(value) {
4326 return value === true || value === false;
4328 Is2.boolean = boolean;
4329 function string(value) {
4330 return toString.call(value) === "[object String]";
4332 Is2.string = string;
4333 function number(value) {
4334 return toString.call(value) === "[object Number]";
4336 Is2.number = number;
4337 function numberRange(value, min, max) {
4338 return toString.call(value) === "[object Number]" && min <= value && value <= max;
4340 Is2.numberRange = numberRange;
4341 function integer2(value) {
4342 return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
4344 Is2.integer = integer2;
4345 function uinteger2(value) {
4346 return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
4348 Is2.uinteger = uinteger2;
4349 function func(value) {
4350 return toString.call(value) === "[object Function]";
4353 function objectLiteral(value) {
4354 return value !== null && typeof value === "object";
4356 Is2.objectLiteral = objectLiteral;
4357 function typedArray(value, check) {
4358 return Array.isArray(value) && value.every(check);
4360 Is2.typedArray = typedArray;
4361 })(Is || (Is = {}));
4364 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/messages.js
4365 var require_messages2 = __commonJS((exports2) => {
4367 Object.defineProperty(exports2, "__esModule", {value: true});
4368 exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = void 0;
4369 var vscode_jsonrpc_1 = require_main();
4370 var RegistrationType = class {
4371 constructor(method) {
4372 this.method = method;
4375 exports2.RegistrationType = RegistrationType;
4376 var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 {
4377 constructor(method) {
4381 exports2.ProtocolRequestType0 = ProtocolRequestType0;
4382 var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
4383 constructor(method) {
4384 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4387 exports2.ProtocolRequestType = ProtocolRequestType;
4388 var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
4389 constructor(method) {
4393 exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
4394 var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
4395 constructor(method) {
4396 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4399 exports2.ProtocolNotificationType = ProtocolNotificationType;
4402 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js
4403 var require_is3 = __commonJS((exports2) => {
4405 Object.defineProperty(exports2, "__esModule", {value: true});
4406 exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
4407 function boolean(value) {
4408 return value === true || value === false;
4410 exports2.boolean = boolean;
4411 function string(value) {
4412 return typeof value === "string" || value instanceof String;
4414 exports2.string = string;
4415 function number(value) {
4416 return typeof value === "number" || value instanceof Number;
4418 exports2.number = number;
4419 function error(value) {
4420 return value instanceof Error;
4422 exports2.error = error;
4423 function func(value) {
4424 return typeof value === "function";
4426 exports2.func = func;
4427 function array(value) {
4428 return Array.isArray(value);
4430 exports2.array = array;
4431 function stringArray(value) {
4432 return array(value) && value.every((elem) => string(elem));
4434 exports2.stringArray = stringArray;
4435 function typedArray(value, check) {
4436 return Array.isArray(value) && value.every(check);
4438 exports2.typedArray = typedArray;
4439 function objectLiteral(value) {
4440 return value !== null && typeof value === "object";
4442 exports2.objectLiteral = objectLiteral;
4445 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js
4446 var require_protocol_implementation = __commonJS((exports2) => {
4448 Object.defineProperty(exports2, "__esModule", {value: true});
4449 exports2.ImplementationRequest = void 0;
4450 var messages_1 = require_messages2();
4451 var ImplementationRequest;
4452 (function(ImplementationRequest2) {
4453 ImplementationRequest2.method = "textDocument/implementation";
4454 ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method);
4455 })(ImplementationRequest = exports2.ImplementationRequest || (exports2.ImplementationRequest = {}));
4458 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js
4459 var require_protocol_typeDefinition = __commonJS((exports2) => {
4461 Object.defineProperty(exports2, "__esModule", {value: true});
4462 exports2.TypeDefinitionRequest = void 0;
4463 var messages_1 = require_messages2();
4464 var TypeDefinitionRequest;
4465 (function(TypeDefinitionRequest2) {
4466 TypeDefinitionRequest2.method = "textDocument/typeDefinition";
4467 TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method);
4468 })(TypeDefinitionRequest = exports2.TypeDefinitionRequest || (exports2.TypeDefinitionRequest = {}));
4471 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js
4472 var require_protocol_workspaceFolders = __commonJS((exports2) => {
4474 Object.defineProperty(exports2, "__esModule", {value: true});
4475 exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0;
4476 var messages_1 = require_messages2();
4477 var WorkspaceFoldersRequest;
4478 (function(WorkspaceFoldersRequest2) {
4479 WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0("workspace/workspaceFolders");
4480 })(WorkspaceFoldersRequest = exports2.WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = {}));
4481 var DidChangeWorkspaceFoldersNotification;
4482 (function(DidChangeWorkspaceFoldersNotification2) {
4483 DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWorkspaceFolders");
4484 })(DidChangeWorkspaceFoldersNotification = exports2.DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = {}));
4487 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js
4488 var require_protocol_configuration = __commonJS((exports2) => {
4490 Object.defineProperty(exports2, "__esModule", {value: true});
4491 exports2.ConfigurationRequest = void 0;
4492 var messages_1 = require_messages2();
4493 var ConfigurationRequest;
4494 (function(ConfigurationRequest2) {
4495 ConfigurationRequest2.type = new messages_1.ProtocolRequestType("workspace/configuration");
4496 })(ConfigurationRequest = exports2.ConfigurationRequest || (exports2.ConfigurationRequest = {}));
4499 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js
4500 var require_protocol_colorProvider = __commonJS((exports2) => {
4502 Object.defineProperty(exports2, "__esModule", {value: true});
4503 exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0;
4504 var messages_1 = require_messages2();
4505 var DocumentColorRequest;
4506 (function(DocumentColorRequest2) {
4507 DocumentColorRequest2.method = "textDocument/documentColor";
4508 DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method);
4509 })(DocumentColorRequest = exports2.DocumentColorRequest || (exports2.DocumentColorRequest = {}));
4510 var ColorPresentationRequest;
4511 (function(ColorPresentationRequest2) {
4512 ColorPresentationRequest2.type = new messages_1.ProtocolRequestType("textDocument/colorPresentation");
4513 })(ColorPresentationRequest = exports2.ColorPresentationRequest || (exports2.ColorPresentationRequest = {}));
4516 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js
4517 var require_protocol_foldingRange = __commonJS((exports2) => {
4519 Object.defineProperty(exports2, "__esModule", {value: true});
4520 exports2.FoldingRangeRequest = exports2.FoldingRangeKind = void 0;
4521 var messages_1 = require_messages2();
4522 var FoldingRangeKind;
4523 (function(FoldingRangeKind2) {
4524 FoldingRangeKind2["Comment"] = "comment";
4525 FoldingRangeKind2["Imports"] = "imports";
4526 FoldingRangeKind2["Region"] = "region";
4527 })(FoldingRangeKind = exports2.FoldingRangeKind || (exports2.FoldingRangeKind = {}));
4528 var FoldingRangeRequest;
4529 (function(FoldingRangeRequest2) {
4530 FoldingRangeRequest2.method = "textDocument/foldingRange";
4531 FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method);
4532 })(FoldingRangeRequest = exports2.FoldingRangeRequest || (exports2.FoldingRangeRequest = {}));
4535 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js
4536 var require_protocol_declaration = __commonJS((exports2) => {
4538 Object.defineProperty(exports2, "__esModule", {value: true});
4539 exports2.DeclarationRequest = void 0;
4540 var messages_1 = require_messages2();
4541 var DeclarationRequest;
4542 (function(DeclarationRequest2) {
4543 DeclarationRequest2.method = "textDocument/declaration";
4544 DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method);
4545 })(DeclarationRequest = exports2.DeclarationRequest || (exports2.DeclarationRequest = {}));
4548 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js
4549 var require_protocol_selectionRange = __commonJS((exports2) => {
4551 Object.defineProperty(exports2, "__esModule", {value: true});
4552 exports2.SelectionRangeRequest = void 0;
4553 var messages_1 = require_messages2();
4554 var SelectionRangeRequest;
4555 (function(SelectionRangeRequest2) {
4556 SelectionRangeRequest2.method = "textDocument/selectionRange";
4557 SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method);
4558 })(SelectionRangeRequest = exports2.SelectionRangeRequest || (exports2.SelectionRangeRequest = {}));
4561 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js
4562 var require_protocol_progress = __commonJS((exports2) => {
4564 Object.defineProperty(exports2, "__esModule", {value: true});
4565 exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0;
4566 var vscode_jsonrpc_1 = require_main();
4567 var messages_1 = require_messages2();
4568 var WorkDoneProgress;
4569 (function(WorkDoneProgress2) {
4570 WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType();
4571 function is(value) {
4572 return value === WorkDoneProgress2.type;
4574 WorkDoneProgress2.is = is;
4575 })(WorkDoneProgress = exports2.WorkDoneProgress || (exports2.WorkDoneProgress = {}));
4576 var WorkDoneProgressCreateRequest;
4577 (function(WorkDoneProgressCreateRequest2) {
4578 WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType("window/workDoneProgress/create");
4579 })(WorkDoneProgressCreateRequest = exports2.WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = {}));
4580 var WorkDoneProgressCancelNotification;
4581 (function(WorkDoneProgressCancelNotification2) {
4582 WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType("window/workDoneProgress/cancel");
4583 })(WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = {}));
4586 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js
4587 var require_protocol_callHierarchy = __commonJS((exports2) => {
4589 Object.defineProperty(exports2, "__esModule", {value: true});
4590 exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0;
4591 var messages_1 = require_messages2();
4592 var CallHierarchyPrepareRequest;
4593 (function(CallHierarchyPrepareRequest2) {
4594 CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy";
4595 CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method);
4596 })(CallHierarchyPrepareRequest = exports2.CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = {}));
4597 var CallHierarchyIncomingCallsRequest;
4598 (function(CallHierarchyIncomingCallsRequest2) {
4599 CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls";
4600 CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method);
4601 })(CallHierarchyIncomingCallsRequest = exports2.CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = {}));
4602 var CallHierarchyOutgoingCallsRequest;
4603 (function(CallHierarchyOutgoingCallsRequest2) {
4604 CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls";
4605 CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method);
4606 })(CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = {}));
4609 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js
4610 var require_protocol_semanticTokens = __commonJS((exports2) => {
4612 Object.defineProperty(exports2, "__esModule", {value: true});
4613 exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = void 0;
4614 var messages_1 = require_messages2();
4615 var SemanticTokenTypes;
4616 (function(SemanticTokenTypes2) {
4617 SemanticTokenTypes2["namespace"] = "namespace";
4618 SemanticTokenTypes2["type"] = "type";
4619 SemanticTokenTypes2["class"] = "class";
4620 SemanticTokenTypes2["enum"] = "enum";
4621 SemanticTokenTypes2["interface"] = "interface";
4622 SemanticTokenTypes2["struct"] = "struct";
4623 SemanticTokenTypes2["typeParameter"] = "typeParameter";
4624 SemanticTokenTypes2["parameter"] = "parameter";
4625 SemanticTokenTypes2["variable"] = "variable";
4626 SemanticTokenTypes2["property"] = "property";
4627 SemanticTokenTypes2["enumMember"] = "enumMember";
4628 SemanticTokenTypes2["event"] = "event";
4629 SemanticTokenTypes2["function"] = "function";
4630 SemanticTokenTypes2["method"] = "method";
4631 SemanticTokenTypes2["macro"] = "macro";
4632 SemanticTokenTypes2["keyword"] = "keyword";
4633 SemanticTokenTypes2["modifier"] = "modifier";
4634 SemanticTokenTypes2["comment"] = "comment";
4635 SemanticTokenTypes2["string"] = "string";
4636 SemanticTokenTypes2["number"] = "number";
4637 SemanticTokenTypes2["regexp"] = "regexp";
4638 SemanticTokenTypes2["operator"] = "operator";
4639 })(SemanticTokenTypes = exports2.SemanticTokenTypes || (exports2.SemanticTokenTypes = {}));
4640 var SemanticTokenModifiers;
4641 (function(SemanticTokenModifiers2) {
4642 SemanticTokenModifiers2["declaration"] = "declaration";
4643 SemanticTokenModifiers2["definition"] = "definition";
4644 SemanticTokenModifiers2["readonly"] = "readonly";
4645 SemanticTokenModifiers2["static"] = "static";
4646 SemanticTokenModifiers2["deprecated"] = "deprecated";
4647 SemanticTokenModifiers2["abstract"] = "abstract";
4648 SemanticTokenModifiers2["async"] = "async";
4649 SemanticTokenModifiers2["modification"] = "modification";
4650 SemanticTokenModifiers2["documentation"] = "documentation";
4651 SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
4652 })(SemanticTokenModifiers = exports2.SemanticTokenModifiers || (exports2.SemanticTokenModifiers = {}));
4654 (function(SemanticTokens2) {
4655 function is(value) {
4656 const candidate = value;
4657 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");
4659 SemanticTokens2.is = is;
4660 })(SemanticTokens = exports2.SemanticTokens || (exports2.SemanticTokens = {}));
4662 (function(TokenFormat2) {
4663 TokenFormat2.Relative = "relative";
4664 })(TokenFormat = exports2.TokenFormat || (exports2.TokenFormat = {}));
4665 var SemanticTokensRegistrationType;
4666 (function(SemanticTokensRegistrationType2) {
4667 SemanticTokensRegistrationType2.method = "textDocument/semanticTokens";
4668 SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method);
4669 })(SemanticTokensRegistrationType = exports2.SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = {}));
4670 var SemanticTokensRequest;
4671 (function(SemanticTokensRequest2) {
4672 SemanticTokensRequest2.method = "textDocument/semanticTokens/full";
4673 SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method);
4674 })(SemanticTokensRequest = exports2.SemanticTokensRequest || (exports2.SemanticTokensRequest = {}));
4675 var SemanticTokensDeltaRequest;
4676 (function(SemanticTokensDeltaRequest2) {
4677 SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta";
4678 SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method);
4679 })(SemanticTokensDeltaRequest = exports2.SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = {}));
4680 var SemanticTokensRangeRequest;
4681 (function(SemanticTokensRangeRequest2) {
4682 SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range";
4683 SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method);
4684 })(SemanticTokensRangeRequest = exports2.SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = {}));
4685 var SemanticTokensRefreshRequest;
4686 (function(SemanticTokensRefreshRequest2) {
4687 SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`;
4688 SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method);
4689 })(SemanticTokensRefreshRequest = exports2.SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = {}));
4692 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js
4693 var require_protocol_showDocument = __commonJS((exports2) => {
4695 Object.defineProperty(exports2, "__esModule", {value: true});
4696 exports2.ShowDocumentRequest = void 0;
4697 var messages_1 = require_messages2();
4698 var ShowDocumentRequest;
4699 (function(ShowDocumentRequest2) {
4700 ShowDocumentRequest2.method = "window/showDocument";
4701 ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method);
4702 })(ShowDocumentRequest = exports2.ShowDocumentRequest || (exports2.ShowDocumentRequest = {}));
4705 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js
4706 var require_protocol_linkedEditingRange = __commonJS((exports2) => {
4708 Object.defineProperty(exports2, "__esModule", {value: true});
4709 exports2.LinkedEditingRangeRequest = void 0;
4710 var messages_1 = require_messages2();
4711 var LinkedEditingRangeRequest;
4712 (function(LinkedEditingRangeRequest2) {
4713 LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange";
4714 LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method);
4715 })(LinkedEditingRangeRequest = exports2.LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = {}));
4718 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js
4719 var require_protocol_fileOperations = __commonJS((exports2) => {
4721 Object.defineProperty(exports2, "__esModule", {value: true});
4722 exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0;
4723 var messages_1 = require_messages2();
4724 var FileOperationPatternKind;
4725 (function(FileOperationPatternKind2) {
4726 FileOperationPatternKind2.file = "file";
4727 FileOperationPatternKind2.folder = "folder";
4728 })(FileOperationPatternKind = exports2.FileOperationPatternKind || (exports2.FileOperationPatternKind = {}));
4729 var WillCreateFilesRequest;
4730 (function(WillCreateFilesRequest2) {
4731 WillCreateFilesRequest2.method = "workspace/willCreateFiles";
4732 WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method);
4733 })(WillCreateFilesRequest = exports2.WillCreateFilesRequest || (exports2.WillCreateFilesRequest = {}));
4734 var DidCreateFilesNotification;
4735 (function(DidCreateFilesNotification2) {
4736 DidCreateFilesNotification2.method = "workspace/didCreateFiles";
4737 DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method);
4738 })(DidCreateFilesNotification = exports2.DidCreateFilesNotification || (exports2.DidCreateFilesNotification = {}));
4739 var WillRenameFilesRequest;
4740 (function(WillRenameFilesRequest2) {
4741 WillRenameFilesRequest2.method = "workspace/willRenameFiles";
4742 WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method);
4743 })(WillRenameFilesRequest = exports2.WillRenameFilesRequest || (exports2.WillRenameFilesRequest = {}));
4744 var DidRenameFilesNotification;
4745 (function(DidRenameFilesNotification2) {
4746 DidRenameFilesNotification2.method = "workspace/didRenameFiles";
4747 DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method);
4748 })(DidRenameFilesNotification = exports2.DidRenameFilesNotification || (exports2.DidRenameFilesNotification = {}));
4749 var DidDeleteFilesNotification;
4750 (function(DidDeleteFilesNotification2) {
4751 DidDeleteFilesNotification2.method = "workspace/didDeleteFiles";
4752 DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method);
4753 })(DidDeleteFilesNotification = exports2.DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = {}));
4754 var WillDeleteFilesRequest;
4755 (function(WillDeleteFilesRequest2) {
4756 WillDeleteFilesRequest2.method = "workspace/willDeleteFiles";
4757 WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method);
4758 })(WillDeleteFilesRequest = exports2.WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = {}));
4761 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js
4762 var require_protocol_moniker = __commonJS((exports2) => {
4764 Object.defineProperty(exports2, "__esModule", {value: true});
4765 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0;
4766 var messages_1 = require_messages2();
4767 var UniquenessLevel;
4768 (function(UniquenessLevel2) {
4769 UniquenessLevel2["document"] = "document";
4770 UniquenessLevel2["project"] = "project";
4771 UniquenessLevel2["group"] = "group";
4772 UniquenessLevel2["scheme"] = "scheme";
4773 UniquenessLevel2["global"] = "global";
4774 })(UniquenessLevel = exports2.UniquenessLevel || (exports2.UniquenessLevel = {}));
4776 (function(MonikerKind2) {
4777 MonikerKind2["import"] = "import";
4778 MonikerKind2["export"] = "export";
4779 MonikerKind2["local"] = "local";
4780 })(MonikerKind = exports2.MonikerKind || (exports2.MonikerKind = {}));
4782 (function(MonikerRequest2) {
4783 MonikerRequest2.method = "textDocument/moniker";
4784 MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method);
4785 })(MonikerRequest = exports2.MonikerRequest || (exports2.MonikerRequest = {}));
4788 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/protocol.js
4789 var require_protocol = __commonJS((exports2) => {
4791 Object.defineProperty(exports2, "__esModule", {value: true});
4792 exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeError = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.DocumentFilter = void 0;
4793 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = void 0;
4794 var Is = require_is3();
4795 var messages_1 = require_messages2();
4796 var protocol_implementation_1 = require_protocol_implementation();
4797 Object.defineProperty(exports2, "ImplementationRequest", {enumerable: true, get: function() {
4798 return protocol_implementation_1.ImplementationRequest;
4800 var protocol_typeDefinition_1 = require_protocol_typeDefinition();
4801 Object.defineProperty(exports2, "TypeDefinitionRequest", {enumerable: true, get: function() {
4802 return protocol_typeDefinition_1.TypeDefinitionRequest;
4804 var protocol_workspaceFolders_1 = require_protocol_workspaceFolders();
4805 Object.defineProperty(exports2, "WorkspaceFoldersRequest", {enumerable: true, get: function() {
4806 return protocol_workspaceFolders_1.WorkspaceFoldersRequest;
4808 Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", {enumerable: true, get: function() {
4809 return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
4811 var protocol_configuration_1 = require_protocol_configuration();
4812 Object.defineProperty(exports2, "ConfigurationRequest", {enumerable: true, get: function() {
4813 return protocol_configuration_1.ConfigurationRequest;
4815 var protocol_colorProvider_1 = require_protocol_colorProvider();
4816 Object.defineProperty(exports2, "DocumentColorRequest", {enumerable: true, get: function() {
4817 return protocol_colorProvider_1.DocumentColorRequest;
4819 Object.defineProperty(exports2, "ColorPresentationRequest", {enumerable: true, get: function() {
4820 return protocol_colorProvider_1.ColorPresentationRequest;
4822 var protocol_foldingRange_1 = require_protocol_foldingRange();
4823 Object.defineProperty(exports2, "FoldingRangeRequest", {enumerable: true, get: function() {
4824 return protocol_foldingRange_1.FoldingRangeRequest;
4826 var protocol_declaration_1 = require_protocol_declaration();
4827 Object.defineProperty(exports2, "DeclarationRequest", {enumerable: true, get: function() {
4828 return protocol_declaration_1.DeclarationRequest;
4830 var protocol_selectionRange_1 = require_protocol_selectionRange();
4831 Object.defineProperty(exports2, "SelectionRangeRequest", {enumerable: true, get: function() {
4832 return protocol_selectionRange_1.SelectionRangeRequest;
4834 var protocol_progress_1 = require_protocol_progress();
4835 Object.defineProperty(exports2, "WorkDoneProgress", {enumerable: true, get: function() {
4836 return protocol_progress_1.WorkDoneProgress;
4838 Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", {enumerable: true, get: function() {
4839 return protocol_progress_1.WorkDoneProgressCreateRequest;
4841 Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", {enumerable: true, get: function() {
4842 return protocol_progress_1.WorkDoneProgressCancelNotification;
4844 var protocol_callHierarchy_1 = require_protocol_callHierarchy();
4845 Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", {enumerable: true, get: function() {
4846 return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
4848 Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", {enumerable: true, get: function() {
4849 return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
4851 Object.defineProperty(exports2, "CallHierarchyPrepareRequest", {enumerable: true, get: function() {
4852 return protocol_callHierarchy_1.CallHierarchyPrepareRequest;
4854 var protocol_semanticTokens_1 = require_protocol_semanticTokens();
4855 Object.defineProperty(exports2, "SemanticTokenTypes", {enumerable: true, get: function() {
4856 return protocol_semanticTokens_1.SemanticTokenTypes;
4858 Object.defineProperty(exports2, "SemanticTokenModifiers", {enumerable: true, get: function() {
4859 return protocol_semanticTokens_1.SemanticTokenModifiers;
4861 Object.defineProperty(exports2, "SemanticTokens", {enumerable: true, get: function() {
4862 return protocol_semanticTokens_1.SemanticTokens;
4864 Object.defineProperty(exports2, "TokenFormat", {enumerable: true, get: function() {
4865 return protocol_semanticTokens_1.TokenFormat;
4867 Object.defineProperty(exports2, "SemanticTokensRequest", {enumerable: true, get: function() {
4868 return protocol_semanticTokens_1.SemanticTokensRequest;
4870 Object.defineProperty(exports2, "SemanticTokensDeltaRequest", {enumerable: true, get: function() {
4871 return protocol_semanticTokens_1.SemanticTokensDeltaRequest;
4873 Object.defineProperty(exports2, "SemanticTokensRangeRequest", {enumerable: true, get: function() {
4874 return protocol_semanticTokens_1.SemanticTokensRangeRequest;
4876 Object.defineProperty(exports2, "SemanticTokensRefreshRequest", {enumerable: true, get: function() {
4877 return protocol_semanticTokens_1.SemanticTokensRefreshRequest;
4879 Object.defineProperty(exports2, "SemanticTokensRegistrationType", {enumerable: true, get: function() {
4880 return protocol_semanticTokens_1.SemanticTokensRegistrationType;
4882 var protocol_showDocument_1 = require_protocol_showDocument();
4883 Object.defineProperty(exports2, "ShowDocumentRequest", {enumerable: true, get: function() {
4884 return protocol_showDocument_1.ShowDocumentRequest;
4886 var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange();
4887 Object.defineProperty(exports2, "LinkedEditingRangeRequest", {enumerable: true, get: function() {
4888 return protocol_linkedEditingRange_1.LinkedEditingRangeRequest;
4890 var protocol_fileOperations_1 = require_protocol_fileOperations();
4891 Object.defineProperty(exports2, "FileOperationPatternKind", {enumerable: true, get: function() {
4892 return protocol_fileOperations_1.FileOperationPatternKind;
4894 Object.defineProperty(exports2, "DidCreateFilesNotification", {enumerable: true, get: function() {
4895 return protocol_fileOperations_1.DidCreateFilesNotification;
4897 Object.defineProperty(exports2, "WillCreateFilesRequest", {enumerable: true, get: function() {
4898 return protocol_fileOperations_1.WillCreateFilesRequest;
4900 Object.defineProperty(exports2, "DidRenameFilesNotification", {enumerable: true, get: function() {
4901 return protocol_fileOperations_1.DidRenameFilesNotification;
4903 Object.defineProperty(exports2, "WillRenameFilesRequest", {enumerable: true, get: function() {
4904 return protocol_fileOperations_1.WillRenameFilesRequest;
4906 Object.defineProperty(exports2, "DidDeleteFilesNotification", {enumerable: true, get: function() {
4907 return protocol_fileOperations_1.DidDeleteFilesNotification;
4909 Object.defineProperty(exports2, "WillDeleteFilesRequest", {enumerable: true, get: function() {
4910 return protocol_fileOperations_1.WillDeleteFilesRequest;
4912 var protocol_moniker_1 = require_protocol_moniker();
4913 Object.defineProperty(exports2, "UniquenessLevel", {enumerable: true, get: function() {
4914 return protocol_moniker_1.UniquenessLevel;
4916 Object.defineProperty(exports2, "MonikerKind", {enumerable: true, get: function() {
4917 return protocol_moniker_1.MonikerKind;
4919 Object.defineProperty(exports2, "MonikerRequest", {enumerable: true, get: function() {
4920 return protocol_moniker_1.MonikerRequest;
4923 (function(DocumentFilter2) {
4924 function is(value) {
4925 const candidate = value;
4926 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
4928 DocumentFilter2.is = is;
4929 })(DocumentFilter = exports2.DocumentFilter || (exports2.DocumentFilter = {}));
4930 var DocumentSelector;
4931 (function(DocumentSelector2) {
4932 function is(value) {
4933 if (!Array.isArray(value)) {
4936 for (let elem of value) {
4937 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
4943 DocumentSelector2.is = is;
4944 })(DocumentSelector = exports2.DocumentSelector || (exports2.DocumentSelector = {}));
4945 var RegistrationRequest;
4946 (function(RegistrationRequest2) {
4947 RegistrationRequest2.type = new messages_1.ProtocolRequestType("client/registerCapability");
4948 })(RegistrationRequest = exports2.RegistrationRequest || (exports2.RegistrationRequest = {}));
4949 var UnregistrationRequest;
4950 (function(UnregistrationRequest2) {
4951 UnregistrationRequest2.type = new messages_1.ProtocolRequestType("client/unregisterCapability");
4952 })(UnregistrationRequest = exports2.UnregistrationRequest || (exports2.UnregistrationRequest = {}));
4953 var ResourceOperationKind;
4954 (function(ResourceOperationKind2) {
4955 ResourceOperationKind2.Create = "create";
4956 ResourceOperationKind2.Rename = "rename";
4957 ResourceOperationKind2.Delete = "delete";
4958 })(ResourceOperationKind = exports2.ResourceOperationKind || (exports2.ResourceOperationKind = {}));
4959 var FailureHandlingKind;
4960 (function(FailureHandlingKind2) {
4961 FailureHandlingKind2.Abort = "abort";
4962 FailureHandlingKind2.Transactional = "transactional";
4963 FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional";
4964 FailureHandlingKind2.Undo = "undo";
4965 })(FailureHandlingKind = exports2.FailureHandlingKind || (exports2.FailureHandlingKind = {}));
4966 var StaticRegistrationOptions;
4967 (function(StaticRegistrationOptions2) {
4968 function hasId(value) {
4969 const candidate = value;
4970 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
4972 StaticRegistrationOptions2.hasId = hasId;
4973 })(StaticRegistrationOptions = exports2.StaticRegistrationOptions || (exports2.StaticRegistrationOptions = {}));
4974 var TextDocumentRegistrationOptions;
4975 (function(TextDocumentRegistrationOptions2) {
4976 function is(value) {
4977 const candidate = value;
4978 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
4980 TextDocumentRegistrationOptions2.is = is;
4981 })(TextDocumentRegistrationOptions = exports2.TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = {}));
4982 var WorkDoneProgressOptions;
4983 (function(WorkDoneProgressOptions2) {
4984 function is(value) {
4985 const candidate = value;
4986 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is.boolean(candidate.workDoneProgress));
4988 WorkDoneProgressOptions2.is = is;
4989 function hasWorkDoneProgress(value) {
4990 const candidate = value;
4991 return candidate && Is.boolean(candidate.workDoneProgress);
4993 WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress;
4994 })(WorkDoneProgressOptions = exports2.WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = {}));
4995 var InitializeRequest;
4996 (function(InitializeRequest2) {
4997 InitializeRequest2.type = new messages_1.ProtocolRequestType("initialize");
4998 })(InitializeRequest = exports2.InitializeRequest || (exports2.InitializeRequest = {}));
4999 var InitializeError;
5000 (function(InitializeError2) {
5001 InitializeError2.unknownProtocolVersion = 1;
5002 })(InitializeError = exports2.InitializeError || (exports2.InitializeError = {}));
5003 var InitializedNotification;
5004 (function(InitializedNotification2) {
5005 InitializedNotification2.type = new messages_1.ProtocolNotificationType("initialized");
5006 })(InitializedNotification = exports2.InitializedNotification || (exports2.InitializedNotification = {}));
5007 var ShutdownRequest;
5008 (function(ShutdownRequest2) {
5009 ShutdownRequest2.type = new messages_1.ProtocolRequestType0("shutdown");
5010 })(ShutdownRequest = exports2.ShutdownRequest || (exports2.ShutdownRequest = {}));
5011 var ExitNotification;
5012 (function(ExitNotification2) {
5013 ExitNotification2.type = new messages_1.ProtocolNotificationType0("exit");
5014 })(ExitNotification = exports2.ExitNotification || (exports2.ExitNotification = {}));
5015 var DidChangeConfigurationNotification;
5016 (function(DidChangeConfigurationNotification2) {
5017 DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeConfiguration");
5018 })(DidChangeConfigurationNotification = exports2.DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = {}));
5020 (function(MessageType2) {
5021 MessageType2.Error = 1;
5022 MessageType2.Warning = 2;
5023 MessageType2.Info = 3;
5024 MessageType2.Log = 4;
5025 })(MessageType = exports2.MessageType || (exports2.MessageType = {}));
5026 var ShowMessageNotification;
5027 (function(ShowMessageNotification2) {
5028 ShowMessageNotification2.type = new messages_1.ProtocolNotificationType("window/showMessage");
5029 })(ShowMessageNotification = exports2.ShowMessageNotification || (exports2.ShowMessageNotification = {}));
5030 var ShowMessageRequest;
5031 (function(ShowMessageRequest2) {
5032 ShowMessageRequest2.type = new messages_1.ProtocolRequestType("window/showMessageRequest");
5033 })(ShowMessageRequest = exports2.ShowMessageRequest || (exports2.ShowMessageRequest = {}));
5034 var LogMessageNotification;
5035 (function(LogMessageNotification2) {
5036 LogMessageNotification2.type = new messages_1.ProtocolNotificationType("window/logMessage");
5037 })(LogMessageNotification = exports2.LogMessageNotification || (exports2.LogMessageNotification = {}));
5038 var TelemetryEventNotification;
5039 (function(TelemetryEventNotification2) {
5040 TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType("telemetry/event");
5041 })(TelemetryEventNotification = exports2.TelemetryEventNotification || (exports2.TelemetryEventNotification = {}));
5042 var TextDocumentSyncKind;
5043 (function(TextDocumentSyncKind2) {
5044 TextDocumentSyncKind2.None = 0;
5045 TextDocumentSyncKind2.Full = 1;
5046 TextDocumentSyncKind2.Incremental = 2;
5047 })(TextDocumentSyncKind = exports2.TextDocumentSyncKind || (exports2.TextDocumentSyncKind = {}));
5048 var DidOpenTextDocumentNotification;
5049 (function(DidOpenTextDocumentNotification2) {
5050 DidOpenTextDocumentNotification2.method = "textDocument/didOpen";
5051 DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method);
5052 })(DidOpenTextDocumentNotification = exports2.DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = {}));
5053 var TextDocumentContentChangeEvent;
5054 (function(TextDocumentContentChangeEvent2) {
5055 function isIncremental(event) {
5056 let candidate = event;
5057 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
5059 TextDocumentContentChangeEvent2.isIncremental = isIncremental;
5060 function isFull(event) {
5061 let candidate = event;
5062 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
5064 TextDocumentContentChangeEvent2.isFull = isFull;
5065 })(TextDocumentContentChangeEvent = exports2.TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = {}));
5066 var DidChangeTextDocumentNotification;
5067 (function(DidChangeTextDocumentNotification2) {
5068 DidChangeTextDocumentNotification2.method = "textDocument/didChange";
5069 DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method);
5070 })(DidChangeTextDocumentNotification = exports2.DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = {}));
5071 var DidCloseTextDocumentNotification;
5072 (function(DidCloseTextDocumentNotification2) {
5073 DidCloseTextDocumentNotification2.method = "textDocument/didClose";
5074 DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method);
5075 })(DidCloseTextDocumentNotification = exports2.DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = {}));
5076 var DidSaveTextDocumentNotification;
5077 (function(DidSaveTextDocumentNotification2) {
5078 DidSaveTextDocumentNotification2.method = "textDocument/didSave";
5079 DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method);
5080 })(DidSaveTextDocumentNotification = exports2.DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = {}));
5081 var TextDocumentSaveReason;
5082 (function(TextDocumentSaveReason2) {
5083 TextDocumentSaveReason2.Manual = 1;
5084 TextDocumentSaveReason2.AfterDelay = 2;
5085 TextDocumentSaveReason2.FocusOut = 3;
5086 })(TextDocumentSaveReason = exports2.TextDocumentSaveReason || (exports2.TextDocumentSaveReason = {}));
5087 var WillSaveTextDocumentNotification;
5088 (function(WillSaveTextDocumentNotification2) {
5089 WillSaveTextDocumentNotification2.method = "textDocument/willSave";
5090 WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method);
5091 })(WillSaveTextDocumentNotification = exports2.WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = {}));
5092 var WillSaveTextDocumentWaitUntilRequest;
5093 (function(WillSaveTextDocumentWaitUntilRequest2) {
5094 WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil";
5095 WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method);
5096 })(WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = {}));
5097 var DidChangeWatchedFilesNotification;
5098 (function(DidChangeWatchedFilesNotification2) {
5099 DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWatchedFiles");
5100 })(DidChangeWatchedFilesNotification = exports2.DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = {}));
5102 (function(FileChangeType2) {
5103 FileChangeType2.Created = 1;
5104 FileChangeType2.Changed = 2;
5105 FileChangeType2.Deleted = 3;
5106 })(FileChangeType = exports2.FileChangeType || (exports2.FileChangeType = {}));
5108 (function(WatchKind2) {
5109 WatchKind2.Create = 1;
5110 WatchKind2.Change = 2;
5111 WatchKind2.Delete = 4;
5112 })(WatchKind = exports2.WatchKind || (exports2.WatchKind = {}));
5113 var PublishDiagnosticsNotification;
5114 (function(PublishDiagnosticsNotification2) {
5115 PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType("textDocument/publishDiagnostics");
5116 })(PublishDiagnosticsNotification = exports2.PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = {}));
5117 var CompletionTriggerKind;
5118 (function(CompletionTriggerKind2) {
5119 CompletionTriggerKind2.Invoked = 1;
5120 CompletionTriggerKind2.TriggerCharacter = 2;
5121 CompletionTriggerKind2.TriggerForIncompleteCompletions = 3;
5122 })(CompletionTriggerKind = exports2.CompletionTriggerKind || (exports2.CompletionTriggerKind = {}));
5123 var CompletionRequest;
5124 (function(CompletionRequest2) {
5125 CompletionRequest2.method = "textDocument/completion";
5126 CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method);
5127 })(CompletionRequest = exports2.CompletionRequest || (exports2.CompletionRequest = {}));
5128 var CompletionResolveRequest;
5129 (function(CompletionResolveRequest2) {
5130 CompletionResolveRequest2.method = "completionItem/resolve";
5131 CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method);
5132 })(CompletionResolveRequest = exports2.CompletionResolveRequest || (exports2.CompletionResolveRequest = {}));
5134 (function(HoverRequest2) {
5135 HoverRequest2.method = "textDocument/hover";
5136 HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method);
5137 })(HoverRequest = exports2.HoverRequest || (exports2.HoverRequest = {}));
5138 var SignatureHelpTriggerKind;
5139 (function(SignatureHelpTriggerKind2) {
5140 SignatureHelpTriggerKind2.Invoked = 1;
5141 SignatureHelpTriggerKind2.TriggerCharacter = 2;
5142 SignatureHelpTriggerKind2.ContentChange = 3;
5143 })(SignatureHelpTriggerKind = exports2.SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = {}));
5144 var SignatureHelpRequest;
5145 (function(SignatureHelpRequest2) {
5146 SignatureHelpRequest2.method = "textDocument/signatureHelp";
5147 SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method);
5148 })(SignatureHelpRequest = exports2.SignatureHelpRequest || (exports2.SignatureHelpRequest = {}));
5149 var DefinitionRequest;
5150 (function(DefinitionRequest2) {
5151 DefinitionRequest2.method = "textDocument/definition";
5152 DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method);
5153 })(DefinitionRequest = exports2.DefinitionRequest || (exports2.DefinitionRequest = {}));
5154 var ReferencesRequest;
5155 (function(ReferencesRequest2) {
5156 ReferencesRequest2.method = "textDocument/references";
5157 ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method);
5158 })(ReferencesRequest = exports2.ReferencesRequest || (exports2.ReferencesRequest = {}));
5159 var DocumentHighlightRequest;
5160 (function(DocumentHighlightRequest2) {
5161 DocumentHighlightRequest2.method = "textDocument/documentHighlight";
5162 DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method);
5163 })(DocumentHighlightRequest = exports2.DocumentHighlightRequest || (exports2.DocumentHighlightRequest = {}));
5164 var DocumentSymbolRequest;
5165 (function(DocumentSymbolRequest2) {
5166 DocumentSymbolRequest2.method = "textDocument/documentSymbol";
5167 DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method);
5168 })(DocumentSymbolRequest = exports2.DocumentSymbolRequest || (exports2.DocumentSymbolRequest = {}));
5169 var CodeActionRequest;
5170 (function(CodeActionRequest2) {
5171 CodeActionRequest2.method = "textDocument/codeAction";
5172 CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method);
5173 })(CodeActionRequest = exports2.CodeActionRequest || (exports2.CodeActionRequest = {}));
5174 var CodeActionResolveRequest;
5175 (function(CodeActionResolveRequest2) {
5176 CodeActionResolveRequest2.method = "codeAction/resolve";
5177 CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method);
5178 })(CodeActionResolveRequest = exports2.CodeActionResolveRequest || (exports2.CodeActionResolveRequest = {}));
5179 var WorkspaceSymbolRequest;
5180 (function(WorkspaceSymbolRequest2) {
5181 WorkspaceSymbolRequest2.method = "workspace/symbol";
5182 WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method);
5183 })(WorkspaceSymbolRequest = exports2.WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = {}));
5184 var CodeLensRequest;
5185 (function(CodeLensRequest2) {
5186 CodeLensRequest2.method = "textDocument/codeLens";
5187 CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method);
5188 })(CodeLensRequest = exports2.CodeLensRequest || (exports2.CodeLensRequest = {}));
5189 var CodeLensResolveRequest;
5190 (function(CodeLensResolveRequest2) {
5191 CodeLensResolveRequest2.method = "codeLens/resolve";
5192 CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method);
5193 })(CodeLensResolveRequest = exports2.CodeLensResolveRequest || (exports2.CodeLensResolveRequest = {}));
5194 var CodeLensRefreshRequest;
5195 (function(CodeLensRefreshRequest2) {
5196 CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`;
5197 CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method);
5198 })(CodeLensRefreshRequest = exports2.CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = {}));
5199 var DocumentLinkRequest;
5200 (function(DocumentLinkRequest2) {
5201 DocumentLinkRequest2.method = "textDocument/documentLink";
5202 DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method);
5203 })(DocumentLinkRequest = exports2.DocumentLinkRequest || (exports2.DocumentLinkRequest = {}));
5204 var DocumentLinkResolveRequest;
5205 (function(DocumentLinkResolveRequest2) {
5206 DocumentLinkResolveRequest2.method = "documentLink/resolve";
5207 DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method);
5208 })(DocumentLinkResolveRequest = exports2.DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = {}));
5209 var DocumentFormattingRequest;
5210 (function(DocumentFormattingRequest2) {
5211 DocumentFormattingRequest2.method = "textDocument/formatting";
5212 DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method);
5213 })(DocumentFormattingRequest = exports2.DocumentFormattingRequest || (exports2.DocumentFormattingRequest = {}));
5214 var DocumentRangeFormattingRequest;
5215 (function(DocumentRangeFormattingRequest2) {
5216 DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting";
5217 DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method);
5218 })(DocumentRangeFormattingRequest = exports2.DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = {}));
5219 var DocumentOnTypeFormattingRequest;
5220 (function(DocumentOnTypeFormattingRequest2) {
5221 DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting";
5222 DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method);
5223 })(DocumentOnTypeFormattingRequest = exports2.DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = {}));
5224 var PrepareSupportDefaultBehavior;
5225 (function(PrepareSupportDefaultBehavior2) {
5226 PrepareSupportDefaultBehavior2.Identifier = 1;
5227 })(PrepareSupportDefaultBehavior = exports2.PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = {}));
5229 (function(RenameRequest2) {
5230 RenameRequest2.method = "textDocument/rename";
5231 RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method);
5232 })(RenameRequest = exports2.RenameRequest || (exports2.RenameRequest = {}));
5233 var PrepareRenameRequest;
5234 (function(PrepareRenameRequest2) {
5235 PrepareRenameRequest2.method = "textDocument/prepareRename";
5236 PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method);
5237 })(PrepareRenameRequest = exports2.PrepareRenameRequest || (exports2.PrepareRenameRequest = {}));
5238 var ExecuteCommandRequest;
5239 (function(ExecuteCommandRequest2) {
5240 ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType("workspace/executeCommand");
5241 })(ExecuteCommandRequest = exports2.ExecuteCommandRequest || (exports2.ExecuteCommandRequest = {}));
5242 var ApplyWorkspaceEditRequest;
5243 (function(ApplyWorkspaceEditRequest2) {
5244 ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit");
5245 })(ApplyWorkspaceEditRequest = exports2.ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = {}));
5248 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/connection.js
5249 var require_connection2 = __commonJS((exports2) => {
5251 Object.defineProperty(exports2, "__esModule", {value: true});
5252 exports2.createProtocolConnection = void 0;
5253 var vscode_jsonrpc_1 = require_main();
5254 function createProtocolConnection(input, output, logger, options) {
5255 if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
5256 options = {connectionStrategy: options};
5258 return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
5260 exports2.createProtocolConnection = createProtocolConnection;
5263 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/common/api.js
5264 var require_api2 = __commonJS((exports2) => {
5266 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5269 Object.defineProperty(o, k2, {enumerable: true, get: function() {
5272 } : function(o, m, k, k2) {
5277 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
5279 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5280 __createBinding(exports3, m, p);
5282 Object.defineProperty(exports2, "__esModule", {value: true});
5283 exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0;
5284 __exportStar2(require_main(), exports2);
5285 __exportStar2(require_main2(), exports2);
5286 __exportStar2(require_messages2(), exports2);
5287 __exportStar2(require_protocol(), exports2);
5288 var connection_1 = require_connection2();
5289 Object.defineProperty(exports2, "createProtocolConnection", {enumerable: true, get: function() {
5290 return connection_1.createProtocolConnection;
5293 (function(LSPErrorCodes2) {
5294 LSPErrorCodes2.lspReservedErrorRangeStart = -32899;
5295 LSPErrorCodes2.ContentModified = -32801;
5296 LSPErrorCodes2.RequestCancelled = -32800;
5297 LSPErrorCodes2.lspReservedErrorRangeEnd = -32800;
5298 })(LSPErrorCodes = exports2.LSPErrorCodes || (exports2.LSPErrorCodes = {}));
5301 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/lib/node/main.js
5302 var require_main3 = __commonJS((exports2) => {
5304 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5307 Object.defineProperty(o, k2, {enumerable: true, get: function() {
5310 } : function(o, m, k, k2) {
5315 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
5317 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5318 __createBinding(exports3, m, p);
5320 Object.defineProperty(exports2, "__esModule", {value: true});
5321 exports2.createProtocolConnection = void 0;
5322 var node_1 = require_node();
5323 __exportStar2(require_node(), exports2);
5324 __exportStar2(require_api2(), exports2);
5325 function createProtocolConnection(input, output, logger, options) {
5326 return node_1.createMessageConnection(input, output, logger, options);
5328 exports2.createProtocolConnection = createProtocolConnection;
5331 // node_modules/vscode-languageserver/lib/common/utils/uuid.js
5332 var require_uuid = __commonJS((exports2) => {
5334 Object.defineProperty(exports2, "__esModule", {value: true});
5335 exports2.generateUuid = exports2.parse = exports2.isUUID = exports2.v4 = exports2.empty = void 0;
5336 var ValueUUID = class {
5337 constructor(_value) {
5338 this._value = _value;
5344 return this.asHex() === other.asHex();
5347 var V4UUID = class extends ValueUUID {
5350 V4UUID._randomHex(),
5351 V4UUID._randomHex(),
5352 V4UUID._randomHex(),
5353 V4UUID._randomHex(),
5354 V4UUID._randomHex(),
5355 V4UUID._randomHex(),
5356 V4UUID._randomHex(),
5357 V4UUID._randomHex(),
5359 V4UUID._randomHex(),
5360 V4UUID._randomHex(),
5361 V4UUID._randomHex(),
5362 V4UUID._randomHex(),
5365 V4UUID._randomHex(),
5366 V4UUID._randomHex(),
5367 V4UUID._randomHex(),
5369 V4UUID._oneOf(V4UUID._timeHighBits),
5370 V4UUID._randomHex(),
5371 V4UUID._randomHex(),
5372 V4UUID._randomHex(),
5374 V4UUID._randomHex(),
5375 V4UUID._randomHex(),
5376 V4UUID._randomHex(),
5377 V4UUID._randomHex(),
5378 V4UUID._randomHex(),
5379 V4UUID._randomHex(),
5380 V4UUID._randomHex(),
5381 V4UUID._randomHex(),
5382 V4UUID._randomHex(),
5383 V4UUID._randomHex(),
5384 V4UUID._randomHex(),
5388 static _oneOf(array) {
5389 return array[Math.floor(array.length * Math.random())];
5391 static _randomHex() {
5392 return V4UUID._oneOf(V4UUID._chars);
5395 V4UUID._chars = ["0", "1", "2", "3", "4", "5", "6", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
5396 V4UUID._timeHighBits = ["8", "9", "a", "b"];
5397 exports2.empty = new ValueUUID("00000000-0000-0000-0000-000000000000");
5399 return new V4UUID();
5402 var _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
5403 function isUUID(value) {
5404 return _UUIDPattern.test(value);
5406 exports2.isUUID = isUUID;
5407 function parse(value) {
5408 if (!isUUID(value)) {
5409 throw new Error("invalid uuid");
5411 return new ValueUUID(value);
5413 exports2.parse = parse;
5414 function generateUuid() {
5415 return v4().asHex();
5417 exports2.generateUuid = generateUuid;
5420 // node_modules/vscode-languageserver/lib/common/progress.js
5421 var require_progress = __commonJS((exports2) => {
5423 Object.defineProperty(exports2, "__esModule", {value: true});
5424 exports2.attachPartialResult = exports2.ProgressFeature = exports2.attachWorkDone = void 0;
5425 var vscode_languageserver_protocol_1 = require_main3();
5426 var uuid_1 = require_uuid();
5427 var WorkDoneProgressReporterImpl = class {
5428 constructor(_connection, _token) {
5429 this._connection = _connection;
5430 this._token = _token;
5431 WorkDoneProgressReporterImpl.Instances.set(this._token, this);
5433 begin(title, percentage, message, cancellable) {
5441 this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
5443 report(arg0, arg1) {
5447 if (typeof arg0 === "number") {
5448 param.percentage = arg0;
5449 if (arg1 !== void 0) {
5450 param.message = arg1;
5453 param.message = arg0;
5455 this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
5458 WorkDoneProgressReporterImpl.Instances.delete(this._token);
5459 this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, {kind: "end"});
5462 WorkDoneProgressReporterImpl.Instances = new Map();
5463 var WorkDoneProgressServerReporterImpl = class extends WorkDoneProgressReporterImpl {
5464 constructor(connection, token) {
5465 super(connection, token);
5466 this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
5469 return this._source.token;
5472 this._source.dispose();
5476 this._source.cancel();
5479 var NullProgressReporter = class {
5489 var NullProgressServerReporter = class extends NullProgressReporter {
5492 this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
5495 return this._source.token;
5498 this._source.dispose();
5501 this._source.cancel();
5504 function attachWorkDone(connection, params) {
5505 if (params === void 0 || params.workDoneToken === void 0) {
5506 return new NullProgressReporter();
5508 const token = params.workDoneToken;
5509 delete params.workDoneToken;
5510 return new WorkDoneProgressReporterImpl(connection, token);
5512 exports2.attachWorkDone = attachWorkDone;
5513 var ProgressFeature = (Base) => {
5514 return class extends Base {
5517 this._progressSupported = false;
5519 initialize(capabilities) {
5521 if (((_a2 = capabilities === null || capabilities === void 0 ? void 0 : capabilities.window) === null || _a2 === void 0 ? void 0 : _a2.workDoneProgress) === true) {
5522 this._progressSupported = true;
5523 this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => {
5524 let progress = WorkDoneProgressReporterImpl.Instances.get(params.token);
5525 if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) {
5531 attachWorkDoneProgress(token) {
5532 if (token === void 0) {
5533 return new NullProgressReporter();
5535 return new WorkDoneProgressReporterImpl(this.connection, token);
5538 createWorkDoneProgress() {
5539 if (this._progressSupported) {
5540 const token = uuid_1.generateUuid();
5541 return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, {token}).then(() => {
5542 const result = new WorkDoneProgressServerReporterImpl(this.connection, token);
5546 return Promise.resolve(new NullProgressServerReporter());
5551 exports2.ProgressFeature = ProgressFeature;
5553 (function(ResultProgress2) {
5554 ResultProgress2.type = new vscode_languageserver_protocol_1.ProgressType();
5555 })(ResultProgress || (ResultProgress = {}));
5556 var ResultProgressReporterImpl = class {
5557 constructor(_connection, _token) {
5558 this._connection = _connection;
5559 this._token = _token;
5562 this._connection.sendProgress(ResultProgress.type, this._token, data);
5565 function attachPartialResult(connection, params) {
5566 if (params === void 0 || params.partialResultToken === void 0) {
5569 const token = params.partialResultToken;
5570 delete params.partialResultToken;
5571 return new ResultProgressReporterImpl(connection, token);
5573 exports2.attachPartialResult = attachPartialResult;
5576 // node_modules/vscode-languageserver/lib/common/configuration.js
5577 var require_configuration = __commonJS((exports2) => {
5579 Object.defineProperty(exports2, "__esModule", {value: true});
5580 exports2.ConfigurationFeature = void 0;
5581 var vscode_languageserver_protocol_1 = require_main3();
5582 var Is = require_is();
5583 var ConfigurationFeature = (Base) => {
5584 return class extends Base {
5585 getConfiguration(arg) {
5587 return this._getConfiguration({});
5588 } else if (Is.string(arg)) {
5589 return this._getConfiguration({section: arg});
5591 return this._getConfiguration(arg);
5594 _getConfiguration(arg) {
5596 items: Array.isArray(arg) ? arg : [arg]
5598 return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {
5599 return Array.isArray(arg) ? result : result[0];
5604 exports2.ConfigurationFeature = ConfigurationFeature;
5607 // node_modules/vscode-languageserver/lib/common/workspaceFolders.js
5608 var require_workspaceFolders = __commonJS((exports2) => {
5610 Object.defineProperty(exports2, "__esModule", {value: true});
5611 exports2.WorkspaceFoldersFeature = void 0;
5612 var vscode_languageserver_protocol_1 = require_main3();
5613 var WorkspaceFoldersFeature = (Base) => {
5614 return class extends Base {
5615 initialize(capabilities) {
5616 let workspaceCapabilities = capabilities.workspace;
5617 if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {
5618 this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();
5619 this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {
5620 this._onDidChangeWorkspaceFolders.fire(params.event);
5624 getWorkspaceFolders() {
5625 return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);
5627 get onDidChangeWorkspaceFolders() {
5628 if (!this._onDidChangeWorkspaceFolders) {
5629 throw new Error("Client doesn't support sending workspace folder change events.");
5631 if (!this._unregistration) {
5632 this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);
5634 return this._onDidChangeWorkspaceFolders.event;
5638 exports2.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
5641 // node_modules/vscode-languageserver/lib/common/callHierarchy.js
5642 var require_callHierarchy = __commonJS((exports2) => {
5644 Object.defineProperty(exports2, "__esModule", {value: true});
5645 exports2.CallHierarchyFeature = void 0;
5646 var vscode_languageserver_protocol_1 = require_main3();
5647 var CallHierarchyFeature = (Base) => {
5648 return class extends Base {
5649 get callHierarchy() {
5651 onPrepare: (handler) => {
5652 this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => {
5653 return handler(params, cancel, this.attachWorkDoneProgress(params), void 0);
5656 onIncomingCalls: (handler) => {
5657 const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type;
5658 this.connection.onRequest(type, (params, cancel) => {
5659 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5662 onOutgoingCalls: (handler) => {
5663 const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type;
5664 this.connection.onRequest(type, (params, cancel) => {
5665 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5672 exports2.CallHierarchyFeature = CallHierarchyFeature;
5675 // node_modules/vscode-languageserver/lib/common/semanticTokens.js
5676 var require_semanticTokens = __commonJS((exports2) => {
5678 Object.defineProperty(exports2, "__esModule", {value: true});
5679 exports2.SemanticTokensBuilder = exports2.SemanticTokensFeature = void 0;
5680 var vscode_languageserver_protocol_1 = require_main3();
5681 var SemanticTokensFeature = (Base) => {
5682 return class extends Base {
5683 get semanticTokens() {
5686 const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type;
5687 this.connection.onRequest(type, (params, cancel) => {
5688 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5691 onDelta: (handler) => {
5692 const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type;
5693 this.connection.onRequest(type, (params, cancel) => {
5694 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5697 onRange: (handler) => {
5698 const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type;
5699 this.connection.onRequest(type, (params, cancel) => {
5700 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5707 exports2.SemanticTokensFeature = SemanticTokensFeature;
5708 var SemanticTokensBuilder = class {
5710 this._prevData = void 0;
5714 this._id = Date.now();
5720 push(line, char, length, tokenType, tokenModifiers) {
5721 let pushLine = line;
5722 let pushChar = char;
5723 if (this._dataLen > 0) {
5724 pushLine -= this._prevLine;
5725 if (pushLine === 0) {
5726 pushChar -= this._prevChar;
5729 this._data[this._dataLen++] = pushLine;
5730 this._data[this._dataLen++] = pushChar;
5731 this._data[this._dataLen++] = length;
5732 this._data[this._dataLen++] = tokenType;
5733 this._data[this._dataLen++] = tokenModifiers;
5734 this._prevLine = line;
5735 this._prevChar = char;
5738 return this._id.toString();
5740 previousResult(id) {
5741 if (this.id === id) {
5742 this._prevData = this._data;
5747 this._prevData = void 0;
5754 return this._prevData !== void 0;
5757 if (this._prevData !== void 0) {
5758 const prevDataLength = this._prevData.length;
5759 const dataLength = this._data.length;
5761 while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) {
5764 if (startIndex < dataLength && startIndex < prevDataLength) {
5766 while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) {
5769 const newData = this._data.slice(startIndex, dataLength - endIndex);
5773 {start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData}
5777 } else if (startIndex < dataLength) {
5778 return {resultId: this.id, edits: [
5779 {start: startIndex, deleteCount: 0, data: this._data.slice(startIndex)}
5781 } else if (startIndex < prevDataLength) {
5782 return {resultId: this.id, edits: [
5783 {start: startIndex, deleteCount: prevDataLength - startIndex}
5786 return {resultId: this.id, edits: []};
5789 return this.build();
5793 exports2.SemanticTokensBuilder = SemanticTokensBuilder;
5796 // node_modules/vscode-languageserver/lib/common/showDocument.js
5797 var require_showDocument = __commonJS((exports2) => {
5799 Object.defineProperty(exports2, "__esModule", {value: true});
5800 exports2.ShowDocumentFeature = void 0;
5801 var vscode_languageserver_protocol_1 = require_main3();
5802 var ShowDocumentFeature = (Base) => {
5803 return class extends Base {
5804 showDocument(params) {
5805 return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params);
5809 exports2.ShowDocumentFeature = ShowDocumentFeature;
5812 // node_modules/vscode-languageserver/lib/common/fileOperations.js
5813 var require_fileOperations = __commonJS((exports2) => {
5815 Object.defineProperty(exports2, "__esModule", {value: true});
5816 exports2.FileOperationsFeature = void 0;
5817 var vscode_languageserver_protocol_1 = require_main3();
5818 var FileOperationsFeature = (Base) => {
5819 return class extends Base {
5820 onDidCreateFiles(handler) {
5821 this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => {
5825 onDidRenameFiles(handler) {
5826 this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => {
5830 onDidDeleteFiles(handler) {
5831 this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => {
5835 onWillCreateFiles(handler) {
5836 return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => {
5837 return handler(params, cancel);
5840 onWillRenameFiles(handler) {
5841 return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => {
5842 return handler(params, cancel);
5845 onWillDeleteFiles(handler) {
5846 return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => {
5847 return handler(params, cancel);
5852 exports2.FileOperationsFeature = FileOperationsFeature;
5855 // node_modules/vscode-languageserver/lib/common/linkedEditingRange.js
5856 var require_linkedEditingRange = __commonJS((exports2) => {
5858 Object.defineProperty(exports2, "__esModule", {value: true});
5859 exports2.LinkedEditingRangeFeature = void 0;
5860 var vscode_languageserver_protocol_1 = require_main3();
5861 var LinkedEditingRangeFeature = (Base) => {
5862 return class extends Base {
5863 onLinkedEditingRange(handler) {
5864 this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => {
5865 return handler(params, cancel, this.attachWorkDoneProgress(params), void 0);
5870 exports2.LinkedEditingRangeFeature = LinkedEditingRangeFeature;
5873 // node_modules/vscode-languageserver/lib/common/moniker.js
5874 var require_moniker = __commonJS((exports2) => {
5876 Object.defineProperty(exports2, "__esModule", {value: true});
5877 exports2.MonikerFeature = void 0;
5878 var vscode_languageserver_protocol_1 = require_main3();
5879 var MonikerFeature = (Base) => {
5880 return class extends Base {
5884 const type = vscode_languageserver_protocol_1.MonikerRequest.type;
5885 this.connection.onRequest(type, (params, cancel) => {
5886 return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
5893 exports2.MonikerFeature = MonikerFeature;
5896 // node_modules/vscode-languageserver/lib/common/server.js
5897 var require_server = __commonJS((exports2) => {
5899 Object.defineProperty(exports2, "__esModule", {value: true});
5900 exports2.createConnection = exports2.combineFeatures = exports2.combineLanguagesFeatures = exports2.combineWorkspaceFeatures = exports2.combineWindowFeatures = exports2.combineClientFeatures = exports2.combineTracerFeatures = exports2.combineTelemetryFeatures = exports2.combineConsoleFeatures = exports2._LanguagesImpl = exports2.BulkUnregistration = exports2.BulkRegistration = exports2.ErrorMessageTracker = exports2.TextDocuments = void 0;
5901 var vscode_languageserver_protocol_1 = require_main3();
5902 var Is = require_is();
5903 var UUID = require_uuid();
5904 var progress_1 = require_progress();
5905 var configuration_1 = require_configuration();
5906 var workspaceFolders_1 = require_workspaceFolders();
5907 var callHierarchy_1 = require_callHierarchy();
5908 var semanticTokens_1 = require_semanticTokens();
5909 var showDocument_1 = require_showDocument();
5910 var fileOperations_1 = require_fileOperations();
5911 var linkedEditingRange_1 = require_linkedEditingRange();
5912 var moniker_1 = require_moniker();
5913 function null2Undefined(value) {
5914 if (value === null) {
5919 var TextDocuments = class {
5920 constructor(configuration) {
5921 this._documents = Object.create(null);
5922 this._configuration = configuration;
5923 this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();
5924 this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();
5925 this._onDidClose = new vscode_languageserver_protocol_1.Emitter();
5926 this._onDidSave = new vscode_languageserver_protocol_1.Emitter();
5927 this._onWillSave = new vscode_languageserver_protocol_1.Emitter();
5929 get onDidChangeContent() {
5930 return this._onDidChangeContent.event;
5933 return this._onDidOpen.event;
5936 return this._onWillSave.event;
5938 onWillSaveWaitUntil(handler) {
5939 this._willSaveWaitUntil = handler;
5942 return this._onDidSave.event;
5945 return this._onDidClose.event;
5948 return this._documents[uri];
5951 return Object.keys(this._documents).map((key) => this._documents[key]);
5954 return Object.keys(this._documents);
5956 listen(connection) {
5957 connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;
5958 connection.onDidOpenTextDocument((event) => {
5959 let td = event.textDocument;
5960 let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);
5961 this._documents[td.uri] = document;
5962 let toFire = Object.freeze({document});
5963 this._onDidOpen.fire(toFire);
5964 this._onDidChangeContent.fire(toFire);
5966 connection.onDidChangeTextDocument((event) => {
5967 let td = event.textDocument;
5968 let changes = event.contentChanges;
5969 if (changes.length === 0) {
5972 let document = this._documents[td.uri];
5973 const {version} = td;
5974 if (version === null || version === void 0) {
5975 throw new Error(`Received document change event for ${td.uri} without valid version identifier`);
5977 document = this._configuration.update(document, changes, version);
5978 this._documents[td.uri] = document;
5979 this._onDidChangeContent.fire(Object.freeze({document}));
5981 connection.onDidCloseTextDocument((event) => {
5982 let document = this._documents[event.textDocument.uri];
5984 delete this._documents[event.textDocument.uri];
5985 this._onDidClose.fire(Object.freeze({document}));
5988 connection.onWillSaveTextDocument((event) => {
5989 let document = this._documents[event.textDocument.uri];
5991 this._onWillSave.fire(Object.freeze({document, reason: event.reason}));
5994 connection.onWillSaveTextDocumentWaitUntil((event, token) => {
5995 let document = this._documents[event.textDocument.uri];
5996 if (document && this._willSaveWaitUntil) {
5997 return this._willSaveWaitUntil(Object.freeze({document, reason: event.reason}), token);
6002 connection.onDidSaveTextDocument((event) => {
6003 let document = this._documents[event.textDocument.uri];
6005 this._onDidSave.fire(Object.freeze({document}));
6010 exports2.TextDocuments = TextDocuments;
6011 var ErrorMessageTracker = class {
6013 this._messages = Object.create(null);
6016 let count = this._messages[message];
6021 this._messages[message] = count;
6023 sendErrors(connection) {
6024 Object.keys(this._messages).forEach((message) => {
6025 connection.window.showErrorMessage(message);
6029 exports2.ErrorMessageTracker = ErrorMessageTracker;
6030 var RemoteConsoleImpl = class {
6033 rawAttach(connection) {
6034 this._rawConnection = connection;
6036 attach(connection) {
6037 this._connection = connection;
6040 if (!this._connection) {
6041 throw new Error("Remote is not attached to a connection yet.");
6043 return this._connection;
6045 fillServerCapabilities(_capabilities) {
6047 initialize(_capabilities) {
6050 this.send(vscode_languageserver_protocol_1.MessageType.Error, message);
6053 this.send(vscode_languageserver_protocol_1.MessageType.Warning, message);
6056 this.send(vscode_languageserver_protocol_1.MessageType.Info, message);
6059 this.send(vscode_languageserver_protocol_1.MessageType.Log, message);
6061 send(type, message) {
6062 if (this._rawConnection) {
6063 this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, {type, message});
6067 var _RemoteWindowImpl = class {
6070 attach(connection) {
6071 this._connection = connection;
6074 if (!this._connection) {
6075 throw new Error("Remote is not attached to a connection yet.");
6077 return this._connection;
6079 initialize(_capabilities) {
6081 fillServerCapabilities(_capabilities) {
6083 showErrorMessage(message, ...actions) {
6084 let params = {type: vscode_languageserver_protocol_1.MessageType.Error, message, actions};
6085 return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
6087 showWarningMessage(message, ...actions) {
6088 let params = {type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions};
6089 return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
6091 showInformationMessage(message, ...actions) {
6092 let params = {type: vscode_languageserver_protocol_1.MessageType.Info, message, actions};
6093 return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
6096 var RemoteWindowImpl = showDocument_1.ShowDocumentFeature(progress_1.ProgressFeature(_RemoteWindowImpl));
6097 var BulkRegistration;
6098 (function(BulkRegistration2) {
6100 return new BulkRegistrationImpl();
6102 BulkRegistration2.create = create;
6103 })(BulkRegistration = exports2.BulkRegistration || (exports2.BulkRegistration = {}));
6104 var BulkRegistrationImpl = class {
6106 this._registrations = [];
6107 this._registered = new Set();
6109 add(type, registerOptions) {
6110 const method = Is.string(type) ? type : type.method;
6111 if (this._registered.has(method)) {
6112 throw new Error(`${method} is already added to this registration`);
6114 const id = UUID.generateUuid();
6115 this._registrations.push({
6118 registerOptions: registerOptions || {}
6120 this._registered.add(method);
6122 asRegistrationParams() {
6124 registrations: this._registrations
6128 var BulkUnregistration;
6129 (function(BulkUnregistration2) {
6131 return new BulkUnregistrationImpl(void 0, []);
6133 BulkUnregistration2.create = create;
6134 })(BulkUnregistration = exports2.BulkUnregistration || (exports2.BulkUnregistration = {}));
6135 var BulkUnregistrationImpl = class {
6136 constructor(_connection, unregistrations) {
6137 this._connection = _connection;
6138 this._unregistrations = new Map();
6139 unregistrations.forEach((unregistration) => {
6140 this._unregistrations.set(unregistration.method, unregistration);
6144 return !!this._connection;
6146 attach(connection) {
6147 this._connection = connection;
6149 add(unregistration) {
6150 this._unregistrations.set(unregistration.method, unregistration);
6153 let unregistrations = [];
6154 for (let unregistration of this._unregistrations.values()) {
6155 unregistrations.push(unregistration);
6158 unregisterations: unregistrations
6160 this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(void 0, (_error) => {
6161 this._connection.console.info(`Bulk unregistration failed.`);
6164 disposeSingle(arg) {
6165 const method = Is.string(arg) ? arg : arg.method;
6166 const unregistration = this._unregistrations.get(method);
6167 if (!unregistration) {
6171 unregisterations: [unregistration]
6173 this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => {
6174 this._unregistrations.delete(method);
6176 this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`);
6181 var RemoteClientImpl = class {
6182 attach(connection) {
6183 this._connection = connection;
6186 if (!this._connection) {
6187 throw new Error("Remote is not attached to a connection yet.");
6189 return this._connection;
6191 initialize(_capabilities) {
6193 fillServerCapabilities(_capabilities) {
6195 register(typeOrRegistrations, registerOptionsOrType, registerOptions) {
6196 if (typeOrRegistrations instanceof BulkRegistrationImpl) {
6197 return this.registerMany(typeOrRegistrations);
6198 } else if (typeOrRegistrations instanceof BulkUnregistrationImpl) {
6199 return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions);
6201 return this.registerSingle2(typeOrRegistrations, registerOptionsOrType);
6204 registerSingle1(unregistration, type, registerOptions) {
6205 const method = Is.string(type) ? type : type.method;
6206 const id = UUID.generateUuid();
6208 registrations: [{id, method, registerOptions: registerOptions || {}}]
6210 if (!unregistration.isAttached) {
6211 unregistration.attach(this.connection);
6213 return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
6214 unregistration.add({id, method});
6215 return unregistration;
6217 this.connection.console.info(`Registering request handler for ${method} failed.`);
6218 return Promise.reject(_error);
6221 registerSingle2(type, registerOptions) {
6222 const method = Is.string(type) ? type : type.method;
6223 const id = UUID.generateUuid();
6225 registrations: [{id, method, registerOptions: registerOptions || {}}]
6227 return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
6228 return vscode_languageserver_protocol_1.Disposable.create(() => {
6229 this.unregisterSingle(id, method);
6232 this.connection.console.info(`Registering request handler for ${method} failed.`);
6233 return Promise.reject(_error);
6236 unregisterSingle(id, method) {
6238 unregisterations: [{id, method}]
6240 return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(void 0, (_error) => {
6241 this.connection.console.info(`Un-registering request handler for ${id} failed.`);
6244 registerMany(registrations) {
6245 let params = registrations.asRegistrationParams();
6246 return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => {
6247 return new BulkUnregistrationImpl(this._connection, params.registrations.map((registration) => {
6248 return {id: registration.id, method: registration.method};
6251 this.connection.console.info(`Bulk registration failed.`);
6252 return Promise.reject(_error);
6256 var _RemoteWorkspaceImpl = class {
6259 attach(connection) {
6260 this._connection = connection;
6263 if (!this._connection) {
6264 throw new Error("Remote is not attached to a connection yet.");
6266 return this._connection;
6268 initialize(_capabilities) {
6270 fillServerCapabilities(_capabilities) {
6272 applyEdit(paramOrEdit) {
6273 function isApplyWorkspaceEditParams(value) {
6274 return value && !!value.edit;
6276 let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : {edit: paramOrEdit};
6277 return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params);
6280 var RemoteWorkspaceImpl = fileOperations_1.FileOperationsFeature(workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl)));
6281 var TracerImpl = class {
6283 this._trace = vscode_languageserver_protocol_1.Trace.Off;
6285 attach(connection) {
6286 this._connection = connection;
6289 if (!this._connection) {
6290 throw new Error("Remote is not attached to a connection yet.");
6292 return this._connection;
6294 initialize(_capabilities) {
6296 fillServerCapabilities(_capabilities) {
6299 this._trace = value;
6301 log(message, verbose) {
6302 if (this._trace === vscode_languageserver_protocol_1.Trace.Off) {
6305 this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, {
6307 verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : void 0
6311 var TelemetryImpl = class {
6314 attach(connection) {
6315 this._connection = connection;
6318 if (!this._connection) {
6319 throw new Error("Remote is not attached to a connection yet.");
6321 return this._connection;
6323 initialize(_capabilities) {
6325 fillServerCapabilities(_capabilities) {
6328 this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data);
6331 var _LanguagesImpl = class {
6334 attach(connection) {
6335 this._connection = connection;
6338 if (!this._connection) {
6339 throw new Error("Remote is not attached to a connection yet.");
6341 return this._connection;
6343 initialize(_capabilities) {
6345 fillServerCapabilities(_capabilities) {
6347 attachWorkDoneProgress(params) {
6348 return progress_1.attachWorkDone(this.connection, params);
6350 attachPartialResultProgress(_type, params) {
6351 return progress_1.attachPartialResult(this.connection, params);
6354 exports2._LanguagesImpl = _LanguagesImpl;
6355 var LanguagesImpl = moniker_1.MonikerFeature(linkedEditingRange_1.LinkedEditingRangeFeature(semanticTokens_1.SemanticTokensFeature(callHierarchy_1.CallHierarchyFeature(_LanguagesImpl))));
6356 function combineConsoleFeatures(one, two) {
6357 return function(Base) {
6358 return two(one(Base));
6361 exports2.combineConsoleFeatures = combineConsoleFeatures;
6362 function combineTelemetryFeatures(one, two) {
6363 return function(Base) {
6364 return two(one(Base));
6367 exports2.combineTelemetryFeatures = combineTelemetryFeatures;
6368 function combineTracerFeatures(one, two) {
6369 return function(Base) {
6370 return two(one(Base));
6373 exports2.combineTracerFeatures = combineTracerFeatures;
6374 function combineClientFeatures(one, two) {
6375 return function(Base) {
6376 return two(one(Base));
6379 exports2.combineClientFeatures = combineClientFeatures;
6380 function combineWindowFeatures(one, two) {
6381 return function(Base) {
6382 return two(one(Base));
6385 exports2.combineWindowFeatures = combineWindowFeatures;
6386 function combineWorkspaceFeatures(one, two) {
6387 return function(Base) {
6388 return two(one(Base));
6391 exports2.combineWorkspaceFeatures = combineWorkspaceFeatures;
6392 function combineLanguagesFeatures(one, two) {
6393 return function(Base) {
6394 return two(one(Base));
6397 exports2.combineLanguagesFeatures = combineLanguagesFeatures;
6398 function combineFeatures(one, two) {
6399 function combine(one2, two2, func) {
6401 return func(one2, two2);
6409 __brand: "features",
6410 console: combine(one.console, two.console, combineConsoleFeatures),
6411 tracer: combine(one.tracer, two.tracer, combineTracerFeatures),
6412 telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures),
6413 client: combine(one.client, two.client, combineClientFeatures),
6414 window: combine(one.window, two.window, combineWindowFeatures),
6415 workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures)
6419 exports2.combineFeatures = combineFeatures;
6420 function createConnection(connectionFactory, watchDog, factories) {
6421 const logger = factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl();
6422 const connection = connectionFactory(logger);
6423 logger.rawAttach(connection);
6424 const tracer = factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl();
6425 const telemetry = factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl();
6426 const client = factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl();
6427 const remoteWindow = factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl();
6428 const workspace = factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl();
6429 const languages = factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl();
6430 const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages];
6431 function asPromise(value) {
6432 if (value instanceof Promise) {
6434 } else if (Is.thenable(value)) {
6435 return new Promise((resolve, reject) => {
6436 value.then((resolved) => resolve(resolved), (error) => reject(error));
6439 return Promise.resolve(value);
6442 let shutdownHandler = void 0;
6443 let initializeHandler = void 0;
6444 let exitHandler = void 0;
6445 let protocolConnection = {
6446 listen: () => connection.listen(),
6447 sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params),
6448 onRequest: (type, handler) => connection.onRequest(type, handler),
6449 sendNotification: (type, param) => {
6450 const method = Is.string(type) ? type : type.method;
6451 if (arguments.length === 1) {
6452 connection.sendNotification(method);
6454 connection.sendNotification(method, param);
6457 onNotification: (type, handler) => connection.onNotification(type, handler),
6458 onProgress: connection.onProgress,
6459 sendProgress: connection.sendProgress,
6460 onInitialize: (handler) => initializeHandler = handler,
6461 onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler),
6462 onShutdown: (handler) => shutdownHandler = handler,
6463 onExit: (handler) => exitHandler = handler,
6477 return remoteWindow;
6485 onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler),
6486 onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler),
6487 __textDocumentSync: void 0,
6488 onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler),
6489 onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler),
6490 onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler),
6491 onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler),
6492 onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler),
6493 onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler),
6494 sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params),
6495 onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => {
6496 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6498 onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => {
6499 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6501 onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler),
6502 onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => {
6503 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6505 onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => {
6506 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6508 onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => {
6509 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6511 onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => {
6512 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6514 onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => {
6515 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6517 onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => {
6518 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6520 onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => {
6521 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6523 onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => {
6524 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6526 onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => {
6527 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6529 onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => {
6530 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6532 onCodeActionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => {
6533 return handler(params, cancel);
6535 onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => {
6536 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6538 onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => {
6539 return handler(params, cancel);
6541 onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => {
6542 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6544 onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => {
6545 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6547 onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => {
6548 return handler(params, cancel);
6550 onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => {
6551 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6553 onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => {
6554 return handler(params, cancel);
6556 onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => {
6557 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6559 onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => {
6560 return handler(params, cancel);
6562 onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => {
6563 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6565 onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => {
6566 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6568 onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => {
6569 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6571 onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => {
6572 return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
6574 onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => {
6575 return handler(params, cancel, progress_1.attachWorkDone(connection, params), void 0);
6577 dispose: () => connection.dispose()
6579 for (let remote of allRemotes) {
6580 remote.attach(protocolConnection);
6582 connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => {
6583 watchDog.initialize(params);
6584 if (Is.string(params.trace)) {
6585 tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace);
6587 for (let remote of allRemotes) {
6588 remote.initialize(params.capabilities);
6590 if (initializeHandler) {
6591 let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, progress_1.attachWorkDone(connection, params), void 0);
6592 return asPromise(result).then((value) => {
6593 if (value instanceof vscode_languageserver_protocol_1.ResponseError) {
6596 let result2 = value;
6598 result2 = {capabilities: {}};
6600 let capabilities = result2.capabilities;
6601 if (!capabilities) {
6603 result2.capabilities = capabilities;
6605 if (capabilities.textDocumentSync === void 0 || capabilities.textDocumentSync === null) {
6606 capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
6607 } else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) {
6608 capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
6610 for (let remote of allRemotes) {
6611 remote.fillServerCapabilities(capabilities);
6616 let result = {capabilities: {textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None}};
6617 for (let remote of allRemotes) {
6618 remote.fillServerCapabilities(result.capabilities);
6623 connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => {
6624 watchDog.shutdownReceived = true;
6625 if (shutdownHandler) {
6626 return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token);
6631 connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => {
6637 if (watchDog.shutdownReceived) {
6644 connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => {
6645 tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value);
6647 return protocolConnection;
6649 exports2.createConnection = createConnection;
6652 // node_modules/vscode-languageserver/lib/node/files.js
6653 var require_files = __commonJS((exports2) => {
6655 Object.defineProperty(exports2, "__esModule", {value: true});
6656 exports2.resolveModulePath = exports2.FileSystem = exports2.resolveGlobalYarnPath = exports2.resolveGlobalNodePath = exports2.resolve = exports2.uriToFilePath = void 0;
6657 var url = require("url");
6658 var path = require("path");
6659 var fs = require("fs");
6660 var child_process_1 = require("child_process");
6661 function uriToFilePath(uri) {
6662 let parsed = url.parse(uri);
6663 if (parsed.protocol !== "file:" || !parsed.path) {
6666 let segments = parsed.path.split("/");
6667 for (var i = 0, len = segments.length; i < len; i++) {
6668 segments[i] = decodeURIComponent(segments[i]);
6670 if (process.platform === "win32" && segments.length > 1) {
6671 let first = segments[0];
6672 let second = segments[1];
6673 if (first.length === 0 && second.length > 1 && second[1] === ":") {
6677 return path.normalize(segments.join("/"));
6679 exports2.uriToFilePath = uriToFilePath;
6680 function isWindows2() {
6681 return process.platform === "win32";
6683 function resolve(moduleName, nodePath, cwd, tracer) {
6684 const nodePathKey = "NODE_PATH";
6687 "p.on('message',function(m){",
6691 "else if(m.c==='rs'){",
6693 "var r=require.resolve(m.a);",
6694 "p.send({c:'r',s:true,r:r});",
6697 "p.send({c:'r',s:false});",
6702 return new Promise((resolve2, reject) => {
6703 let env = process.env;
6704 let newEnv = Object.create(null);
6705 Object.keys(env).forEach((key) => newEnv[key] = env[key]);
6706 if (nodePath && fs.existsSync(nodePath)) {
6707 if (newEnv[nodePathKey]) {
6708 newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey];
6710 newEnv[nodePathKey] = nodePath;
6713 tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`);
6716 newEnv["ELECTRON_RUN_AS_NODE"] = "1";
6718 let cp = child_process_1.fork("", [], {
6721 execArgv: ["-e", app]
6723 if (cp.pid === void 0) {
6724 reject(new Error(`Starting process to resolve node module ${moduleName} failed`));
6727 cp.on("error", (error) => {
6730 cp.on("message", (message2) => {
6731 if (message2.c === "r") {
6734 resolve2(message2.r);
6736 reject(new Error(`Failed to resolve module: ${moduleName}`));
6750 exports2.resolve = resolve;
6751 function resolveGlobalNodePath(tracer) {
6752 let npmCommand = "npm";
6753 const env = Object.create(null);
6754 Object.keys(process.env).forEach((key) => env[key] = process.env[key]);
6755 env["NO_UPDATE_NOTIFIER"] = "true";
6761 npmCommand = "npm.cmd";
6762 options.shell = true;
6764 let handler = () => {
6767 process.on("SIGPIPE", handler);
6768 let stdout = child_process_1.spawnSync(npmCommand, ["config", "get", "prefix"], options).stdout;
6771 tracer(`'npm config get prefix' didn't return a value.`);
6775 let prefix = stdout.trim();
6777 tracer(`'npm config get prefix' value is: ${prefix}`);
6779 if (prefix.length > 0) {
6781 return path.join(prefix, "node_modules");
6783 return path.join(prefix, "lib", "node_modules");
6790 process.removeListener("SIGPIPE", handler);
6793 exports2.resolveGlobalNodePath = resolveGlobalNodePath;
6794 function resolveGlobalYarnPath(tracer) {
6795 let yarnCommand = "yarn";
6800 yarnCommand = "yarn.cmd";
6801 options.shell = true;
6803 let handler = () => {
6806 process.on("SIGPIPE", handler);
6807 let results = child_process_1.spawnSync(yarnCommand, ["global", "dir", "--json"], options);
6808 let stdout = results.stdout;
6811 tracer(`'yarn global dir' didn't return a value.`);
6812 if (results.stderr) {
6813 tracer(results.stderr);
6818 let lines = stdout.trim().split(/\r?\n/);
6819 for (let line of lines) {
6821 let yarn = JSON.parse(line);
6822 if (yarn.type === "log") {
6823 return path.join(yarn.data, "node_modules");
6832 process.removeListener("SIGPIPE", handler);
6835 exports2.resolveGlobalYarnPath = resolveGlobalYarnPath;
6837 (function(FileSystem2) {
6838 let _isCaseSensitive = void 0;
6839 function isCaseSensitive() {
6840 if (_isCaseSensitive !== void 0) {
6841 return _isCaseSensitive;
6843 if (process.platform === "win32") {
6844 _isCaseSensitive = false;
6846 _isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase());
6848 return _isCaseSensitive;
6850 FileSystem2.isCaseSensitive = isCaseSensitive;
6851 function isParent(parent, child) {
6852 if (isCaseSensitive()) {
6853 return path.normalize(child).indexOf(path.normalize(parent)) === 0;
6855 return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0;
6858 FileSystem2.isParent = isParent;
6859 })(FileSystem = exports2.FileSystem || (exports2.FileSystem = {}));
6860 function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {
6862 if (!path.isAbsolute(nodePath)) {
6863 nodePath = path.join(workspaceRoot, nodePath);
6865 return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
6866 if (FileSystem.isParent(nodePath, value)) {
6869 return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));
6871 }).then(void 0, (_error) => {
6872 return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
6875 return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
6878 exports2.resolveModulePath = resolveModulePath;
6881 // node_modules/vscode-languageserver/node_modules/vscode-languageserver-protocol/node.js
6882 var require_node2 = __commonJS((exports2, module2) => {
6884 module2.exports = require_main3();
6887 // node_modules/vscode-languageserver/lib/common/api.js
6888 var require_api3 = __commonJS((exports2) => {
6890 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
6893 Object.defineProperty(o, k2, {enumerable: true, get: function() {
6896 } : function(o, m, k, k2) {
6901 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
6903 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
6904 __createBinding(exports3, m, p);
6906 Object.defineProperty(exports2, "__esModule", {value: true});
6907 exports2.ProposedFeatures = exports2.SemanticTokensBuilder = void 0;
6908 var semanticTokens_1 = require_semanticTokens();
6909 Object.defineProperty(exports2, "SemanticTokensBuilder", {enumerable: true, get: function() {
6910 return semanticTokens_1.SemanticTokensBuilder;
6912 __exportStar2(require_main3(), exports2);
6913 __exportStar2(require_server(), exports2);
6914 var ProposedFeatures;
6915 (function(ProposedFeatures2) {
6916 ProposedFeatures2.all = {
6919 })(ProposedFeatures = exports2.ProposedFeatures || (exports2.ProposedFeatures = {}));
6922 // node_modules/vscode-languageserver/lib/node/main.js
6923 var require_main4 = __commonJS((exports2) => {
6925 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
6928 Object.defineProperty(o, k2, {enumerable: true, get: function() {
6931 } : function(o, m, k, k2) {
6936 var __exportStar2 = exports2 && exports2.__exportStar || function(m, exports3) {
6938 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
6939 __createBinding(exports3, m, p);
6941 Object.defineProperty(exports2, "__esModule", {value: true});
6942 exports2.createConnection = exports2.Files = void 0;
6943 var Is = require_is();
6944 var server_1 = require_server();
6945 var fm = require_files();
6946 var node_1 = require_node2();
6947 __exportStar2(require_node2(), exports2);
6948 __exportStar2(require_api3(), exports2);
6951 Files2.uriToFilePath = fm.uriToFilePath;
6952 Files2.resolveGlobalNodePath = fm.resolveGlobalNodePath;
6953 Files2.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;
6954 Files2.resolve = fm.resolve;
6955 Files2.resolveModulePath = fm.resolveModulePath;
6956 })(Files = exports2.Files || (exports2.Files = {}));
6957 var _protocolConnection;
6958 function endProtocolConnection() {
6959 if (_protocolConnection === void 0) {
6963 _protocolConnection.end();
6967 var _shutdownReceived = false;
6968 var exitTimer = void 0;
6969 function setupExitTimer() {
6970 const argName = "--clientProcessId";
6971 function runTimer(value) {
6973 let processId = parseInt(value);
6974 if (!isNaN(processId)) {
6975 exitTimer = setInterval(() => {
6977 process.kill(processId, 0);
6979 endProtocolConnection();
6980 process.exit(_shutdownReceived ? 0 : 1);
6987 for (let i = 2; i < process.argv.length; i++) {
6988 let arg = process.argv[i];
6989 if (arg === argName && i + 1 < process.argv.length) {
6990 runTimer(process.argv[i + 1]);
6993 let args = arg.split("=");
6994 if (args[0] === argName) {
7002 initialize: (params) => {
7003 const processId = params.processId;
7004 if (Is.number(processId) && exitTimer === void 0) {
7007 process.kill(processId, 0);
7009 process.exit(_shutdownReceived ? 0 : 1);
7014 get shutdownReceived() {
7015 return _shutdownReceived;
7017 set shutdownReceived(value) {
7018 _shutdownReceived = value;
7021 endProtocolConnection();
7025 function createConnection(arg1, arg2, arg3, arg4) {
7030 if (arg1 !== void 0 && arg1.__brand === "features") {
7036 if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) {
7043 return _createConnection(input, output, options, factories);
7045 exports2.createConnection = createConnection;
7046 function _createConnection(input, output, options, factories) {
7047 if (!input && !output && process.argv.length > 2) {
7049 let pipeName = void 0;
7050 let argv = process.argv.slice(2);
7051 for (let i = 0; i < argv.length; i++) {
7053 if (arg === "--node-ipc") {
7054 input = new node_1.IPCMessageReader(process);
7055 output = new node_1.IPCMessageWriter(process);
7057 } else if (arg === "--stdio") {
7058 input = process.stdin;
7059 output = process.stdout;
7061 } else if (arg === "--socket") {
7062 port = parseInt(argv[i + 1]);
7064 } else if (arg === "--pipe") {
7065 pipeName = argv[i + 1];
7068 var args = arg.split("=");
7069 if (args[0] === "--socket") {
7070 port = parseInt(args[1]);
7072 } else if (args[0] === "--pipe") {
7079 let transport = node_1.createServerSocketTransport(port);
7080 input = transport[0];
7081 output = transport[1];
7082 } else if (pipeName) {
7083 let transport = node_1.createServerPipeTransport(pipeName);
7084 input = transport[0];
7085 output = transport[1];
7088 var commandLineMessage = "Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";
7090 throw new Error("Connection input stream is not set. " + commandLineMessage);
7093 throw new Error("Connection output stream is not set. " + commandLineMessage);
7095 if (Is.func(input.read) && Is.func(input.on)) {
7096 let inputStream = input;
7097 inputStream.on("end", () => {
7098 endProtocolConnection();
7099 process.exit(_shutdownReceived ? 0 : 1);
7101 inputStream.on("close", () => {
7102 endProtocolConnection();
7103 process.exit(_shutdownReceived ? 0 : 1);
7106 const connectionFactory = (logger) => {
7107 const result = node_1.createProtocolConnection(input, output, logger, options);
7110 return server_1.createConnection(connectionFactory, watchDog, factories);
7114 // node_modules/vscode-languageserver/node.js
7115 var require_node3 = __commonJS((exports2, module2) => {
7117 module2.exports = require_main4();
7120 // server/eslintServer.ts
7121 var require_eslintServer = __commonJS(() => {
7122 var import_node = __toModule(require_node3());
7123 var path = __toModule(require("path"));
7124 var fs = __toModule(require("fs"));
7125 var import_child_process = __toModule(require("child_process"));
7126 var import_os = __toModule(require("os"));
7130 const toString = Object.prototype.toString;
7131 function boolean(value) {
7132 return value === true || value === false;
7134 Is2.boolean = boolean;
7135 function nullOrUndefined(value) {
7136 return value === null || value === void 0;
7138 Is2.nullOrUndefined = nullOrUndefined;
7139 function string(value) {
7140 return toString.call(value) === "[object String]";
7142 Is2.string = string;
7143 })(Is || (Is = {}));
7145 (function(CommandIds2) {
7146 CommandIds2.applySingleFix = "eslint.applySingleFix";
7147 CommandIds2.applySuggestion = "eslint.applySuggestion";
7148 CommandIds2.applySameFixes = "eslint.applySameFixes";
7149 CommandIds2.applyAllFixes = "eslint.applyAllFixes";
7150 CommandIds2.applyDisableLine = "eslint.applyDisableLine";
7151 CommandIds2.applyDisableFile = "eslint.applyDisableFile";
7152 CommandIds2.openRuleDoc = "eslint.openRuleDoc";
7153 })(CommandIds || (CommandIds = {}));
7155 (function(Status2) {
7156 Status2[Status2["ok"] = 1] = "ok";
7157 Status2[Status2["warn"] = 2] = "warn";
7158 Status2[Status2["error"] = 3] = "error";
7159 Status2[Status2["confirmationPending"] = 4] = "confirmationPending";
7160 Status2[Status2["confirmationCanceled"] = 5] = "confirmationCanceled";
7161 Status2[Status2["executionDenied"] = 6] = "executionDenied";
7162 })(Status || (Status = {}));
7163 var StatusNotification;
7164 (function(StatusNotification2) {
7165 StatusNotification2.type = new import_node.NotificationType("eslint/status");
7166 })(StatusNotification || (StatusNotification = {}));
7167 var NoConfigRequest;
7168 (function(NoConfigRequest2) {
7169 NoConfigRequest2.type = new import_node.RequestType("eslint/noConfig");
7170 })(NoConfigRequest || (NoConfigRequest = {}));
7171 var NoESLintLibraryRequest;
7172 (function(NoESLintLibraryRequest2) {
7173 NoESLintLibraryRequest2.type = new import_node.RequestType("eslint/noLibrary");
7174 })(NoESLintLibraryRequest || (NoESLintLibraryRequest = {}));
7175 var OpenESLintDocRequest;
7176 (function(OpenESLintDocRequest2) {
7177 OpenESLintDocRequest2.type = new import_node.RequestType("eslint/openDoc");
7178 })(OpenESLintDocRequest || (OpenESLintDocRequest = {}));
7179 var ProbeFailedRequest;
7180 (function(ProbeFailedRequest2) {
7181 ProbeFailedRequest2.type = new import_node.RequestType("eslint/probeFailed");
7182 })(ProbeFailedRequest || (ProbeFailedRequest = {}));
7183 var ConfirmExecutionResult;
7184 (function(ConfirmExecutionResult2) {
7185 ConfirmExecutionResult2[ConfirmExecutionResult2["deny"] = 1] = "deny";
7186 ConfirmExecutionResult2[ConfirmExecutionResult2["confirmationPending"] = 2] = "confirmationPending";
7187 ConfirmExecutionResult2[ConfirmExecutionResult2["confirmationCanceled"] = 3] = "confirmationCanceled";
7188 ConfirmExecutionResult2[ConfirmExecutionResult2["approved"] = 4] = "approved";
7189 })(ConfirmExecutionResult || (ConfirmExecutionResult = {}));
7190 (function(ConfirmExecutionResult2) {
7191 function toStatus(value) {
7193 case ConfirmExecutionResult2.deny:
7195 case ConfirmExecutionResult2.confirmationPending:
7197 case ConfirmExecutionResult2.confirmationCanceled:
7199 case ConfirmExecutionResult2.approved:
7203 ConfirmExecutionResult2.toStatus = toStatus;
7204 })(ConfirmExecutionResult || (ConfirmExecutionResult = {}));
7205 var ConfirmExecution;
7206 (function(ConfirmExecution2) {
7207 ConfirmExecution2.type = new import_node.RequestType("eslint/confirmESLintExecution");
7208 })(ConfirmExecution || (ConfirmExecution = {}));
7209 var ShowOutputChannel;
7210 (function(ShowOutputChannel2) {
7211 ShowOutputChannel2.type = new import_node.NotificationType0("eslint/showOutputChannel");
7212 })(ShowOutputChannel || (ShowOutputChannel = {}));
7214 (function(ModeEnum2) {
7215 ModeEnum2["auto"] = "auto";
7216 ModeEnum2["location"] = "location";
7217 })(ModeEnum || (ModeEnum = {}));
7218 (function(ModeEnum2) {
7219 function is(value) {
7220 return value === ModeEnum2.auto || value === ModeEnum2.location;
7223 })(ModeEnum || (ModeEnum = {}));
7225 (function(ModeItem2) {
7227 const candidate = item;
7228 return candidate && ModeEnum.is(candidate.mode);
7231 })(ModeItem || (ModeItem = {}));
7233 (function(DirectoryItem2) {
7235 const candidate = item;
7236 return candidate && Is.string(candidate.directory) && (Is.boolean(candidate["!cwd"]) || candidate["!cwd"] === void 0);
7238 DirectoryItem2.is = is;
7239 })(DirectoryItem || (DirectoryItem = {}));
7241 (function(Validate2) {
7242 Validate2["on"] = "on";
7243 Validate2["off"] = "off";
7244 Validate2["probe"] = "probe";
7245 })(Validate || (Validate = {}));
7247 (function(ESLintSeverity2) {
7248 ESLintSeverity2["off"] = "off";
7249 ESLintSeverity2["warn"] = "warn";
7250 ESLintSeverity2["error"] = "error";
7251 })(ESLintSeverity || (ESLintSeverity = {}));
7252 var CodeActionsOnSaveMode;
7253 (function(CodeActionsOnSaveMode2) {
7254 CodeActionsOnSaveMode2["all"] = "all";
7255 CodeActionsOnSaveMode2["problems"] = "problems";
7256 })(CodeActionsOnSaveMode || (CodeActionsOnSaveMode = {}));
7257 var TextDocumentSettings;
7258 (function(TextDocumentSettings2) {
7259 function hasLibrary(settings) {
7260 return settings.library !== void 0;
7262 TextDocumentSettings2.hasLibrary = hasLibrary;
7263 })(TextDocumentSettings || (TextDocumentSettings = {}));
7265 (function(RuleData2) {
7266 function hasMetaType(value) {
7267 return value !== void 0 && value.meta !== void 0 && value.meta.type !== void 0;
7269 RuleData2.hasMetaType = hasMetaType;
7270 })(RuleData || (RuleData = {}));
7272 (function(CLIEngine2) {
7273 function hasRule(value) {
7274 return value.getRules !== void 0;
7276 CLIEngine2.hasRule = hasRule;
7277 })(CLIEngine || (CLIEngine = {}));
7278 function loadNodeModule(moduleName) {
7280 return require(moduleName);
7282 connection.console.error(err.stack.toString());
7286 function makeDiagnostic(problem) {
7287 const message = problem.message;
7288 const startLine = Is.nullOrUndefined(problem.line) ? 0 : Math.max(0, problem.line - 1);
7289 const startChar = Is.nullOrUndefined(problem.column) ? 0 : Math.max(0, problem.column - 1);
7290 const endLine = Is.nullOrUndefined(problem.endLine) ? startLine : Math.max(0, problem.endLine - 1);
7291 const endChar = Is.nullOrUndefined(problem.endColumn) ? startChar : Math.max(0, problem.endColumn - 1);
7294 severity: convertSeverity(problem.severity),
7297 start: {line: startLine, character: startChar},
7298 end: {line: endLine, character: endChar}
7301 if (problem.ruleId) {
7302 const url = ruleDocData.urls.get(problem.ruleId);
7303 result.code = problem.ruleId;
7304 if (url !== void 0) {
7305 result.codeDescription = {
7309 if (problem.ruleId === "no-unused-vars") {
7310 result.tags = [import_node.DiagnosticTag.Unnecessary];
7316 (function(Problem2) {
7317 function isFixable(problem) {
7318 return problem.edit !== void 0;
7320 Problem2.isFixable = isFixable;
7321 function hasSuggestions(problem) {
7322 return problem.suggestions !== void 0;
7324 Problem2.hasSuggestions = hasSuggestions;
7325 })(Problem || (Problem = {}));
7327 (function(FixableProblem2) {
7328 function createTextEdit(document, editInfo) {
7329 return import_node.TextEdit.replace(import_node.Range.create(document.positionAt(editInfo.edit.range[0]), document.positionAt(editInfo.edit.range[1])), editInfo.edit.text || "");
7331 FixableProblem2.createTextEdit = createTextEdit;
7332 })(FixableProblem || (FixableProblem = {}));
7333 var SuggestionsProblem;
7334 (function(SuggestionsProblem2) {
7335 function createTextEdit(document, suggestion) {
7336 return import_node.TextEdit.replace(import_node.Range.create(document.positionAt(suggestion.fix.range[0]), document.positionAt(suggestion.fix.range[1])), suggestion.fix.text || "");
7338 SuggestionsProblem2.createTextEdit = createTextEdit;
7339 })(SuggestionsProblem || (SuggestionsProblem = {}));
7340 function computeKey(diagnostic) {
7341 const range = diagnostic.range;
7342 return `[${range.start.line},${range.start.character},${range.end.line},${range.end.character}]-${diagnostic.code}`;
7344 var codeActions = new Map();
7345 function recordCodeAction(document, diagnostic, problem) {
7346 if (!problem.ruleId) {
7349 const uri = document.uri;
7350 let edits = codeActions.get(uri);
7351 if (edits === void 0) {
7353 codeActions.set(uri, edits);
7355 edits.set(computeKey(diagnostic), {
7356 label: `Fix this ${problem.ruleId} problem`,
7357 documentVersion: document.version,
7358 ruleId: problem.ruleId,
7362 suggestions: problem.suggestions
7365 function convertSeverity(severity) {
7368 return import_node.DiagnosticSeverity.Warning;
7370 return import_node.DiagnosticSeverity.Error;
7372 return import_node.DiagnosticSeverity.Error;
7376 (function(CharCode2) {
7377 CharCode2[CharCode2["Backslash"] = 92] = "Backslash";
7378 })(CharCode || (CharCode = {}));
7379 function isUNC(path2) {
7380 if (process.platform !== "win32") {
7383 if (!path2 || path2.length < 5) {
7386 let code = path2.charCodeAt(0);
7390 code = path2.charCodeAt(1);
7396 for (; pos < path2.length; pos++) {
7397 code = path2.charCodeAt(pos);
7402 if (start === pos) {
7405 code = path2.charCodeAt(pos + 1);
7406 if (isNaN(code) || code === 92) {
7411 function getFileSystemPath(uri) {
7412 let result = uri.fsPath;
7413 if (process.platform === "win32" && result.length >= 2 && result[1] === ":") {
7414 result = result[0].toUpperCase() + result.substr(1);
7416 if (!fs.existsSync(result)) {
7419 if (process.platform === "win32" || process.platform === "darwin") {
7420 const realpath = fs.realpathSync.native(result);
7421 if (realpath.toLowerCase() === result.toLowerCase()) {
7427 function getFilePath(documentOrUri) {
7428 if (!documentOrUri) {
7431 const uri = Is.string(documentOrUri) ? URI.parse(documentOrUri) : documentOrUri instanceof URI ? documentOrUri : URI.parse(documentOrUri.uri);
7432 if (uri.scheme !== "file") {
7435 return getFileSystemPath(uri);
7437 var exitCalled = new import_node.NotificationType("eslint/exitCalled");
7438 var nodeExit = process.exit;
7439 process.exit = (code) => {
7440 const stack = new Error("stack");
7441 connection.sendNotification(exitCalled, [code ? code : 0, stack.stack]);
7446 process.on("uncaughtException", (error) => {
7449 if (typeof error.stack === "string") {
7450 message = error.stack;
7451 } else if (typeof error.message === "string") {
7452 message = error.message;
7453 } else if (typeof error === "string") {
7456 if (message === void 0 || message.length === 0) {
7458 message = JSON.stringify(error, void 0, 4);
7463 console.error("Uncaught exception received.");
7465 console.error(message);
7468 var connection = import_node.createConnection();
7469 connection.console.info(`ESLint server running in node ${process.version}`);
7471 var _globalPaths = {
7475 return import_node.Files.resolveGlobalYarnPath(trace);
7481 return import_node.Files.resolveGlobalNodePath(trace);
7487 const pnpmPath = import_child_process.execSync("pnpm root -g").toString().trim();
7492 function globalPathGet(packageManager) {
7493 const pm = _globalPaths[packageManager];
7495 if (pm.cache === void 0) {
7496 pm.cache = pm.get();
7502 var languageId2DefaultExt = new Map([
7503 ["javascript", "js"],
7504 ["javascriptreact", "jsx"],
7505 ["typescript", "ts"],
7506 ["typescriptreact", "tsx"],
7510 var languageId2ParserRegExp = function createLanguageId2ParserRegExp() {
7511 const result = new Map();
7512 const typescript = /\/@typescript-eslint\/parser\//;
7513 const babelESLint = /\/babel-eslint\/lib\/index.js$/;
7514 result.set("typescript", [typescript, babelESLint]);
7515 result.set("typescriptreact", [typescript, babelESLint]);
7518 var languageId2ParserOptions = function createLanguageId2ParserOptionsRegExp() {
7519 const result = new Map();
7520 const vue = /vue-eslint-parser\/.*\.js$/;
7521 const typescriptEslintParser = /@typescript-eslint\/parser\/.*\.js$/;
7522 result.set("typescript", {regExps: [vue], parsers: new Set(["@typescript-eslint/parser"]), parserRegExps: [typescriptEslintParser]});
7525 var languageId2PluginName = new Map([
7528 ["markdown", "markdown"]
7530 var defaultLanguageIds = new Set([
7534 var path2Library = new Map();
7535 var document2Settings = new Map();
7536 var executionConfirmations = new Map();
7537 var projectFolderIndicators = [
7538 ["package.json", true],
7539 [".eslintignore", true],
7540 [".eslintrc", false],
7541 [".eslintrc.json", false],
7542 [".eslintrc.js", false],
7543 [".eslintrc.yaml", false],
7544 [".eslintrc.yml", false]
7546 function findWorkingDirectory(workspaceFolder, file) {
7547 if (file === void 0 || isUNC(file)) {
7548 return workspaceFolder;
7550 if (file.indexOf(`${path.sep}node_modules${path.sep}`) !== -1) {
7551 return workspaceFolder;
7553 let result = workspaceFolder;
7554 let directory = path.dirname(file);
7556 while (directory !== void 0 && directory.startsWith(workspaceFolder)) {
7557 for (const item of projectFolderIndicators) {
7558 if (fs.existsSync(path.join(directory, item[0]))) {
7567 const parent = path.dirname(directory);
7568 directory = parent !== directory ? parent : void 0;
7572 function resolveSettings(document) {
7573 const uri = document.uri;
7574 let resultPromise = document2Settings.get(uri);
7575 if (resultPromise) {
7576 return resultPromise;
7578 resultPromise = connection.workspace.getConfiguration({scopeUri: uri, section: ""}).then((configuration) => {
7580 const settings = Object.assign({}, configuration, {silent: false, library: void 0, resolvedGlobalPackageManagerPath: void 0}, {workingDirectory: void 0});
7581 if (settings.validate === Validate.off) {
7584 settings.resolvedGlobalPackageManagerPath = globalPathGet(settings.packageManager);
7585 const filePath = getFilePath(document);
7586 const workspaceFolderPath = settings.workspaceFolder !== void 0 ? getFilePath(settings.workspaceFolder.uri) : void 0;
7587 const hasUserDefinedWorkingDirectories = configuration.workingDirectory !== void 0;
7588 const workingDirectoryConfig = (_a2 = configuration.workingDirectory) != null ? _a2 : {mode: ModeEnum.location};
7589 if (ModeItem.is(workingDirectoryConfig)) {
7591 if (workingDirectoryConfig.mode === ModeEnum.location) {
7592 if (workspaceFolderPath !== void 0) {
7593 candidate = workspaceFolderPath;
7594 } else if (filePath !== void 0 && !isUNC(filePath)) {
7595 candidate = path.dirname(filePath);
7597 } else if (workingDirectoryConfig.mode === ModeEnum.auto) {
7598 if (workspaceFolderPath !== void 0) {
7599 candidate = findWorkingDirectory(workspaceFolderPath, filePath);
7600 } else if (filePath !== void 0 && !isUNC(filePath)) {
7601 candidate = path.dirname(filePath);
7604 if (candidate !== void 0 && fs.existsSync(candidate)) {
7605 settings.workingDirectory = {directory: candidate};
7608 settings.workingDirectory = workingDirectoryConfig;
7612 if (settings.nodePath !== null) {
7613 nodePath = settings.nodePath;
7614 if (!path.isAbsolute(nodePath) && settings.workspaceFolder !== void 0) {
7615 const workspaceFolderPath2 = getFilePath(settings.workspaceFolder.uri);
7616 if (workspaceFolderPath2 !== void 0) {
7617 nodePath = path.join(workspaceFolderPath2, nodePath);
7621 let moduleResolveWorkingDirectory;
7622 if (!hasUserDefinedWorkingDirectories && filePath !== void 0) {
7623 moduleResolveWorkingDirectory = path.dirname(filePath);
7625 if (moduleResolveWorkingDirectory === void 0 && settings.workingDirectory !== void 0 && !settings.workingDirectory["!cwd"]) {
7626 moduleResolveWorkingDirectory = settings.workingDirectory.directory;
7628 if (nodePath !== void 0) {
7629 promise = import_node.Files.resolve("eslint", nodePath, nodePath, trace).then(void 0, () => {
7630 return import_node.Files.resolve("eslint", settings.resolvedGlobalPackageManagerPath, moduleResolveWorkingDirectory, trace);
7633 promise = import_node.Files.resolve("eslint", settings.resolvedGlobalPackageManagerPath, moduleResolveWorkingDirectory, trace);
7635 settings.silent = settings.validate === Validate.probe;
7636 return promise.then((libraryPath) => {
7637 const scope = settings.resolvedGlobalPackageManagerPath !== void 0 && libraryPath.startsWith(settings.resolvedGlobalPackageManagerPath) ? "global" : "local";
7638 const cachedExecutionConfirmation = executionConfirmations.get(libraryPath);
7639 const confirmationPromise = cachedExecutionConfirmation === void 0 ? connection.sendRequest(ConfirmExecution.type, {scope, uri, libraryPath}) : Promise.resolve(cachedExecutionConfirmation);
7640 return confirmationPromise.then((confirmed) => {
7642 if (confirmed !== 4) {
7643 settings.validate = Validate.off;
7644 connection.sendDiagnostics({uri, diagnostics: []});
7645 connection.sendNotification(StatusNotification.type, {uri, state: ConfirmExecutionResult.toStatus(confirmed)});
7648 executionConfirmations.set(libraryPath, confirmed);
7650 let library = path2Library.get(libraryPath);
7651 if (library === void 0) {
7652 library = loadNodeModule(libraryPath);
7653 if (library === void 0) {
7654 settings.validate = Validate.off;
7655 if (!settings.silent) {
7656 connection.console.error(`Failed to load eslint library from ${libraryPath}. See output panel for more information.`);
7658 } else if (library.CLIEngine === void 0) {
7659 settings.validate = Validate.off;
7660 connection.console.error(`The eslint library loaded from ${libraryPath} doesn't export a CLIEngine. You need at least eslint@1.0.0`);
7662 connection.console.info(`ESLint library loaded from: ${libraryPath}`);
7663 settings.library = library;
7664 path2Library.set(libraryPath, library);
7667 settings.library = library;
7669 if (settings.validate === Validate.probe && TextDocumentSettings.hasLibrary(settings)) {
7670 settings.validate = Validate.off;
7671 const uri2 = URI.parse(document.uri);
7672 let filePath2 = getFilePath(document);
7673 if (filePath2 === void 0 && uri2.scheme === "untitled" && settings.workspaceFolder !== void 0) {
7674 const ext = languageId2DefaultExt.get(document.languageId);
7675 const workspacePath = getFilePath(settings.workspaceFolder.uri);
7676 if (workspacePath !== void 0 && ext !== void 0) {
7677 filePath2 = path.join(workspacePath, `test${ext}`);
7680 if (filePath2 !== void 0) {
7681 const parserRegExps = languageId2ParserRegExp.get(document.languageId);
7682 const pluginName = languageId2PluginName.get(document.languageId);
7683 const parserOptions = languageId2ParserOptions.get(document.languageId);
7684 if (defaultLanguageIds.has(document.languageId)) {
7685 settings.validate = Validate.on;
7686 } else if (parserRegExps !== void 0 || pluginName !== void 0 || parserOptions !== void 0) {
7687 const eslintConfig = withCLIEngine((cli) => {
7689 if (typeof cli.getConfigForFile === "function") {
7690 return cli.getConfigForFile(filePath2);
7698 if (eslintConfig !== void 0) {
7699 const parser = eslintConfig.parser !== null ? process.platform === "win32" ? eslintConfig.parser.replace(/\\/g, "/") : eslintConfig.parser : void 0;
7700 if (parser !== void 0) {
7701 if (parserRegExps !== void 0) {
7702 for (const regExp of parserRegExps) {
7703 if (regExp.test(parser)) {
7704 settings.validate = Validate.on;
7709 if (settings.validate !== Validate.on && parserOptions !== void 0 && typeof ((_a3 = eslintConfig.parserOptions) == null ? void 0 : _a3.parser) === "string") {
7710 for (const regExp of parserOptions.regExps) {
7711 if (regExp.test(parser) && (parserOptions.parsers.has(eslintConfig.parserOptions.parser) || parserOptions.parserRegExps !== void 0 && parserOptions.parserRegExps.some((parserRegExp) => parserRegExp.test(eslintConfig.parserOptions.parser)))) {
7712 settings.validate = Validate.on;
7718 if (settings.validate !== Validate.on && Array.isArray(eslintConfig.plugins) && eslintConfig.plugins.length > 0 && pluginName !== void 0) {
7719 for (const name of eslintConfig.plugins) {
7720 if (name === pluginName) {
7721 settings.validate = Validate.on;
7729 if (settings.validate === Validate.off) {
7730 const params = {textDocument: {uri: document.uri}};
7731 connection.sendRequest(ProbeFailedRequest.type, params);
7734 if (settings.format && settings.validate === Validate.on && TextDocumentSettings.hasLibrary(settings)) {
7735 const Uri = URI.parse(uri);
7736 const isFile = Uri.scheme === "file";
7737 let pattern = isFile ? Uri.fsPath.replace(/\\/g, "/") : Uri.fsPath;
7738 pattern = pattern.replace(/[\[\]\{\}]/g, "?");
7739 const filter = {scheme: Uri.scheme, pattern};
7740 const options = {documentSelector: [filter]};
7742 formatterRegistrations.set(uri, connection.client.register(import_node.DocumentFormattingRequest.type, options));
7744 const filePath2 = getFilePath(uri);
7745 withCLIEngine((cli) => {
7746 if (!cli.isPathIgnored(filePath2)) {
7747 formatterRegistrations.set(uri, connection.client.register(import_node.DocumentFormattingRequest.type, options));
7755 settings.validate = Validate.off;
7756 if (!settings.silent) {
7757 connection.sendRequest(NoESLintLibraryRequest.type, {source: {uri: document.uri}});
7762 document2Settings.set(uri, resultPromise);
7763 return resultPromise;
7766 (function(Request2) {
7767 function is(value) {
7768 const candidate = value;
7769 return candidate && candidate.token !== void 0 && candidate.resolve !== void 0 && candidate.reject !== void 0;
7772 })(Request || (Request = {}));
7774 (function(Thenable2) {
7775 function is(value) {
7776 const candidate = value;
7777 return candidate && typeof candidate.then === "function";
7780 })(Thenable || (Thenable = {}));
7781 var BufferedMessageQueue = class {
7782 constructor(connection2) {
7783 this.connection = connection2;
7785 this.requestHandlers = new Map();
7786 this.notificationHandlers = new Map();
7788 registerRequest(type, handler, versionProvider) {
7789 this.connection.onRequest(type, (params, token) => {
7790 return new Promise((resolve, reject) => {
7792 method: type.method,
7794 documentVersion: versionProvider ? versionProvider(params) : void 0,
7802 this.requestHandlers.set(type.method, {handler, versionProvider});
7804 registerNotification(type, handler, versionProvider) {
7805 connection.onNotification(type, (params) => {
7807 method: type.method,
7809 documentVersion: versionProvider ? versionProvider(params) : void 0
7813 this.notificationHandlers.set(type.method, {handler, versionProvider});
7815 addNotificationMessage(type, params, version) {
7817 method: type.method,
7819 documentVersion: version
7823 onNotification(type, handler, versionProvider) {
7824 this.notificationHandlers.set(type.method, {handler, versionProvider});
7827 if (this.timer || this.queue.length === 0) {
7830 this.timer = setImmediate(() => {
7831 this.timer = void 0;
7832 this.processQueue();
7837 const message = this.queue.shift();
7841 if (Request.is(message)) {
7842 const requestMessage = message;
7843 if (requestMessage.token.isCancellationRequested) {
7844 requestMessage.reject(new import_node.ResponseError(import_node.LSPErrorCodes.RequestCancelled, "Request got cancelled"));
7847 const elem = this.requestHandlers.get(requestMessage.method);
7848 if (elem === void 0) {
7849 throw new Error(`No handler registered`);
7851 if (elem.versionProvider && requestMessage.documentVersion !== void 0 && requestMessage.documentVersion !== elem.versionProvider(requestMessage.params)) {
7852 requestMessage.reject(new import_node.ResponseError(import_node.LSPErrorCodes.RequestCancelled, "Request got cancelled"));
7855 const result = elem.handler(requestMessage.params, requestMessage.token);
7856 if (Thenable.is(result)) {
7857 result.then((value) => {
7858 requestMessage.resolve(value);
7860 requestMessage.reject(error);
7863 requestMessage.resolve(result);
7866 const notificationMessage = message;
7867 const elem = this.notificationHandlers.get(notificationMessage.method);
7868 if (elem === void 0) {
7869 throw new Error(`No handler registered`);
7871 if (elem.versionProvider && notificationMessage.documentVersion !== void 0 && notificationMessage.documentVersion !== elem.versionProvider(notificationMessage.params)) {
7874 elem.handler(notificationMessage.params);
7878 var messageQueue = new BufferedMessageQueue(connection);
7879 var formatterRegistrations = new Map();
7880 var ValidateNotification;
7881 (function(ValidateNotification2) {
7882 ValidateNotification2.type = new import_node.NotificationType("eslint/validate");
7883 })(ValidateNotification || (ValidateNotification = {}));
7884 messageQueue.onNotification(ValidateNotification.type, (document) => {
7885 validateSingle(document, true);
7887 return document.version;
7889 function setupDocumentsListeners() {
7890 documents.listen(connection);
7891 documents.onDidOpen((event) => {
7892 resolveSettings(event.document).then((settings) => {
7893 if (settings.validate !== Validate.on || !TextDocumentSettings.hasLibrary(settings)) {
7896 if (settings.run === "onSave") {
7897 messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
7901 documents.onDidChangeContent((event) => {
7902 const uri = event.document.uri;
7903 codeActions.delete(uri);
7904 resolveSettings(event.document).then((settings) => {
7905 if (settings.validate !== Validate.on || settings.run !== "onType") {
7908 messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
7911 documents.onDidSave((event) => {
7912 resolveSettings(event.document).then((settings) => {
7913 if (settings.validate !== Validate.on || settings.run !== "onSave") {
7916 messageQueue.addNotificationMessage(ValidateNotification.type, event.document, event.document.version);
7919 documents.onDidClose((event) => {
7920 resolveSettings(event.document).then((settings) => {
7921 const uri = event.document.uri;
7922 document2Settings.delete(uri);
7923 codeActions.delete(uri);
7924 const unregister = formatterRegistrations.get(event.document.uri);
7925 if (unregister !== void 0) {
7926 unregister.then((disposable) => disposable.dispose());
7927 formatterRegistrations.delete(event.document.uri);
7929 if (settings.validate === Validate.on) {
7930 connection.sendDiagnostics({uri, diagnostics: []});
7935 function environmentChanged() {
7936 document2Settings.clear();
7937 executionConfirmations.clear();
7938 for (let document of documents.all()) {
7939 messageQueue.addNotificationMessage(ValidateNotification.type, document, document.version);
7941 for (const unregistration of formatterRegistrations.values()) {
7942 unregistration.then((disposable) => disposable.dispose());
7944 formatterRegistrations.clear();
7946 function trace(message, verbose) {
7947 connection.tracer.log(message, verbose);
7949 connection.onInitialize((_params, _cancel, progress) => {
7950 progress.begin("Initializing ESLint Server");
7951 const syncKind = import_node.TextDocumentSyncKind.Incremental;
7952 documents = new import_node.TextDocuments(TextDocument);
7953 setupDocumentsListeners();
7960 willSaveWaitUntil: false,
7970 codeActionProvider: {codeActionKinds: [import_node.CodeActionKind.QuickFix, `${import_node.CodeActionKind.SourceFixAll}.eslint`]},
7971 executeCommandProvider: {
7973 CommandIds.applySingleFix,
7974 CommandIds.applySuggestion,
7975 CommandIds.applySameFixes,
7976 CommandIds.applyAllFixes,
7977 CommandIds.applyDisableLine,
7978 CommandIds.applyDisableFile,
7979 CommandIds.openRuleDoc
7985 connection.onInitialized(() => {
7986 connection.client.register(import_node.DidChangeConfigurationNotification.type, void 0);
7987 connection.client.register(import_node.DidChangeWorkspaceFoldersNotification.type, void 0);
7989 messageQueue.registerNotification(import_node.DidChangeConfigurationNotification.type, (_params) => {
7990 environmentChanged();
7992 messageQueue.registerNotification(import_node.DidChangeWorkspaceFoldersNotification.type, (_params) => {
7993 environmentChanged();
7995 var singleErrorHandlers = [
7997 tryHandleConfigError,
7998 tryHandleMissingModule,
8001 function validateSingle(document, publishDiagnostics = true) {
8002 if (!documents.get(document.uri)) {
8003 return Promise.resolve(void 0);
8005 return resolveSettings(document).then((settings) => {
8006 if (settings.validate !== Validate.on || !TextDocumentSettings.hasLibrary(settings)) {
8010 validate(document, settings, publishDiagnostics);
8011 connection.sendNotification(StatusNotification.type, {uri: document.uri, state: 1});
8013 connection.sendDiagnostics({uri: document.uri, diagnostics: []});
8014 if (!settings.silent) {
8015 let status = void 0;
8016 for (let handler of singleErrorHandlers) {
8017 status = handler(err, document, settings.library);
8022 status = status || 3;
8023 connection.sendNotification(StatusNotification.type, {uri: document.uri, state: status});
8025 connection.console.info(getMessage(err, document));
8026 connection.sendNotification(StatusNotification.type, {uri: document.uri, state: 1});
8031 function validateMany(documents2) {
8032 documents2.forEach((document) => {
8033 messageQueue.addNotificationMessage(ValidateNotification.type, document, document.version);
8036 function getMessage(err, document) {
8037 let result = void 0;
8038 if (typeof err.message === "string" || err.message instanceof String) {
8039 result = err.message;
8040 result = result.replace(/\r?\n/g, " ");
8041 if (/^CLI: /.test(result)) {
8042 result = result.substr(5);
8045 result = `An unknown error occurred while validating document: ${document.uri}`;
8053 var validFixTypes = new Set(["problem", "suggestion", "layout"]);
8054 function validate(document, settings, publishDiagnostics = true) {
8055 const newOptions = Object.assign(Object.create(null), settings.options);
8056 let fixTypes = void 0;
8057 if (Array.isArray(newOptions.fixTypes) && newOptions.fixTypes.length > 0) {
8058 fixTypes = new Set();
8059 for (let item of newOptions.fixTypes) {
8060 if (validFixTypes.has(item)) {
8064 if (fixTypes.size === 0) {
8068 const content = document.getText();
8069 const uri = document.uri;
8070 const file = getFilePath(document);
8071 withCLIEngine((cli) => {
8072 codeActions.delete(uri);
8073 const report = cli.executeOnText(content, file, settings.onIgnoredFiles !== ESLintSeverity.off);
8074 if (CLIEngine.hasRule(cli) && !ruleDocData.handled.has(uri)) {
8075 ruleDocData.handled.add(uri);
8076 cli.getRules().forEach((rule, key) => {
8077 if (rule.meta && rule.meta.docs && Is.string(rule.meta.docs.url)) {
8078 ruleDocData.urls.set(key, rule.meta.docs.url);
8082 const diagnostics = [];
8083 if (report && report.results && Array.isArray(report.results) && report.results.length > 0) {
8084 const docReport = report.results[0];
8085 if (docReport.messages && Array.isArray(docReport.messages)) {
8086 docReport.messages.forEach((problem) => {
8088 const isWarning = convertSeverity(problem.severity) === import_node.DiagnosticSeverity.Warning;
8089 if (settings.quiet && isWarning) {
8092 const diagnostic = makeDiagnostic(problem);
8093 diagnostics.push(diagnostic);
8094 if (fixTypes !== void 0 && CLIEngine.hasRule(cli) && problem.ruleId !== void 0 && problem.fix !== void 0) {
8095 const rule = cli.getRules().get(problem.ruleId);
8096 if (RuleData.hasMetaType(rule) && fixTypes.has(rule.meta.type)) {
8097 recordCodeAction(document, diagnostic, problem);
8100 recordCodeAction(document, diagnostic, problem);
8106 if (publishDiagnostics) {
8107 connection.sendDiagnostics({uri, diagnostics});
8111 function withCLIEngine(func, settings, options) {
8112 const newOptions = options === void 0 ? Object.assign(Object.create(null), settings.options) : Object.assign(Object.create(null), settings.options, options);
8113 const cwd = process.cwd();
8115 if (settings.workingDirectory) {
8116 newOptions.cwd = settings.workingDirectory.directory;
8117 if (settings.workingDirectory["!cwd"] !== true && fs.existsSync(settings.workingDirectory.directory)) {
8118 process.chdir(settings.workingDirectory.directory);
8121 const cli = new settings.library.CLIEngine(newOptions);
8124 if (cwd !== process.cwd()) {
8129 var noConfigReported = new Map();
8130 function isNoConfigFoundError(error) {
8131 const candidate = error;
8132 return candidate.messageTemplate === "no-config-found" || candidate.message === "No ESLint configuration found.";
8134 function tryHandleNoConfig(error, document, library) {
8135 if (!isNoConfigFoundError(error)) {
8138 if (!noConfigReported.has(document.uri)) {
8139 connection.sendRequest(NoConfigRequest.type, {
8140 message: getMessage(error, document),
8144 }).then(void 0, () => {
8146 noConfigReported.set(document.uri, library);
8150 var configErrorReported = new Map();
8151 function tryHandleConfigError(error, document, library) {
8152 if (!error.message) {
8155 function handleFileName(filename) {
8156 if (!configErrorReported.has(filename)) {
8157 connection.console.error(getMessage(error, document));
8158 if (!documents.get(URI.file(filename).toString())) {
8159 connection.window.showInformationMessage(getMessage(error, document));
8161 configErrorReported.set(filename, library);
8165 let matches = /Cannot read config file:\s+(.*)\nError:\s+(.*)/.exec(error.message);
8166 if (matches && matches.length === 3) {
8167 return handleFileName(matches[1]);
8169 matches = /(.*):\n\s*Configuration for rule \"(.*)\" is /.exec(error.message);
8170 if (matches && matches.length === 3) {
8171 return handleFileName(matches[1]);
8173 matches = /Cannot find module '([^']*)'\nReferenced from:\s+(.*)/.exec(error.message);
8174 if (matches && matches.length === 3) {
8175 return handleFileName(matches[2]);
8179 var missingModuleReported = new Map();
8180 function tryHandleMissingModule(error, document, library) {
8181 if (!error.message) {
8184 function handleMissingModule(plugin, module3, error2) {
8185 if (!missingModuleReported.has(plugin)) {
8186 const fsPath = getFilePath(document);
8187 missingModuleReported.set(plugin, library);
8188 if (error2.messageTemplate === "plugin-missing") {
8189 connection.console.error([
8191 `${error2.message.toString()}`,
8192 `Happened while validating ${fsPath ? fsPath : document.uri}`,
8193 `This can happen for a couple of reasons:`,
8194 `1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).`,
8195 `2. If ESLint is installed globally, then make sure ${module3} is installed globally as well.`,
8196 `3. If ESLint is installed locally, then ${module3} isn't installed correctly.`,
8198 `Consider running eslint --debug ${fsPath ? fsPath : document.uri} from a terminal to obtain a trace about the configuration files used.`
8201 connection.console.error([
8202 `${error2.message.toString()}`,
8203 `Happened while validating ${fsPath ? fsPath : document.uri}`
8209 const matches = /Failed to load plugin (.*): Cannot find module (.*)/.exec(error.message);
8210 if (matches && matches.length === 3) {
8211 return handleMissingModule(matches[1], matches[2], error);
8215 function showErrorMessage(error, document) {
8216 connection.window.showErrorMessage(`ESLint: ${getMessage(error, document)}. Please see the 'ESLint' output channel for details.`, {title: "Open Output", id: 1}).then((value) => {
8217 if (value !== void 0 && value.id === 1) {
8218 connection.sendNotification(ShowOutputChannel.type);
8221 if (Is.string(error.stack)) {
8222 connection.console.error("ESLint stack trace:");
8223 connection.console.error(error.stack);
8227 messageQueue.registerNotification(import_node.DidChangeWatchedFilesNotification.type, (params) => {
8228 ruleDocData.handled.clear();
8229 ruleDocData.urls.clear();
8230 noConfigReported.clear();
8231 missingModuleReported.clear();
8232 document2Settings.clear();
8233 params.changes.forEach((change) => {
8234 const fsPath = getFilePath(change.uri);
8235 if (fsPath === void 0 || fsPath.length === 0 || isUNC(fsPath)) {
8238 const dirname2 = path.dirname(fsPath);
8240 const library = configErrorReported.get(fsPath);
8241 if (library !== void 0) {
8242 const cli = new library.CLIEngine({});
8244 cli.executeOnText("", path.join(dirname2, "___test___.js"));
8245 configErrorReported.delete(fsPath);
8251 validateMany(documents.all());
8254 constructor(edits) {
8257 static overlaps(a, b) {
8258 return a !== void 0 && a.edit.range[1] > b.edit.range[0];
8260 static isSame(a, b) {
8261 return a.edit.range[0] === b.edit.range[0] && a.edit.range[1] === b.edit.range[1] && a.edit.text === b.edit.text;
8264 return this.edits.size === 0;
8266 getDocumentVersion() {
8267 if (this.isEmpty()) {
8268 throw new Error("No edits recorded.");
8270 return this.edits.values().next().value.documentVersion;
8272 getScoped(diagnostics) {
8274 for (let diagnostic of diagnostics) {
8275 const key = computeKey(diagnostic);
8276 const editInfo = this.edits.get(key);
8278 result.push(editInfo);
8285 this.edits.forEach((value) => {
8286 if (Problem.isFixable(value)) {
8290 return result.sort((a, b) => {
8291 const d = a.edit.range[0] - b.edit.range[0];
8295 if (a.edit.range[1] === 0) {
8298 if (b.edit.range[1] === 0) {
8301 return a.edit.range[1] - b.edit.range[1];
8305 const sorted = this.getAllSorted();
8306 if (sorted.length <= 1) {
8310 let last = sorted[0];
8312 for (let i = 1; i < sorted.length; i++) {
8313 let current = sorted[i];
8314 if (!Fixes.overlaps(last, current) && !Fixes.isSame(last, current)) {
8315 result.push(current);
8322 var CodeActionResult = class {
8324 this._actions = new Map();
8327 let result = this._actions.get(ruleId);
8328 if (result === void 0) {
8329 result = {fixes: [], suggestions: []};
8330 this._actions.set(ruleId, result);
8335 if (this._fixAll === void 0) {
8338 return this._fixAll;
8342 for (let actions of this._actions.values()) {
8343 result.push(...actions.fixes);
8344 result.push(...actions.suggestions);
8345 if (actions.disable) {
8346 result.push(actions.disable);
8348 if (actions.fixAll) {
8349 result.push(actions.fixAll);
8351 if (actions.disableFile) {
8352 result.push(actions.disableFile);
8354 if (actions.showDocumentation) {
8355 result.push(actions.showDocumentation);
8358 if (this._fixAll !== void 0) {
8359 result.push(...this._fixAll);
8365 for (let actions of this._actions.values()) {
8366 result += actions.fixes.length;
8371 var Changes = class {
8373 this.values = new Map();
8375 this.version = void 0;
8377 clear(textDocument) {
8378 if (textDocument === void 0) {
8380 this.version = void 0;
8382 this.uri = textDocument.uri;
8383 this.version = textDocument.version;
8385 this.values.clear();
8387 isUsable(uri, version) {
8388 return this.uri === uri && this.version === version;
8391 this.values.set(key, change);
8394 return this.values.get(key);
8398 (function(CommandParams2) {
8399 function create(textDocument, ruleId, sequence) {
8400 return {uri: textDocument.uri, version: textDocument.version, ruleId, sequence};
8402 CommandParams2.create = create;
8403 function hasRuleId(value) {
8404 return value.ruleId !== void 0;
8406 CommandParams2.hasRuleId = hasRuleId;
8407 })(CommandParams || (CommandParams = {}));
8408 var changes = new Changes();
8409 var ESLintSourceFixAll = `${import_node.CodeActionKind.SourceFixAll}.eslint`;
8410 messageQueue.registerRequest(import_node.CodeActionRequest.type, (params) => {
8411 const result = new CodeActionResult();
8412 const uri = params.textDocument.uri;
8413 const textDocument = documents.get(uri);
8414 if (textDocument === void 0) {
8415 changes.clear(textDocument);
8416 return result.all();
8418 function createCodeAction(title, kind, commandId, arg, diagnostic) {
8419 const command = import_node.Command.create(title, commandId, arg);
8420 const action = import_node.CodeAction.create(title, command, kind);
8421 if (diagnostic !== void 0) {
8422 action.diagnostics = [diagnostic];
8426 function createDisableLineTextEdit(editInfo, indentationText) {
8427 return import_node.TextEdit.insert(import_node.Position.create(editInfo.line - 1, 0), `${indentationText}// eslint-disable-next-line ${editInfo.ruleId}${import_os.EOL}`);
8429 function createDisableSameLineTextEdit(editInfo) {
8430 return import_node.TextEdit.insert(import_node.Position.create(editInfo.line - 1, 2147483647), ` // eslint-disable-line ${editInfo.ruleId}`);
8432 function createDisableFileTextEdit(editInfo) {
8433 const shebang = textDocument == null ? void 0 : textDocument.getText(import_node.Range.create(import_node.Position.create(0, 0), import_node.Position.create(0, 2)));
8434 const line = shebang === "#!" ? 1 : 0;
8435 return import_node.TextEdit.insert(import_node.Position.create(line, 0), `/* eslint-disable ${editInfo.ruleId} */${import_os.EOL}`);
8437 function getLastEdit(array) {
8438 const length = array.length;
8442 return array[length - 1];
8444 return resolveSettings(textDocument).then(async (settings) => {
8445 if (settings.validate !== Validate.on || !TextDocumentSettings.hasLibrary(settings)) {
8446 return result.all();
8448 const problems = codeActions.get(uri);
8449 if (problems === void 0 && settings.run === "onType") {
8450 return result.all();
8452 const only = params.context.only !== void 0 && params.context.only.length > 0 ? params.context.only[0] : void 0;
8453 const isSource = only === import_node.CodeActionKind.Source;
8454 const isSourceFixAll = only === ESLintSourceFixAll || only === import_node.CodeActionKind.SourceFixAll;
8455 if (isSourceFixAll || isSource) {
8456 if (isSourceFixAll && settings.codeActionOnSave.enable) {
8457 const textDocumentIdentifer = {uri: textDocument.uri, version: textDocument.version};
8458 const edits = await computeAllFixes(textDocumentIdentifer, AllFixesMode.onSave);
8459 if (edits !== void 0) {
8460 result.fixAll.push(import_node.CodeAction.create(`Fix all ESLint auto-fixable problems`, {documentChanges: [import_node.TextDocumentEdit.create(textDocumentIdentifer, edits)]}, ESLintSourceFixAll));
8462 } else if (isSource) {
8463 result.fixAll.push(createCodeAction(`Fix all ESLint auto-fixable problems`, import_node.CodeActionKind.Source, CommandIds.applyAllFixes, CommandParams.create(textDocument)));
8465 return result.all();
8467 if (problems === void 0) {
8468 return result.all();
8470 const fixes = new Fixes(problems);
8471 if (fixes.isEmpty()) {
8472 return result.all();
8474 let documentVersion = -1;
8475 const allFixableRuleIds = [];
8476 const kind = only != null ? only : import_node.CodeActionKind.QuickFix;
8477 for (let editInfo of fixes.getScoped(params.context.diagnostics)) {
8478 documentVersion = editInfo.documentVersion;
8479 const ruleId = editInfo.ruleId;
8480 allFixableRuleIds.push(ruleId);
8481 if (Problem.isFixable(editInfo)) {
8482 const workspaceChange = new import_node.WorkspaceChange();
8483 workspaceChange.getTextEditChange({uri, version: documentVersion}).add(FixableProblem.createTextEdit(textDocument, editInfo));
8484 changes.set(`${CommandIds.applySingleFix}:${ruleId}`, workspaceChange);
8485 const action = createCodeAction(editInfo.label, kind, CommandIds.applySingleFix, CommandParams.create(textDocument, ruleId), editInfo.diagnostic);
8486 action.isPreferred = true;
8487 result.get(ruleId).fixes.push(action);
8489 if (Problem.hasSuggestions(editInfo)) {
8490 editInfo.suggestions.forEach((suggestion, suggestionSequence) => {
8491 const workspaceChange = new import_node.WorkspaceChange();
8492 workspaceChange.getTextEditChange({uri, version: documentVersion}).add(SuggestionsProblem.createTextEdit(textDocument, suggestion));
8493 changes.set(`${CommandIds.applySuggestion}:${ruleId}:${suggestionSequence}`, workspaceChange);
8494 const action = createCodeAction(`${suggestion.desc} (${editInfo.ruleId})`, import_node.CodeActionKind.QuickFix, CommandIds.applySuggestion, CommandParams.create(textDocument, ruleId, suggestionSequence), editInfo.diagnostic);
8495 result.get(ruleId).suggestions.push(action);
8498 if (settings.codeAction.disableRuleComment.enable) {
8499 let workspaceChange = new import_node.WorkspaceChange();
8500 if (settings.codeAction.disableRuleComment.location === "sameLine") {
8501 workspaceChange.getTextEditChange({uri, version: documentVersion}).add(createDisableSameLineTextEdit(editInfo));
8503 const lineText = textDocument.getText(import_node.Range.create(import_node.Position.create(editInfo.line - 1, 0), import_node.Position.create(editInfo.line - 1, 2147483647)));
8504 const matches = /^([ \t]*)/.exec(lineText);
8505 const indentationText = matches !== null && matches.length > 0 ? matches[1] : "";
8506 workspaceChange.getTextEditChange({uri, version: documentVersion}).add(createDisableLineTextEdit(editInfo, indentationText));
8508 changes.set(`${CommandIds.applyDisableLine}:${ruleId}`, workspaceChange);
8509 result.get(ruleId).disable = createCodeAction(`Disable ${ruleId} for this line`, kind, CommandIds.applyDisableLine, CommandParams.create(textDocument, ruleId));
8510 if (result.get(ruleId).disableFile === void 0) {
8511 workspaceChange = new import_node.WorkspaceChange();
8512 workspaceChange.getTextEditChange({uri, version: documentVersion}).add(createDisableFileTextEdit(editInfo));
8513 changes.set(`${CommandIds.applyDisableFile}:${ruleId}`, workspaceChange);
8514 result.get(ruleId).disableFile = createCodeAction(`Disable ${ruleId} for the entire file`, kind, CommandIds.applyDisableFile, CommandParams.create(textDocument, ruleId));
8517 if (settings.codeAction.showDocumentation.enable && result.get(ruleId).showDocumentation === void 0) {
8518 if (ruleDocData.urls.has(ruleId)) {
8519 result.get(ruleId).showDocumentation = createCodeAction(`Show documentation for ${ruleId}`, kind, CommandIds.openRuleDoc, CommandParams.create(textDocument, ruleId));
8523 if (result.length > 0) {
8524 const sameProblems = new Map(allFixableRuleIds.map((s) => [s, []]));
8525 for (let editInfo of fixes.getAllSorted()) {
8526 if (documentVersion === -1) {
8527 documentVersion = editInfo.documentVersion;
8529 if (sameProblems.has(editInfo.ruleId)) {
8530 const same = sameProblems.get(editInfo.ruleId);
8531 if (!Fixes.overlaps(getLastEdit(same), editInfo)) {
8532 same.push(editInfo);
8536 sameProblems.forEach((same, ruleId) => {
8537 if (same.length > 1) {
8538 const sameFixes = new import_node.WorkspaceChange();
8539 const sameTextChange = sameFixes.getTextEditChange({uri, version: documentVersion});
8540 same.map((fix) => FixableProblem.createTextEdit(textDocument, fix)).forEach((edit) => sameTextChange.add(edit));
8541 changes.set(CommandIds.applySameFixes, sameFixes);
8542 result.get(ruleId).fixAll = createCodeAction(`Fix all ${ruleId} problems`, kind, CommandIds.applySameFixes, CommandParams.create(textDocument));
8545 result.fixAll.push(createCodeAction(`Fix all auto-fixable problems`, kind, CommandIds.applyAllFixes, CommandParams.create(textDocument)));
8547 return result.all();
8550 const document = documents.get(params.textDocument.uri);
8551 return document !== void 0 ? document.version : void 0;
8554 (function(AllFixesMode2) {
8555 AllFixesMode2["onSave"] = "onsave";
8556 AllFixesMode2["format"] = "format";
8557 AllFixesMode2["command"] = "command";
8558 })(AllFixesMode || (AllFixesMode = {}));
8559 function computeAllFixes(identifier, mode) {
8560 const uri = identifier.uri;
8561 const textDocument = documents.get(uri);
8562 if (textDocument === void 0 || identifier.version !== textDocument.version) {
8565 return resolveSettings(textDocument).then((settings) => {
8566 if (settings.validate !== Validate.on || !TextDocumentSettings.hasLibrary(settings) || mode === AllFixesMode.format && !settings.format) {
8569 const filePath = getFilePath(textDocument);
8570 return withCLIEngine((cli) => {
8571 const problems = codeActions.get(uri);
8572 const originalContent = textDocument.getText();
8575 let start = Date.now();
8576 if (mode === AllFixesMode.onSave && problems !== void 0 && problems.size > 0) {
8577 const fixes = new Fixes(problems).getApplicable();
8578 if (fixes.length > 0) {
8579 problemFixes = fixes.map((fix) => FixableProblem.createTextEdit(textDocument, fix));
8582 if (mode === AllFixesMode.onSave && settings.codeActionOnSave.mode === CodeActionsOnSaveMode.problems) {
8583 connection.tracer.log(`Computing all fixes took: ${Date.now() - start} ms.`);
8584 if (problemFixes !== void 0) {
8585 result.push(...problemFixes);
8589 if (problemFixes !== void 0) {
8590 content = TextDocument.applyEdits(textDocument, problemFixes);
8592 content = originalContent;
8594 const report = cli.executeOnText(content, filePath);
8595 connection.tracer.log(`Computing all fixes took: ${Date.now() - start} ms.`);
8596 if (Array.isArray(report.results) && report.results.length === 1 && report.results[0].output !== void 0) {
8597 const fixedContent = report.results[0].output;
8599 const diffs = stringDiff(originalContent, fixedContent, false);
8600 connection.tracer.log(`Computing minimal edits took: ${Date.now() - start} ms.`);
8601 for (let diff of diffs) {
8604 start: textDocument.positionAt(diff.originalStart),
8605 end: textDocument.positionAt(diff.originalStart + diff.originalLength)
8607 newText: fixedContent.substr(diff.modifiedStart, diff.modifiedLength)
8610 } else if (problemFixes !== void 0) {
8611 result.push(...problemFixes);
8615 }, settings, {fix: true});
8618 messageQueue.registerRequest(import_node.ExecuteCommandRequest.type, async (params) => {
8619 let workspaceChange;
8620 const commandParams = params.arguments[0];
8621 if (params.command === CommandIds.applyAllFixes) {
8622 const edits = await computeAllFixes(commandParams, AllFixesMode.command);
8623 if (edits !== void 0) {
8624 workspaceChange = new import_node.WorkspaceChange();
8625 const textChange = workspaceChange.getTextEditChange(commandParams);
8626 edits.forEach((edit) => textChange.add(edit));
8629 if ([CommandIds.applySingleFix, CommandIds.applyDisableLine, CommandIds.applyDisableFile].indexOf(params.command) !== -1) {
8630 workspaceChange = changes.get(`${params.command}:${commandParams.ruleId}`);
8631 } else if ([CommandIds.applySuggestion].indexOf(params.command) !== -1) {
8632 workspaceChange = changes.get(`${params.command}:${commandParams.ruleId}:${commandParams.sequence}`);
8633 } else if (params.command === CommandIds.openRuleDoc && CommandParams.hasRuleId(commandParams)) {
8634 const url = ruleDocData.urls.get(commandParams.ruleId);
8636 connection.sendRequest(OpenESLintDocRequest.type, {url});
8639 workspaceChange = changes.get(params.command);
8642 if (workspaceChange === void 0) {
8645 return connection.workspace.applyEdit(workspaceChange.edit).then((response) => {
8646 if (!response.applied) {
8647 connection.console.error(`Failed to apply command: ${params.command}`);
8651 connection.console.error(`Failed to apply command: ${params.command}`);
8654 const commandParam = params.arguments[0];
8655 if (changes.isUsable(commandParam.uri, commandParam.version)) {
8656 return commandParam.version;
8661 messageQueue.registerRequest(import_node.DocumentFormattingRequest.type, (params) => {
8662 const textDocument = documents.get(params.textDocument.uri);
8663 if (textDocument === void 0) {
8666 return computeAllFixes({uri: textDocument.uri, version: textDocument.version}, AllFixesMode.format);
8668 const document = documents.get(params.textDocument.uri);
8669 return document !== void 0 ? document.version : void 0;
8671 connection.listen();
8674 // node_modules/vscode-languageserver-textdocument/lib/esm/main.js
8676 var FullTextDocument = function() {
8677 function FullTextDocument2(uri, languageId, version, content) {
8679 this._languageId = languageId;
8680 this._version = version;
8681 this._content = content;
8682 this._lineOffsets = void 0;
8684 Object.defineProperty(FullTextDocument2.prototype, "uri", {
8691 Object.defineProperty(FullTextDocument2.prototype, "languageId", {
8693 return this._languageId;
8698 Object.defineProperty(FullTextDocument2.prototype, "version", {
8700 return this._version;
8705 FullTextDocument2.prototype.getText = function(range) {
8707 var start = this.offsetAt(range.start);
8708 var end = this.offsetAt(range.end);
8709 return this._content.substring(start, end);
8711 return this._content;
8713 FullTextDocument2.prototype.update = function(changes, version) {
8714 for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
8715 var change = changes_1[_i];
8716 if (FullTextDocument2.isIncremental(change)) {
8717 var range = getWellformedRange(change.range);
8718 var startOffset = this.offsetAt(range.start);
8719 var endOffset = this.offsetAt(range.end);
8720 this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
8721 var startLine = Math.max(range.start.line, 0);
8722 var endLine = Math.max(range.end.line, 0);
8723 var lineOffsets = this._lineOffsets;
8724 var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
8725 if (endLine - startLine === addedLineOffsets.length) {
8726 for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
8727 lineOffsets[i + startLine + 1] = addedLineOffsets[i];
8730 if (addedLineOffsets.length < 1e4) {
8731 lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
8733 this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
8736 var diff = change.text.length - (endOffset - startOffset);
8738 for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
8739 lineOffsets[i] = lineOffsets[i] + diff;
8742 } else if (FullTextDocument2.isFull(change)) {
8743 this._content = change.text;
8744 this._lineOffsets = void 0;
8746 throw new Error("Unknown change event received");
8749 this._version = version;
8751 FullTextDocument2.prototype.getLineOffsets = function() {
8752 if (this._lineOffsets === void 0) {
8753 this._lineOffsets = computeLineOffsets(this._content, true);
8755 return this._lineOffsets;
8757 FullTextDocument2.prototype.positionAt = function(offset) {
8758 offset = Math.max(Math.min(offset, this._content.length), 0);
8759 var lineOffsets = this.getLineOffsets();
8760 var low = 0, high = lineOffsets.length;
8762 return {line: 0, character: offset};
8764 while (low < high) {
8765 var mid = Math.floor((low + high) / 2);
8766 if (lineOffsets[mid] > offset) {
8773 return {line, character: offset - lineOffsets[line]};
8775 FullTextDocument2.prototype.offsetAt = function(position) {
8776 var lineOffsets = this.getLineOffsets();
8777 if (position.line >= lineOffsets.length) {
8778 return this._content.length;
8779 } else if (position.line < 0) {
8782 var lineOffset = lineOffsets[position.line];
8783 var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
8784 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
8786 Object.defineProperty(FullTextDocument2.prototype, "lineCount", {
8788 return this.getLineOffsets().length;
8793 FullTextDocument2.isIncremental = function(event) {
8794 var candidate = event;
8795 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
8797 FullTextDocument2.isFull = function(event) {
8798 var candidate = event;
8799 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
8801 return FullTextDocument2;
8804 (function(TextDocument2) {
8805 function create(uri, languageId, version, content) {
8806 return new FullTextDocument(uri, languageId, version, content);
8808 TextDocument2.create = create;
8809 function update(document, changes, version) {
8810 if (document instanceof FullTextDocument) {
8811 document.update(changes, version);
8814 throw new Error("TextDocument.update: document must be created by TextDocument.create");
8817 TextDocument2.update = update;
8818 function applyEdits(document, edits) {
8819 var text = document.getText();
8820 var sortedEdits = mergeSort(edits.map(getWellformedEdit), function(a, b) {
8821 var diff = a.range.start.line - b.range.start.line;
8823 return a.range.start.character - b.range.start.character;
8827 var lastModifiedOffset = 0;
8829 for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
8830 var e = sortedEdits_1[_i];
8831 var startOffset = document.offsetAt(e.range.start);
8832 if (startOffset < lastModifiedOffset) {
8833 throw new Error("Overlapping edit");
8834 } else if (startOffset > lastModifiedOffset) {
8835 spans.push(text.substring(lastModifiedOffset, startOffset));
8837 if (e.newText.length) {
8838 spans.push(e.newText);
8840 lastModifiedOffset = document.offsetAt(e.range.end);
8842 spans.push(text.substr(lastModifiedOffset));
8843 return spans.join("");
8845 TextDocument2.applyEdits = applyEdits;
8846 })(TextDocument || (TextDocument = {}));
8847 function mergeSort(data, compare) {
8848 if (data.length <= 1) {
8851 var p = data.length / 2 | 0;
8852 var left = data.slice(0, p);
8853 var right = data.slice(p);
8854 mergeSort(left, compare);
8855 mergeSort(right, compare);
8859 while (leftIdx < left.length && rightIdx < right.length) {
8860 var ret = compare(left[leftIdx], right[rightIdx]);
8862 data[i++] = left[leftIdx++];
8864 data[i++] = right[rightIdx++];
8867 while (leftIdx < left.length) {
8868 data[i++] = left[leftIdx++];
8870 while (rightIdx < right.length) {
8871 data[i++] = right[rightIdx++];
8875 function computeLineOffsets(text, isAtLineStart, textOffset) {
8876 if (textOffset === void 0) {
8879 var result = isAtLineStart ? [textOffset] : [];
8880 for (var i = 0; i < text.length; i++) {
8881 var ch = text.charCodeAt(i);
8882 if (ch === 13 || ch === 10) {
8883 if (ch === 13 && i + 1 < text.length && text.charCodeAt(i + 1) === 10) {
8886 result.push(textOffset + i + 1);
8891 function getWellformedRange(range) {
8892 var start = range.start;
8893 var end = range.end;
8894 if (start.line > end.line || start.line === end.line && start.character > end.character) {
8895 return {start: end, end: start};
8899 function getWellformedEdit(textEdit) {
8900 var range = getWellformedRange(textEdit.range);
8901 if (range !== textEdit.range) {
8902 return {newText: textEdit.newText, range};
8907 // node_modules/vscode-uri/lib/esm/index.js
8909 var __extends = function() {
8910 var extendStatics = function(d, b) {
8911 extendStatics = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(d2, b2) {
8913 } || function(d2, b2) {
8915 if (b2.hasOwnProperty(p))
8918 return extendStatics(d, b);
8920 return function(d, b) {
8921 extendStatics(d, b);
8923 this.constructor = d;
8925 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8930 if (typeof process === "object") {
8931 isWindows = process.platform === "win32";
8932 } else if (typeof navigator === "object") {
8933 userAgent = navigator.userAgent;
8934 isWindows = userAgent.indexOf("Windows") >= 0;
8937 var _schemePattern = /^\w[\w\d+.-]*$/;
8938 var _singleSlashStart = /^\//;
8939 var _doubleSlashStart = /^\/\//;
8940 function _validateUri(ret, _strict) {
8941 if (!ret.scheme && _strict) {
8942 throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "' + ret.authority + '", path: "' + ret.path + '", query: "' + ret.query + '", fragment: "' + ret.fragment + '"}');
8944 if (ret.scheme && !_schemePattern.test(ret.scheme)) {
8945 throw new Error("[UriError]: Scheme contains illegal characters.");
8948 if (ret.authority) {
8949 if (!_singleSlashStart.test(ret.path)) {
8950 throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
8953 if (_doubleSlashStart.test(ret.path)) {
8954 throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
8959 function _schemeFix(scheme, _strict) {
8960 if (!scheme && !_strict) {
8965 function _referenceResolution(scheme, path) {
8972 } else if (path[0] !== _slash) {
8973 path = _slash + path;
8981 var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
8982 var URI = function() {
8983 function URI2(schemeOrData, authority, path, query, fragment, _strict) {
8984 if (_strict === void 0) {
8987 if (typeof schemeOrData === "object") {
8988 this.scheme = schemeOrData.scheme || _empty;
8989 this.authority = schemeOrData.authority || _empty;
8990 this.path = schemeOrData.path || _empty;
8991 this.query = schemeOrData.query || _empty;
8992 this.fragment = schemeOrData.fragment || _empty;
8994 this.scheme = _schemeFix(schemeOrData, _strict);
8995 this.authority = authority || _empty;
8996 this.path = _referenceResolution(this.scheme, path || _empty);
8997 this.query = query || _empty;
8998 this.fragment = fragment || _empty;
8999 _validateUri(this, _strict);
9002 URI2.isUri = function(thing) {
9003 if (thing instanceof URI2) {
9009 return typeof thing.authority === "string" && typeof thing.fragment === "string" && typeof thing.path === "string" && typeof thing.query === "string" && typeof thing.scheme === "string" && typeof thing.fsPath === "function" && typeof thing.with === "function" && typeof thing.toString === "function";
9011 Object.defineProperty(URI2.prototype, "fsPath", {
9013 return _makeFsPath(this);
9018 URI2.prototype.with = function(change) {
9022 var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment;
9023 if (scheme === void 0) {
9024 scheme = this.scheme;
9025 } else if (scheme === null) {
9028 if (authority === void 0) {
9029 authority = this.authority;
9030 } else if (authority === null) {
9033 if (path === void 0) {
9035 } else if (path === null) {
9038 if (query === void 0) {
9040 } else if (query === null) {
9043 if (fragment === void 0) {
9044 fragment = this.fragment;
9045 } else if (fragment === null) {
9048 if (scheme === this.scheme && authority === this.authority && path === this.path && query === this.query && fragment === this.fragment) {
9051 return new _URI(scheme, authority, path, query, fragment);
9053 URI2.parse = function(value, _strict) {
9054 if (_strict === void 0) {
9057 var match = _regexp.exec(value);
9059 return new _URI(_empty, _empty, _empty, _empty, _empty);
9061 return new _URI(match[2] || _empty, decodeURIComponent(match[4] || _empty), decodeURIComponent(match[5] || _empty), decodeURIComponent(match[7] || _empty), decodeURIComponent(match[9] || _empty), _strict);
9063 URI2.file = function(path) {
9064 var authority = _empty;
9066 path = path.replace(/\\/g, _slash);
9068 if (path[0] === _slash && path[1] === _slash) {
9069 var idx = path.indexOf(_slash, 2);
9071 authority = path.substring(2);
9074 authority = path.substring(2, idx);
9075 path = path.substring(idx) || _slash;
9078 return new _URI("file", authority, path, _empty, _empty);
9080 URI2.from = function(components) {
9081 return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment);
9083 URI2.prototype.toString = function(skipEncoding) {
9084 if (skipEncoding === void 0) {
9085 skipEncoding = false;
9087 return _asFormatted(this, skipEncoding);
9089 URI2.prototype.toJSON = function() {
9092 URI2.revive = function(data) {
9095 } else if (data instanceof URI2) {
9098 var result = new _URI(data);
9099 result._formatted = data.external;
9100 result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null;
9106 var _pathSepMarker = isWindows ? 1 : void 0;
9107 var _URI = function(_super) {
9108 __extends(_URI2, _super);
9110 var _this = _super !== null && _super.apply(this, arguments) || this;
9111 _this._formatted = null;
9112 _this._fsPath = null;
9115 Object.defineProperty(_URI2.prototype, "fsPath", {
9117 if (!this._fsPath) {
9118 this._fsPath = _makeFsPath(this);
9120 return this._fsPath;
9125 _URI2.prototype.toString = function(skipEncoding) {
9126 if (skipEncoding === void 0) {
9127 skipEncoding = false;
9129 if (!skipEncoding) {
9130 if (!this._formatted) {
9131 this._formatted = _asFormatted(this, false);
9133 return this._formatted;
9135 return _asFormatted(this, true);
9138 _URI2.prototype.toJSON = function() {
9143 res.fsPath = this._fsPath;
9144 res._sep = _pathSepMarker;
9146 if (this._formatted) {
9147 res.external = this._formatted;
9150 res.path = this.path;
9153 res.scheme = this.scheme;
9155 if (this.authority) {
9156 res.authority = this.authority;
9159 res.query = this.query;
9161 if (this.fragment) {
9162 res.fragment = this.fragment;
9168 var encodeTable = (_a = {}, _a[58] = "%3A", _a[47] = "%2F", _a[63] = "%3F", _a[35] = "%23", _a[91] = "%5B", _a[93] = "%5D", _a[64] = "%40", _a[33] = "%21", _a[36] = "%24", _a[38] = "%26", _a[39] = "%27", _a[40] = "%28", _a[41] = "%29", _a[42] = "%2A", _a[43] = "%2B", _a[44] = "%2C", _a[59] = "%3B", _a[61] = "%3D", _a[32] = "%20", _a);
9169 function encodeURIComponentFast(uriComponent, allowSlash) {
9171 var nativeEncodePos = -1;
9172 for (var pos = 0; pos < uriComponent.length; pos++) {
9173 var code = uriComponent.charCodeAt(pos);
9174 if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 45 || code === 46 || code === 95 || code === 126 || allowSlash && code === 47) {
9175 if (nativeEncodePos !== -1) {
9176 res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
9177 nativeEncodePos = -1;
9179 if (res !== void 0) {
9180 res += uriComponent.charAt(pos);
9183 if (res === void 0) {
9184 res = uriComponent.substr(0, pos);
9186 var escaped = encodeTable[code];
9187 if (escaped !== void 0) {
9188 if (nativeEncodePos !== -1) {
9189 res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos));
9190 nativeEncodePos = -1;
9193 } else if (nativeEncodePos === -1) {
9194 nativeEncodePos = pos;
9198 if (nativeEncodePos !== -1) {
9199 res += encodeURIComponent(uriComponent.substring(nativeEncodePos));
9201 return res !== void 0 ? res : uriComponent;
9203 function encodeURIComponentMinimal(path) {
9205 for (var pos = 0; pos < path.length; pos++) {
9206 var code = path.charCodeAt(pos);
9207 if (code === 35 || code === 63) {
9208 if (res === void 0) {
9209 res = path.substr(0, pos);
9211 res += encodeTable[code];
9213 if (res !== void 0) {
9218 return res !== void 0 ? res : path;
9220 function _makeFsPath(uri) {
9222 if (uri.authority && uri.path.length > 1 && uri.scheme === "file") {
9223 value = "//" + uri.authority + uri.path;
9224 } else if (uri.path.charCodeAt(0) === 47 && (uri.path.charCodeAt(1) >= 65 && uri.path.charCodeAt(1) <= 90 || uri.path.charCodeAt(1) >= 97 && uri.path.charCodeAt(1) <= 122) && uri.path.charCodeAt(2) === 58) {
9225 value = uri.path[1].toLowerCase() + uri.path.substr(2);
9230 value = value.replace(/\//g, "\\");
9234 function _asFormatted(uri, skipEncoding) {
9235 var encoder = !skipEncoding ? encodeURIComponentFast : encodeURIComponentMinimal;
9237 var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment;
9242 if (authority || scheme === "file") {
9247 var idx = authority.indexOf("@");
9249 var userinfo = authority.substr(0, idx);
9250 authority = authority.substr(idx + 1);
9251 idx = userinfo.indexOf(":");
9253 res += encoder(userinfo, false);
9255 res += encoder(userinfo.substr(0, idx), false);
9257 res += encoder(userinfo.substr(idx + 1), false);
9261 authority = authority.toLowerCase();
9262 idx = authority.indexOf(":");
9264 res += encoder(authority, false);
9266 res += encoder(authority.substr(0, idx), false);
9267 res += authority.substr(idx);
9271 if (path.length >= 3 && path.charCodeAt(0) === 47 && path.charCodeAt(2) === 58) {
9272 var code = path.charCodeAt(1);
9273 if (code >= 65 && code <= 90) {
9274 path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3);
9276 } else if (path.length >= 2 && path.charCodeAt(1) === 58) {
9277 var code = path.charCodeAt(0);
9278 if (code >= 65 && code <= 90) {
9279 path = String.fromCharCode(code + 32) + ":" + path.substr(2);
9282 res += encoder(path, true);
9286 res += encoder(query, false);
9290 res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment;
9296 function stringDiff(original, modified, pretty) {
9297 return new LcsDiff(new StringDiffSequence(original), new StringDiffSequence(modified)).ComputeDiff(pretty).changes;
9299 var StringDiffSequence = class {
9300 constructor(source) {
9301 this.source = source;
9304 const source = this.source;
9305 const characters = new Int32Array(source.length);
9306 for (let i = 0, len = source.length; i < len; i++) {
9307 characters[i] = source.charCodeAt(i);
9312 var DiffChange = class {
9313 constructor(originalStart, originalLength, modifiedStart, modifiedLength) {
9314 this.originalStart = originalStart;
9315 this.originalLength = originalLength;
9316 this.modifiedStart = modifiedStart;
9317 this.modifiedLength = modifiedLength;
9320 return this.originalStart + this.originalLength;
9323 return this.modifiedStart + this.modifiedLength;
9327 static Assert(condition, message) {
9329 throw new Error(message);
9334 (function(Constants2) {
9335 Constants2[Constants2["MAX_SAFE_SMALL_INTEGER"] = 1073741824] = "MAX_SAFE_SMALL_INTEGER";
9336 Constants2[Constants2["MIN_SAFE_SMALL_INTEGER"] = -1073741824] = "MIN_SAFE_SMALL_INTEGER";
9337 Constants2[Constants2["MAX_UINT_8"] = 255] = "MAX_UINT_8";
9338 Constants2[Constants2["MAX_UINT_16"] = 65535] = "MAX_UINT_16";
9339 Constants2[Constants2["MAX_UINT_32"] = 4294967295] = "MAX_UINT_32";
9340 Constants2[Constants2["UNICODE_SUPPLEMENTARY_PLANE_BEGIN"] = 65536] = "UNICODE_SUPPLEMENTARY_PLANE_BEGIN";
9341 })(Constants || (Constants = {}));
9343 (function(LocalConstants2) {
9344 LocalConstants2[LocalConstants2["MaxDifferencesHistory"] = 1447] = "MaxDifferencesHistory";
9345 })(LocalConstants || (LocalConstants = {}));
9346 var MyArray = class {
9347 static Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {
9348 for (let i = 0; i < length; i++) {
9349 destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
9352 static Copy2(sourceArray, sourceIndex, destinationArray, destinationIndex, length) {
9353 for (let i = 0; i < length; i++) {
9354 destinationArray[destinationIndex + i] = sourceArray[sourceIndex + i];
9358 var DiffChangeHelper = class {
9360 this.m_changes = [];
9361 this.m_originalStart = 1073741824;
9362 this.m_modifiedStart = 1073741824;
9363 this.m_originalCount = 0;
9364 this.m_modifiedCount = 0;
9367 if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
9368 this.m_changes.push(new DiffChange(this.m_originalStart, this.m_originalCount, this.m_modifiedStart, this.m_modifiedCount));
9370 this.m_originalCount = 0;
9371 this.m_modifiedCount = 0;
9372 this.m_originalStart = 1073741824;
9373 this.m_modifiedStart = 1073741824;
9375 AddOriginalElement(originalIndex, modifiedIndex) {
9376 this.m_originalStart = Math.min(this.m_originalStart, originalIndex);
9377 this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);
9378 this.m_originalCount++;
9380 AddModifiedElement(originalIndex, modifiedIndex) {
9381 this.m_originalStart = Math.min(this.m_originalStart, originalIndex);
9382 this.m_modifiedStart = Math.min(this.m_modifiedStart, modifiedIndex);
9383 this.m_modifiedCount++;
9386 if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
9387 this.MarkNextChange();
9389 return this.m_changes;
9391 getReverseChanges() {
9392 if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
9393 this.MarkNextChange();
9395 this.m_changes.reverse();
9396 return this.m_changes;
9399 var LcsDiff = class {
9400 constructor(originalSequence, modifiedSequence, continueProcessingPredicate = null) {
9401 this.ContinueProcessingPredicate = continueProcessingPredicate;
9402 const [originalStringElements, originalElementsOrHash, originalHasStrings] = LcsDiff._getElements(originalSequence);
9403 const [modifiedStringElements, modifiedElementsOrHash, modifiedHasStrings] = LcsDiff._getElements(modifiedSequence);
9404 this._hasStrings = originalHasStrings && modifiedHasStrings;
9405 this._originalStringElements = originalStringElements;
9406 this._originalElementsOrHash = originalElementsOrHash;
9407 this._modifiedStringElements = modifiedStringElements;
9408 this._modifiedElementsOrHash = modifiedElementsOrHash;
9409 this.m_forwardHistory = [];
9410 this.m_reverseHistory = [];
9412 static _getElements(sequence) {
9413 const elements = sequence.getElements();
9414 if (elements instanceof Int32Array) {
9415 return [[], elements, false];
9417 return [[], new Int32Array(elements), false];
9419 ElementsAreEqual(originalIndex, newIndex) {
9420 if (this._originalElementsOrHash[originalIndex] !== this._modifiedElementsOrHash[newIndex]) {
9423 return this._hasStrings ? this._originalStringElements[originalIndex] === this._modifiedStringElements[newIndex] : true;
9425 OriginalElementsAreEqual(index1, index2) {
9426 if (this._originalElementsOrHash[index1] !== this._originalElementsOrHash[index2]) {
9429 return this._hasStrings ? this._originalStringElements[index1] === this._originalStringElements[index2] : true;
9431 ModifiedElementsAreEqual(index1, index2) {
9432 if (this._modifiedElementsOrHash[index1] !== this._modifiedElementsOrHash[index2]) {
9435 return this._hasStrings ? this._modifiedStringElements[index1] === this._modifiedStringElements[index2] : true;
9437 ComputeDiff(pretty) {
9438 return this._ComputeDiff(0, this._originalElementsOrHash.length - 1, 0, this._modifiedElementsOrHash.length - 1, pretty);
9440 _ComputeDiff(originalStart, originalEnd, modifiedStart, modifiedEnd, pretty) {
9441 const quitEarlyArr = [false];
9442 let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);
9444 changes = this.PrettifyChanges(changes);
9447 quitEarly: quitEarlyArr[0],
9451 ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr) {
9452 quitEarlyArr[0] = false;
9453 while (originalStart <= originalEnd && modifiedStart <= modifiedEnd && this.ElementsAreEqual(originalStart, modifiedStart)) {
9457 while (originalEnd >= originalStart && modifiedEnd >= modifiedStart && this.ElementsAreEqual(originalEnd, modifiedEnd)) {
9461 if (originalStart > originalEnd || modifiedStart > modifiedEnd) {
9463 if (modifiedStart <= modifiedEnd) {
9464 Debug.Assert(originalStart === originalEnd + 1, "originalStart should only be one more than originalEnd");
9466 new DiffChange(originalStart, 0, modifiedStart, modifiedEnd - modifiedStart + 1)
9468 } else if (originalStart <= originalEnd) {
9469 Debug.Assert(modifiedStart === modifiedEnd + 1, "modifiedStart should only be one more than modifiedEnd");
9471 new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, 0)
9474 Debug.Assert(originalStart === originalEnd + 1, "originalStart should only be one more than originalEnd");
9475 Debug.Assert(modifiedStart === modifiedEnd + 1, "modifiedStart should only be one more than modifiedEnd");
9480 const midOriginalArr = [0];
9481 const midModifiedArr = [0];
9482 const result = this.ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr);
9483 const midOriginal = midOriginalArr[0];
9484 const midModified = midModifiedArr[0];
9485 if (result !== null) {
9487 } else if (!quitEarlyArr[0]) {
9488 const leftChanges = this.ComputeDiffRecursive(originalStart, midOriginal, modifiedStart, midModified, quitEarlyArr);
9489 let rightChanges = [];
9490 if (!quitEarlyArr[0]) {
9491 rightChanges = this.ComputeDiffRecursive(midOriginal + 1, originalEnd, midModified + 1, modifiedEnd, quitEarlyArr);
9494 new DiffChange(midOriginal + 1, originalEnd - (midOriginal + 1) + 1, midModified + 1, modifiedEnd - (midModified + 1) + 1)
9497 return this.ConcatenateChanges(leftChanges, rightChanges);
9500 new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)
9503 WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr) {
9504 let forwardChanges = null;
9505 let reverseChanges = null;
9506 let changeHelper = new DiffChangeHelper();
9507 let diagonalMin = diagonalForwardStart;
9508 let diagonalMax = diagonalForwardEnd;
9509 let diagonalRelative = midOriginalArr[0] - midModifiedArr[0] - diagonalForwardOffset;
9510 let lastOriginalIndex = -1073741824;
9511 let historyIndex = this.m_forwardHistory.length - 1;
9513 const diagonal = diagonalRelative + diagonalForwardBase;
9514 if (diagonal === diagonalMin || diagonal < diagonalMax && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1]) {
9515 originalIndex = forwardPoints[diagonal + 1];
9516 modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;
9517 if (originalIndex < lastOriginalIndex) {
9518 changeHelper.MarkNextChange();
9520 lastOriginalIndex = originalIndex;
9521 changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex);
9522 diagonalRelative = diagonal + 1 - diagonalForwardBase;
9524 originalIndex = forwardPoints[diagonal - 1] + 1;
9525 modifiedIndex = originalIndex - diagonalRelative - diagonalForwardOffset;
9526 if (originalIndex < lastOriginalIndex) {
9527 changeHelper.MarkNextChange();
9529 lastOriginalIndex = originalIndex - 1;
9530 changeHelper.AddOriginalElement(originalIndex, modifiedIndex + 1);
9531 diagonalRelative = diagonal - 1 - diagonalForwardBase;
9533 if (historyIndex >= 0) {
9534 forwardPoints = this.m_forwardHistory[historyIndex];
9535 diagonalForwardBase = forwardPoints[0];
9537 diagonalMax = forwardPoints.length - 1;
9539 } while (--historyIndex >= -1);
9540 forwardChanges = changeHelper.getReverseChanges();
9541 if (quitEarlyArr[0]) {
9542 let originalStartPoint = midOriginalArr[0] + 1;
9543 let modifiedStartPoint = midModifiedArr[0] + 1;
9544 if (forwardChanges !== null && forwardChanges.length > 0) {
9545 const lastForwardChange = forwardChanges[forwardChanges.length - 1];
9546 originalStartPoint = Math.max(originalStartPoint, lastForwardChange.getOriginalEnd());
9547 modifiedStartPoint = Math.max(modifiedStartPoint, lastForwardChange.getModifiedEnd());
9550 new DiffChange(originalStartPoint, originalEnd - originalStartPoint + 1, modifiedStartPoint, modifiedEnd - modifiedStartPoint + 1)
9553 changeHelper = new DiffChangeHelper();
9554 diagonalMin = diagonalReverseStart;
9555 diagonalMax = diagonalReverseEnd;
9556 diagonalRelative = midOriginalArr[0] - midModifiedArr[0] - diagonalReverseOffset;
9557 lastOriginalIndex = 1073741824;
9558 historyIndex = deltaIsEven ? this.m_reverseHistory.length - 1 : this.m_reverseHistory.length - 2;
9560 const diagonal = diagonalRelative + diagonalReverseBase;
9561 if (diagonal === diagonalMin || diagonal < diagonalMax && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1]) {
9562 originalIndex = reversePoints[diagonal + 1] - 1;
9563 modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;
9564 if (originalIndex > lastOriginalIndex) {
9565 changeHelper.MarkNextChange();
9567 lastOriginalIndex = originalIndex + 1;
9568 changeHelper.AddOriginalElement(originalIndex + 1, modifiedIndex + 1);
9569 diagonalRelative = diagonal + 1 - diagonalReverseBase;
9571 originalIndex = reversePoints[diagonal - 1];
9572 modifiedIndex = originalIndex - diagonalRelative - diagonalReverseOffset;
9573 if (originalIndex > lastOriginalIndex) {
9574 changeHelper.MarkNextChange();
9576 lastOriginalIndex = originalIndex;
9577 changeHelper.AddModifiedElement(originalIndex + 1, modifiedIndex + 1);
9578 diagonalRelative = diagonal - 1 - diagonalReverseBase;
9580 if (historyIndex >= 0) {
9581 reversePoints = this.m_reverseHistory[historyIndex];
9582 diagonalReverseBase = reversePoints[0];
9584 diagonalMax = reversePoints.length - 1;
9586 } while (--historyIndex >= -1);
9587 reverseChanges = changeHelper.getChanges();
9589 return this.ConcatenateChanges(forwardChanges, reverseChanges);
9591 ComputeRecursionPoint(originalStart, originalEnd, modifiedStart, modifiedEnd, midOriginalArr, midModifiedArr, quitEarlyArr) {
9592 let originalIndex = 0, modifiedIndex = 0;
9593 let diagonalForwardStart = 0, diagonalForwardEnd = 0;
9594 let diagonalReverseStart = 0, diagonalReverseEnd = 0;
9597 midOriginalArr[0] = 0;
9598 midModifiedArr[0] = 0;
9599 this.m_forwardHistory = [];
9600 this.m_reverseHistory = [];
9601 const maxDifferences = originalEnd - originalStart + (modifiedEnd - modifiedStart);
9602 const numDiagonals = maxDifferences + 1;
9603 const forwardPoints = new Int32Array(numDiagonals);
9604 const reversePoints = new Int32Array(numDiagonals);
9605 const diagonalForwardBase = modifiedEnd - modifiedStart;
9606 const diagonalReverseBase = originalEnd - originalStart;
9607 const diagonalForwardOffset = originalStart - modifiedStart;
9608 const diagonalReverseOffset = originalEnd - modifiedEnd;
9609 const delta = diagonalReverseBase - diagonalForwardBase;
9610 const deltaIsEven = delta % 2 === 0;
9611 forwardPoints[diagonalForwardBase] = originalStart;
9612 reversePoints[diagonalReverseBase] = originalEnd;
9613 quitEarlyArr[0] = false;
9614 for (let numDifferences = 1; numDifferences <= maxDifferences / 2 + 1; numDifferences++) {
9615 let furthestOriginalIndex = 0;
9616 let furthestModifiedIndex = 0;
9617 diagonalForwardStart = this.ClipDiagonalBound(diagonalForwardBase - numDifferences, numDifferences, diagonalForwardBase, numDiagonals);
9618 diagonalForwardEnd = this.ClipDiagonalBound(diagonalForwardBase + numDifferences, numDifferences, diagonalForwardBase, numDiagonals);
9619 for (let diagonal = diagonalForwardStart; diagonal <= diagonalForwardEnd; diagonal += 2) {
9620 if (diagonal === diagonalForwardStart || diagonal < diagonalForwardEnd && forwardPoints[diagonal - 1] < forwardPoints[diagonal + 1]) {
9621 originalIndex = forwardPoints[diagonal + 1];
9623 originalIndex = forwardPoints[diagonal - 1] + 1;
9625 modifiedIndex = originalIndex - (diagonal - diagonalForwardBase) - diagonalForwardOffset;
9626 const tempOriginalIndex = originalIndex;
9627 while (originalIndex < originalEnd && modifiedIndex < modifiedEnd && this.ElementsAreEqual(originalIndex + 1, modifiedIndex + 1)) {
9631 forwardPoints[diagonal] = originalIndex;
9632 if (originalIndex + modifiedIndex > furthestOriginalIndex + furthestModifiedIndex) {
9633 furthestOriginalIndex = originalIndex;
9634 furthestModifiedIndex = modifiedIndex;
9636 if (!deltaIsEven && Math.abs(diagonal - diagonalReverseBase) <= numDifferences - 1) {
9637 if (originalIndex >= reversePoints[diagonal]) {
9638 midOriginalArr[0] = originalIndex;
9639 midModifiedArr[0] = modifiedIndex;
9640 if (tempOriginalIndex <= reversePoints[diagonal] && 1447 > 0 && numDifferences <= 1447 + 1) {
9641 return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
9648 const matchLengthOfLongest = (furthestOriginalIndex - originalStart + (furthestModifiedIndex - modifiedStart) - numDifferences) / 2;
9649 if (this.ContinueProcessingPredicate !== null && !this.ContinueProcessingPredicate(furthestOriginalIndex, matchLengthOfLongest)) {
9650 quitEarlyArr[0] = true;
9651 midOriginalArr[0] = furthestOriginalIndex;
9652 midModifiedArr[0] = furthestModifiedIndex;
9653 if (matchLengthOfLongest > 0 && 1447 > 0 && numDifferences <= 1447 + 1) {
9654 return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
9659 new DiffChange(originalStart, originalEnd - originalStart + 1, modifiedStart, modifiedEnd - modifiedStart + 1)
9663 diagonalReverseStart = this.ClipDiagonalBound(diagonalReverseBase - numDifferences, numDifferences, diagonalReverseBase, numDiagonals);
9664 diagonalReverseEnd = this.ClipDiagonalBound(diagonalReverseBase + numDifferences, numDifferences, diagonalReverseBase, numDiagonals);
9665 for (let diagonal = diagonalReverseStart; diagonal <= diagonalReverseEnd; diagonal += 2) {
9666 if (diagonal === diagonalReverseStart || diagonal < diagonalReverseEnd && reversePoints[diagonal - 1] >= reversePoints[diagonal + 1]) {
9667 originalIndex = reversePoints[diagonal + 1] - 1;
9669 originalIndex = reversePoints[diagonal - 1];
9671 modifiedIndex = originalIndex - (diagonal - diagonalReverseBase) - diagonalReverseOffset;
9672 const tempOriginalIndex = originalIndex;
9673 while (originalIndex > originalStart && modifiedIndex > modifiedStart && this.ElementsAreEqual(originalIndex, modifiedIndex)) {
9677 reversePoints[diagonal] = originalIndex;
9678 if (deltaIsEven && Math.abs(diagonal - diagonalForwardBase) <= numDifferences) {
9679 if (originalIndex <= forwardPoints[diagonal]) {
9680 midOriginalArr[0] = originalIndex;
9681 midModifiedArr[0] = modifiedIndex;
9682 if (tempOriginalIndex >= forwardPoints[diagonal] && 1447 > 0 && numDifferences <= 1447 + 1) {
9683 return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
9690 if (numDifferences <= 1447) {
9691 let temp = new Int32Array(diagonalForwardEnd - diagonalForwardStart + 2);
9692 temp[0] = diagonalForwardBase - diagonalForwardStart + 1;
9693 MyArray.Copy2(forwardPoints, diagonalForwardStart, temp, 1, diagonalForwardEnd - diagonalForwardStart + 1);
9694 this.m_forwardHistory.push(temp);
9695 temp = new Int32Array(diagonalReverseEnd - diagonalReverseStart + 2);
9696 temp[0] = diagonalReverseBase - diagonalReverseStart + 1;
9697 MyArray.Copy2(reversePoints, diagonalReverseStart, temp, 1, diagonalReverseEnd - diagonalReverseStart + 1);
9698 this.m_reverseHistory.push(temp);
9701 return this.WALKTRACE(diagonalForwardBase, diagonalForwardStart, diagonalForwardEnd, diagonalForwardOffset, diagonalReverseBase, diagonalReverseStart, diagonalReverseEnd, diagonalReverseOffset, forwardPoints, reversePoints, originalIndex, originalEnd, midOriginalArr, modifiedIndex, modifiedEnd, midModifiedArr, deltaIsEven, quitEarlyArr);
9703 PrettifyChanges(changes) {
9704 for (let i = 0; i < changes.length; i++) {
9705 const change = changes[i];
9706 const originalStop = i < changes.length - 1 ? changes[i + 1].originalStart : this._originalElementsOrHash.length;
9707 const modifiedStop = i < changes.length - 1 ? changes[i + 1].modifiedStart : this._modifiedElementsOrHash.length;
9708 const checkOriginal = change.originalLength > 0;
9709 const checkModified = change.modifiedLength > 0;
9710 while (change.originalStart + change.originalLength < originalStop && change.modifiedStart + change.modifiedLength < modifiedStop && (!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength)) && (!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {
9711 change.originalStart++;
9712 change.modifiedStart++;
9714 let mergedChangeArr = [null];
9715 if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {
9716 changes[i] = mergedChangeArr[0];
9717 changes.splice(i + 1, 1);
9722 for (let i = changes.length - 1; i >= 0; i--) {
9723 const change = changes[i];
9724 let originalStop = 0;
9725 let modifiedStop = 0;
9727 const prevChange = changes[i - 1];
9728 if (prevChange.originalLength > 0) {
9729 originalStop = prevChange.originalStart + prevChange.originalLength;
9731 if (prevChange.modifiedLength > 0) {
9732 modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;
9735 const checkOriginal = change.originalLength > 0;
9736 const checkModified = change.modifiedLength > 0;
9738 let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);
9739 for (let delta = 1; ; delta++) {
9740 const originalStart = change.originalStart - delta;
9741 const modifiedStart = change.modifiedStart - delta;
9742 if (originalStart < originalStop || modifiedStart < modifiedStop) {
9745 if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {
9748 if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {
9751 const score = this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength);
9752 if (score > bestScore) {
9757 change.originalStart -= bestDelta;
9758 change.modifiedStart -= bestDelta;
9762 _OriginalIsBoundary(index) {
9763 if (index <= 0 || index >= this._originalElementsOrHash.length - 1) {
9766 return this._hasStrings && /^\s*$/.test(this._originalStringElements[index]);
9768 _OriginalRegionIsBoundary(originalStart, originalLength) {
9769 if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {
9772 if (originalLength > 0) {
9773 const originalEnd = originalStart + originalLength;
9774 if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {
9780 _ModifiedIsBoundary(index) {
9781 if (index <= 0 || index >= this._modifiedElementsOrHash.length - 1) {
9784 return this._hasStrings && /^\s*$/.test(this._modifiedStringElements[index]);
9786 _ModifiedRegionIsBoundary(modifiedStart, modifiedLength) {
9787 if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {
9790 if (modifiedLength > 0) {
9791 const modifiedEnd = modifiedStart + modifiedLength;
9792 if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {
9798 _boundaryScore(originalStart, originalLength, modifiedStart, modifiedLength) {
9799 const originalScore = this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0;
9800 const modifiedScore = this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0;
9801 return originalScore + modifiedScore;
9803 ConcatenateChanges(left, right) {
9804 let mergedChangeArr = [];
9805 if (left.length === 0 || right.length === 0) {
9806 return right.length > 0 ? right : left;
9807 } else if (this.ChangesOverlap(left[left.length - 1], right[0], mergedChangeArr)) {
9808 const result = new Array(left.length + right.length - 1);
9809 MyArray.Copy(left, 0, result, 0, left.length - 1);
9810 result[left.length - 1] = mergedChangeArr[0];
9811 MyArray.Copy(right, 1, result, left.length, right.length - 1);
9814 const result = new Array(left.length + right.length);
9815 MyArray.Copy(left, 0, result, 0, left.length);
9816 MyArray.Copy(right, 0, result, left.length, right.length);
9820 ChangesOverlap(left, right, mergedChangeArr) {
9821 Debug.Assert(left.originalStart <= right.originalStart, "Left change is not less than or equal to right change");
9822 Debug.Assert(left.modifiedStart <= right.modifiedStart, "Left change is not less than or equal to right change");
9823 if (left.originalStart + left.originalLength >= right.originalStart || left.modifiedStart + left.modifiedLength >= right.modifiedStart) {
9824 const originalStart = left.originalStart;
9825 let originalLength = left.originalLength;
9826 const modifiedStart = left.modifiedStart;
9827 let modifiedLength = left.modifiedLength;
9828 if (left.originalStart + left.originalLength >= right.originalStart) {
9829 originalLength = right.originalStart + right.originalLength - left.originalStart;
9831 if (left.modifiedStart + left.modifiedLength >= right.modifiedStart) {
9832 modifiedLength = right.modifiedStart + right.modifiedLength - left.modifiedStart;
9834 mergedChangeArr[0] = new DiffChange(originalStart, originalLength, modifiedStart, modifiedLength);
9837 mergedChangeArr[0] = null;
9841 ClipDiagonalBound(diagonal, numDifferences, diagonalBaseIndex, numDiagonals) {
9842 if (diagonal >= 0 && diagonal < numDiagonals) {
9845 const diagonalsBelow = diagonalBaseIndex;
9846 const diagonalsAbove = numDiagonals - diagonalBaseIndex - 1;
9847 const diffEven = numDifferences % 2 === 0;
9849 const lowerBoundEven = diagonalsBelow % 2 === 0;
9850 return diffEven === lowerBoundEven ? 0 : 1;
9852 const upperBoundEven = diagonalsAbove % 2 === 0;
9853 return diffEven === upperBoundEven ? numDiagonals - 1 : numDiagonals - 2;
9858 // entry-ns:server.ts
9859 require_eslintServer();
9860 //# sourceMappingURL=server.js.map