1 (function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
2 /******/ (() => { // webpackBootstrap
4 /******/ var __webpack_modules__ = ([
6 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
9 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11 return new (P || (P = Promise))(function (resolve, reject) {
12 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 Object.defineProperty(exports, "__esModule", ({ value: true }));
19 exports.activate = void 0;
20 const coc_nvim_1 = __webpack_require__(1);
21 const customData_1 = __webpack_require__(2);
22 const vscode_languageserver_protocol_1 = __webpack_require__(4);
23 const tagClosing_1 = __webpack_require__(46);
25 (function (TagCloseRequest) {
26 TagCloseRequest.type = new vscode_languageserver_protocol_1.RequestType('html/tag');
27 })(TagCloseRequest || (TagCloseRequest = {}));
28 function realActivate(context, filetypes) {
29 let { subscriptions } = context;
30 const config = coc_nvim_1.workspace.getConfiguration().get('html', {});
31 const file = context.asAbsolutePath('lib/server.js');
32 const selector = filetypes.map(id => {
33 return { language: id };
35 const embeddedLanguages = { css: true, javascript: true };
39 transport: coc_nvim_1.TransportKind.ipc,
41 cwd: coc_nvim_1.workspace.root,
42 execArgv: config.execArgv || []
46 ...customData_1.getCustomDataPathsInAllWorkspaces(),
47 ...customData_1.getCustomDataPathsFromAllExtensions()
50 documentSelector: selector,
52 configurationSection: ['html', 'css', 'javascript']
54 outputChannelName: 'html',
55 initializationOptions: {
60 let client = new coc_nvim_1.LanguageClient('html', 'HTML language server', serverOptions, clientOptions);
61 client.onReady().then(() => {
62 context.subscriptions.push(coc_nvim_1.languages.registerSelectionRangeProvider(selector, {
63 provideSelectionRanges(document, positions) {
64 return __awaiter(this, void 0, void 0, function* () {
65 const textDocument = { uri: document.uri };
66 return yield Promise.resolve(client.sendRequest('$/textDocument/selectionRanges', { textDocument, positions }));
70 const tagRequestor = (document, position) => {
77 return client.sendRequest(TagCloseRequest.type, param);
79 context.subscriptions.push(tagClosing_1.activateTagClosing(tagRequestor, filetypes, 'html.autoClosingTags'));
83 subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
85 function activate(context) {
86 return __awaiter(this, void 0, void 0, function* () {
87 const config = coc_nvim_1.workspace.getConfiguration('html');
88 const enable = config.get('enable', true);
91 const filetypes = config.get('filetypes', ['html', 'handlebars', 'htmldjango', 'blade']);
92 let activated = false;
93 for (let doc of coc_nvim_1.workspace.textDocuments) {
94 if (filetypes.includes(doc.languageId) && !activated) {
96 realActivate(context, filetypes);
100 let disposable = coc_nvim_1.workspace.onDidOpenTextDocument(e => {
101 if (activated || !filetypes.includes(e.languageId))
103 disposable.dispose();
105 realActivate(context, filetypes);
106 }, null, context.subscriptions);
110 exports.activate = activate;
117 module.exports = require("coc.nvim");;
121 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
124 /*---------------------------------------------------------------------------------------------
125 * Copyright (c) Microsoft Corporation. All rights reserved.
126 * Licensed under the MIT License. See License.txt in the project root for license information.
127 *--------------------------------------------------------------------------------------------*/
128 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
129 if (k2 === undefined) k2 = k;
130 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
131 }) : (function(o, m, k, k2) {
132 if (k2 === undefined) k2 = k;
135 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
136 Object.defineProperty(o, "default", { enumerable: true, value: v });
137 }) : function(o, v) {
140 var __importStar = (this && this.__importStar) || function (mod) {
141 if (mod && mod.__esModule) return mod;
143 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
144 __setModuleDefault(result, mod);
147 Object.defineProperty(exports, "__esModule", ({ value: true }));
148 exports.getCustomDataPathsFromAllExtensions = exports.getCustomDataPathsInAllWorkspaces = void 0;
149 const path = __importStar(__webpack_require__(3));
150 const coc_nvim_1 = __webpack_require__(1);
151 function getCustomDataPathsInAllWorkspaces() {
152 const dataPaths = [];
153 const workspaceFolders = coc_nvim_1.workspace.workspaceFolders;
154 if (!workspaceFolders) {
157 workspaceFolders.forEach(wf => {
158 const allHtmlConfig = coc_nvim_1.workspace.getConfiguration(undefined, wf.uri);
159 const wfHtmlConfig = allHtmlConfig.inspect('html');
161 wfHtmlConfig.workspaceFolderValue &&
162 wfHtmlConfig.workspaceFolderValue.experimental &&
163 wfHtmlConfig.workspaceFolderValue.experimental.customData) {
164 const customData = wfHtmlConfig.workspaceFolderValue.experimental.customData;
165 if (Array.isArray(customData)) {
166 customData.forEach(t => {
167 if (typeof t === 'string') {
168 dataPaths.push(path.resolve(coc_nvim_1.Uri.parse(wf.uri).fsPath, t));
176 exports.getCustomDataPathsInAllWorkspaces = getCustomDataPathsInAllWorkspaces;
177 function getCustomDataPathsFromAllExtensions() {
178 const dataPaths = [];
179 for (const extension of coc_nvim_1.extensions.all) {
180 const contributes = extension.packageJSON && extension.packageJSON.contributes;
183 contributes.html.experimental.customData &&
184 Array.isArray(contributes.html.experimental.customData)) {
185 const relativePaths = contributes.html.experimental.customData;
186 relativePaths.forEach(rp => {
187 dataPaths.push(path.resolve(extension.extensionPath, rp));
193 exports.getCustomDataPathsFromAllExtensions = getCustomDataPathsFromAllExtensions;
200 module.exports = require("path");;
204 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
207 /* --------------------------------------------------------------------------------------------
208 * Copyright (c) Microsoft Corporation. All rights reserved.
209 * Licensed under the MIT License. See License.txt in the project root for license information.
210 * ------------------------------------------------------------------------------------------ */
211 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
212 if (k2 === undefined) k2 = k;
213 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
214 }) : (function(o, m, k, k2) {
215 if (k2 === undefined) k2 = k;
218 var __exportStar = (this && this.__exportStar) || function(m, exports) {
219 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
221 Object.defineProperty(exports, "__esModule", ({ value: true }));
222 exports.createProtocolConnection = void 0;
223 const node_1 = __webpack_require__(5);
224 __exportStar(__webpack_require__(5), exports);
225 __exportStar(__webpack_require__(25), exports);
226 function createProtocolConnection(input, output, logger, options) {
227 return node_1.createMessageConnection(input, output, logger, options);
229 exports.createProtocolConnection = createProtocolConnection;
230 //# sourceMappingURL=main.js.map
234 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
236 /* --------------------------------------------------------------------------------------------
237 * Copyright (c) Microsoft Corporation. All rights reserved.
238 * Licensed under the MIT License. See License.txt in the project root for license information.
239 * ----------------------------------------------------------------------------------------- */
242 module.exports = __webpack_require__(6);
246 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
249 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
250 if (k2 === undefined) k2 = k;
251 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
252 }) : (function(o, m, k, k2) {
253 if (k2 === undefined) k2 = k;
256 var __exportStar = (this && this.__exportStar) || function(m, exports) {
257 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
259 Object.defineProperty(exports, "__esModule", ({ value: true }));
260 exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;
261 /* --------------------------------------------------------------------------------------------
262 * Copyright (c) Microsoft Corporation. All rights reserved.
263 * Licensed under the MIT License. See License.txt in the project root for license information.
264 * ----------------------------------------------------------------------------------------- */
265 const ril_1 = __webpack_require__(7);
266 // Install the node runtime abstract.
267 ril_1.default.install();
268 const api_1 = __webpack_require__(12);
269 const path = __webpack_require__(3);
270 const os = __webpack_require__(22);
271 const crypto_1 = __webpack_require__(23);
272 const net_1 = __webpack_require__(24);
273 __exportStar(__webpack_require__(12), exports);
274 class IPCMessageReader extends api_1.AbstractMessageReader {
275 constructor(process) {
277 this.process = process;
278 let eventEmitter = this.process;
279 eventEmitter.on('error', (error) => this.fireError(error));
280 eventEmitter.on('close', () => this.fireClose());
283 this.process.on('message', callback);
284 return api_1.Disposable.create(() => this.process.off('message', callback));
287 exports.IPCMessageReader = IPCMessageReader;
288 class IPCMessageWriter extends api_1.AbstractMessageWriter {
289 constructor(process) {
291 this.process = process;
293 let eventEmitter = this.process;
294 eventEmitter.on('error', (error) => this.fireError(error));
295 eventEmitter.on('close', () => this.fireClose);
299 if (typeof this.process.send === 'function') {
300 this.process.send(msg, undefined, undefined, (error) => {
303 this.handleError(error, msg);
310 return Promise.resolve();
313 this.handleError(error, msg);
314 return Promise.reject(error);
317 handleError(error, msg) {
319 this.fireError(error, msg, this.errorCount);
324 exports.IPCMessageWriter = IPCMessageWriter;
325 class SocketMessageReader extends api_1.ReadableStreamMessageReader {
326 constructor(socket, encoding = 'utf-8') {
327 super(ril_1.default().stream.asReadableStream(socket), encoding);
330 exports.SocketMessageReader = SocketMessageReader;
331 class SocketMessageWriter extends api_1.WriteableStreamMessageWriter {
332 constructor(socket, options) {
333 super(ril_1.default().stream.asWritableStream(socket), options);
334 this.socket = socket;
338 this.socket.destroy();
341 exports.SocketMessageWriter = SocketMessageWriter;
342 class StreamMessageReader extends api_1.ReadableStreamMessageReader {
343 constructor(readble, encoding) {
344 super(ril_1.default().stream.asReadableStream(readble), encoding);
347 exports.StreamMessageReader = StreamMessageReader;
348 class StreamMessageWriter extends api_1.WriteableStreamMessageWriter {
349 constructor(writable, options) {
350 super(ril_1.default().stream.asWritableStream(writable), options);
353 exports.StreamMessageWriter = StreamMessageWriter;
354 const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR'];
355 const safeIpcPathLengths = new Map([
359 function generateRandomPipeName() {
360 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
361 if (process.platform === 'win32') {
362 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
365 if (XDG_RUNTIME_DIR) {
366 result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
369 result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
371 const limit = safeIpcPathLengths.get(process.platform);
372 if (limit !== undefined && result.length >= limit) {
373 ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
377 exports.generateRandomPipeName = generateRandomPipeName;
378 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
380 const connected = new Promise((resolve, _reject) => {
381 connectResolve = resolve;
383 return new Promise((resolve, reject) => {
384 let server = net_1.createServer((socket) => {
387 new SocketMessageReader(socket, encoding),
388 new SocketMessageWriter(socket, encoding)
391 server.on('error', reject);
392 server.listen(pipeName, () => {
393 server.removeListener('error', reject);
395 onConnected: () => { return connected; }
400 exports.createClientPipeTransport = createClientPipeTransport;
401 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
402 const socket = net_1.createConnection(pipeName);
404 new SocketMessageReader(socket, encoding),
405 new SocketMessageWriter(socket, encoding)
408 exports.createServerPipeTransport = createServerPipeTransport;
409 function createClientSocketTransport(port, encoding = 'utf-8') {
411 const connected = new Promise((resolve, _reject) => {
412 connectResolve = resolve;
414 return new Promise((resolve, reject) => {
415 const server = net_1.createServer((socket) => {
418 new SocketMessageReader(socket, encoding),
419 new SocketMessageWriter(socket, encoding)
422 server.on('error', reject);
423 server.listen(port, '127.0.0.1', () => {
424 server.removeListener('error', reject);
426 onConnected: () => { return connected; }
431 exports.createClientSocketTransport = createClientSocketTransport;
432 function createServerSocketTransport(port, encoding = 'utf-8') {
433 const socket = net_1.createConnection(port, '127.0.0.1');
435 new SocketMessageReader(socket, encoding),
436 new SocketMessageWriter(socket, encoding)
439 exports.createServerSocketTransport = createServerSocketTransport;
440 function isReadableStream(value) {
441 const candidate = value;
442 return candidate.read !== undefined && candidate.addListener !== undefined;
444 function isWritableStream(value) {
445 const candidate = value;
446 return candidate.write !== undefined && candidate.addListener !== undefined;
448 function createMessageConnection(input, output, logger, options) {
450 logger = api_1.NullLogger;
452 const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
453 const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
454 if (api_1.ConnectionStrategy.is(options)) {
455 options = { connectionStrategy: options };
457 return api_1.createMessageConnection(reader, writer, logger, options);
459 exports.createMessageConnection = createMessageConnection;
460 //# sourceMappingURL=main.js.map
464 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
467 /* --------------------------------------------------------------------------------------------
468 * Copyright (c) Microsoft Corporation. All rights reserved.
469 * Licensed under the MIT License. See License.txt in the project root for license information.
470 * ------------------------------------------------------------------------------------------ */
471 Object.defineProperty(exports, "__esModule", ({ value: true }));
472 const ral_1 = __webpack_require__(8);
473 const util_1 = __webpack_require__(9);
474 const disposable_1 = __webpack_require__(10);
475 const messageBuffer_1 = __webpack_require__(11);
476 class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer {
477 constructor(encoding = 'utf-8') {
481 return MessageBuffer.emptyBuffer;
483 fromString(value, encoding) {
484 return Buffer.from(value, encoding);
486 toString(value, encoding) {
487 if (value instanceof Buffer) {
488 return value.toString(encoding);
491 return new util_1.TextDecoder(encoding).decode(value);
494 asNative(buffer, length) {
495 if (length === undefined) {
496 return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
499 return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
502 allocNative(length) {
503 return Buffer.allocUnsafe(length);
506 MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
507 class ReadableStreamWrapper {
508 constructor(stream) {
509 this.stream = stream;
512 this.stream.on('close', listener);
513 return disposable_1.Disposable.create(() => this.stream.off('close', listener));
516 this.stream.on('error', listener);
517 return disposable_1.Disposable.create(() => this.stream.off('error', listener));
520 this.stream.on('end', listener);
521 return disposable_1.Disposable.create(() => this.stream.off('end', listener));
524 this.stream.on('data', listener);
525 return disposable_1.Disposable.create(() => this.stream.off('data', listener));
528 class WritableStreamWrapper {
529 constructor(stream) {
530 this.stream = stream;
533 this.stream.on('close', listener);
534 return disposable_1.Disposable.create(() => this.stream.off('close', listener));
537 this.stream.on('error', listener);
538 return disposable_1.Disposable.create(() => this.stream.off('error', listener));
541 this.stream.on('end', listener);
542 return disposable_1.Disposable.create(() => this.stream.off('end', listener));
544 write(data, encoding) {
545 return new Promise((resolve, reject) => {
546 const callback = (error) => {
547 if (error === undefined || error === null) {
554 if (typeof data === 'string') {
555 this.stream.write(data, encoding, callback);
558 this.stream.write(data, callback);
566 const _ril = Object.freeze({
567 messageBuffer: Object.freeze({
568 create: (encoding) => new MessageBuffer(encoding)
570 applicationJson: Object.freeze({
571 encoder: Object.freeze({
572 name: 'application/json',
573 encode: (msg, options) => {
575 return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
578 return Promise.reject(err);
582 decoder: Object.freeze({
583 name: 'application/json',
584 decode: (buffer, options) => {
586 if (buffer instanceof Buffer) {
587 return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
590 return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
594 return Promise.reject(err);
599 stream: Object.freeze({
600 asReadableStream: (stream) => new ReadableStreamWrapper(stream),
601 asWritableStream: (stream) => new WritableStreamWrapper(stream)
604 timer: Object.freeze({
605 setTimeout(callback, ms, ...args) {
606 return setTimeout(callback, ms, ...args);
608 clearTimeout(handle) {
609 clearTimeout(handle);
611 setImmediate(callback, ...args) {
612 return setImmediate(callback, ...args);
614 clearImmediate(handle) {
615 clearImmediate(handle);
624 ral_1.default.install(_ril);
626 RIL.install = install;
627 })(RIL || (RIL = {}));
628 exports.default = RIL;
629 //# sourceMappingURL=ril.js.map
633 /***/ ((__unused_webpack_module, exports) => {
636 /* --------------------------------------------------------------------------------------------
637 * Copyright (c) Microsoft Corporation. All rights reserved.
638 * Licensed under the MIT License. See License.txt in the project root for license information.
639 * ------------------------------------------------------------------------------------------ */
640 Object.defineProperty(exports, "__esModule", ({ value: true }));
643 if (_ral === undefined) {
644 throw new Error(`No runtime abstraction layer installed`);
649 function install(ral) {
650 if (ral === undefined) {
651 throw new Error(`No runtime abstraction layer provided`);
655 RAL.install = install;
656 })(RAL || (RAL = {}));
657 exports.default = RAL;
658 //# sourceMappingURL=ral.js.map
664 module.exports = require("util");;
668 /***/ ((__unused_webpack_module, exports) => {
671 /*---------------------------------------------------------------------------------------------
672 * Copyright (c) Microsoft Corporation. All rights reserved.
673 * Licensed under the MIT License. See License.txt in the project root for license information.
674 *--------------------------------------------------------------------------------------------*/
675 Object.defineProperty(exports, "__esModule", ({ value: true }));
676 exports.Disposable = void 0;
678 (function (Disposable) {
679 function create(func) {
684 Disposable.create = create;
685 })(Disposable = exports.Disposable || (exports.Disposable = {}));
686 //# sourceMappingURL=disposable.js.map
690 /***/ ((__unused_webpack_module, exports) => {
693 /*---------------------------------------------------------------------------------------------
694 * Copyright (c) Microsoft Corporation. All rights reserved.
695 * Licensed under the MIT License. See License.txt in the project root for license information.
696 *--------------------------------------------------------------------------------------------*/
697 Object.defineProperty(exports, "__esModule", ({ value: true }));
698 exports.AbstractMessageBuffer = void 0;
702 class AbstractMessageBuffer {
703 constructor(encoding = 'utf-8') {
704 this._encoding = encoding;
706 this._totalLength = 0;
709 return this._encoding;
712 const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;
713 this._chunks.push(toAppend);
714 this._totalLength += toAppend.byteLength;
717 if (this._chunks.length === 0) {
723 let chunkBytesRead = 0;
724 row: while (chunkIndex < this._chunks.length) {
725 const chunk = this._chunks[chunkIndex];
727 column: while (offset < chunk.length) {
728 const value = chunk[offset];
760 chunkBytesRead += chunk.byteLength;
766 // The buffer contains the two CRLF at the end. So we will
767 // have two empty lines after the split at the end as well.
768 const buffer = this._read(chunkBytesRead + offset);
769 const result = new Map();
770 const headers = this.toString(buffer, 'ascii').split(CRLF);
771 if (headers.length < 2) {
774 for (let i = 0; i < headers.length - 2; i++) {
775 const header = headers[i];
776 const index = header.indexOf(':');
778 throw new Error('Message header must separate key and value using :');
780 const key = header.substr(0, index);
781 const value = header.substr(index + 1).trim();
782 result.set(key, value);
786 tryReadBody(length) {
787 if (this._totalLength < length) {
790 return this._read(length);
792 get numberOfBytes() {
793 return this._totalLength;
796 if (byteCount === 0) {
797 return this.emptyBuffer();
799 if (byteCount > this._totalLength) {
800 throw new Error(`Cannot read so many bytes!`);
802 if (this._chunks[0].byteLength === byteCount) {
803 // super fast path, precisely first chunk must be returned
804 const chunk = this._chunks[0];
805 this._chunks.shift();
806 this._totalLength -= byteCount;
807 return this.asNative(chunk);
809 if (this._chunks[0].byteLength > byteCount) {
810 // fast path, the reading is entirely within the first chunk
811 const chunk = this._chunks[0];
812 const result = this.asNative(chunk, byteCount);
813 this._chunks[0] = chunk.slice(byteCount);
814 this._totalLength -= byteCount;
817 const result = this.allocNative(byteCount);
818 let resultOffset = 0;
820 while (byteCount > 0) {
821 const chunk = this._chunks[chunkIndex];
822 if (chunk.byteLength > byteCount) {
823 // this chunk will survive
824 const chunkPart = chunk.slice(0, byteCount);
825 result.set(chunkPart, resultOffset);
826 resultOffset += byteCount;
827 this._chunks[chunkIndex] = chunk.slice(byteCount);
828 this._totalLength -= byteCount;
829 byteCount -= byteCount;
832 // this chunk will be entirely read
833 result.set(chunk, resultOffset);
834 resultOffset += chunk.byteLength;
835 this._chunks.shift();
836 this._totalLength -= chunk.byteLength;
837 byteCount -= chunk.byteLength;
843 exports.AbstractMessageBuffer = AbstractMessageBuffer;
844 //# sourceMappingURL=messageBuffer.js.map
848 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
851 /* --------------------------------------------------------------------------------------------
852 * Copyright (c) Microsoft Corporation. All rights reserved.
853 * Licensed under the MIT License. See License.txt in the project root for license information.
854 * ------------------------------------------------------------------------------------------ */
855 /// <reference path="../../typings/thenable.d.ts" />
856 Object.defineProperty(exports, "__esModule", ({ value: true }));
857 exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0;
858 exports.CancellationStrategy = void 0;
859 const messages_1 = __webpack_require__(13);
860 Object.defineProperty(exports, "RequestType", ({ enumerable: true, get: function () { return messages_1.RequestType; } }));
861 Object.defineProperty(exports, "RequestType0", ({ enumerable: true, get: function () { return messages_1.RequestType0; } }));
862 Object.defineProperty(exports, "RequestType1", ({ enumerable: true, get: function () { return messages_1.RequestType1; } }));
863 Object.defineProperty(exports, "RequestType2", ({ enumerable: true, get: function () { return messages_1.RequestType2; } }));
864 Object.defineProperty(exports, "RequestType3", ({ enumerable: true, get: function () { return messages_1.RequestType3; } }));
865 Object.defineProperty(exports, "RequestType4", ({ enumerable: true, get: function () { return messages_1.RequestType4; } }));
866 Object.defineProperty(exports, "RequestType5", ({ enumerable: true, get: function () { return messages_1.RequestType5; } }));
867 Object.defineProperty(exports, "RequestType6", ({ enumerable: true, get: function () { return messages_1.RequestType6; } }));
868 Object.defineProperty(exports, "RequestType7", ({ enumerable: true, get: function () { return messages_1.RequestType7; } }));
869 Object.defineProperty(exports, "RequestType8", ({ enumerable: true, get: function () { return messages_1.RequestType8; } }));
870 Object.defineProperty(exports, "RequestType9", ({ enumerable: true, get: function () { return messages_1.RequestType9; } }));
871 Object.defineProperty(exports, "ResponseError", ({ enumerable: true, get: function () { return messages_1.ResponseError; } }));
872 Object.defineProperty(exports, "ErrorCodes", ({ enumerable: true, get: function () { return messages_1.ErrorCodes; } }));
873 Object.defineProperty(exports, "NotificationType", ({ enumerable: true, get: function () { return messages_1.NotificationType; } }));
874 Object.defineProperty(exports, "NotificationType0", ({ enumerable: true, get: function () { return messages_1.NotificationType0; } }));
875 Object.defineProperty(exports, "NotificationType1", ({ enumerable: true, get: function () { return messages_1.NotificationType1; } }));
876 Object.defineProperty(exports, "NotificationType2", ({ enumerable: true, get: function () { return messages_1.NotificationType2; } }));
877 Object.defineProperty(exports, "NotificationType3", ({ enumerable: true, get: function () { return messages_1.NotificationType3; } }));
878 Object.defineProperty(exports, "NotificationType4", ({ enumerable: true, get: function () { return messages_1.NotificationType4; } }));
879 Object.defineProperty(exports, "NotificationType5", ({ enumerable: true, get: function () { return messages_1.NotificationType5; } }));
880 Object.defineProperty(exports, "NotificationType6", ({ enumerable: true, get: function () { return messages_1.NotificationType6; } }));
881 Object.defineProperty(exports, "NotificationType7", ({ enumerable: true, get: function () { return messages_1.NotificationType7; } }));
882 Object.defineProperty(exports, "NotificationType8", ({ enumerable: true, get: function () { return messages_1.NotificationType8; } }));
883 Object.defineProperty(exports, "NotificationType9", ({ enumerable: true, get: function () { return messages_1.NotificationType9; } }));
884 Object.defineProperty(exports, "ParameterStructures", ({ enumerable: true, get: function () { return messages_1.ParameterStructures; } }));
885 const disposable_1 = __webpack_require__(10);
886 Object.defineProperty(exports, "Disposable", ({ enumerable: true, get: function () { return disposable_1.Disposable; } }));
887 const events_1 = __webpack_require__(15);
888 Object.defineProperty(exports, "Event", ({ enumerable: true, get: function () { return events_1.Event; } }));
889 Object.defineProperty(exports, "Emitter", ({ enumerable: true, get: function () { return events_1.Emitter; } }));
890 const cancellation_1 = __webpack_require__(16);
891 Object.defineProperty(exports, "CancellationTokenSource", ({ enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } }));
892 Object.defineProperty(exports, "CancellationToken", ({ enumerable: true, get: function () { return cancellation_1.CancellationToken; } }));
893 const messageReader_1 = __webpack_require__(17);
894 Object.defineProperty(exports, "MessageReader", ({ enumerable: true, get: function () { return messageReader_1.MessageReader; } }));
895 Object.defineProperty(exports, "AbstractMessageReader", ({ enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } }));
896 Object.defineProperty(exports, "ReadableStreamMessageReader", ({ enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } }));
897 const messageWriter_1 = __webpack_require__(18);
898 Object.defineProperty(exports, "MessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.MessageWriter; } }));
899 Object.defineProperty(exports, "AbstractMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } }));
900 Object.defineProperty(exports, "WriteableStreamMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } }));
901 const connection_1 = __webpack_require__(20);
902 Object.defineProperty(exports, "ConnectionStrategy", ({ enumerable: true, get: function () { return connection_1.ConnectionStrategy; } }));
903 Object.defineProperty(exports, "ConnectionOptions", ({ enumerable: true, get: function () { return connection_1.ConnectionOptions; } }));
904 Object.defineProperty(exports, "NullLogger", ({ enumerable: true, get: function () { return connection_1.NullLogger; } }));
905 Object.defineProperty(exports, "createMessageConnection", ({ enumerable: true, get: function () { return connection_1.createMessageConnection; } }));
906 Object.defineProperty(exports, "ProgressType", ({ enumerable: true, get: function () { return connection_1.ProgressType; } }));
907 Object.defineProperty(exports, "Trace", ({ enumerable: true, get: function () { return connection_1.Trace; } }));
908 Object.defineProperty(exports, "TraceFormat", ({ enumerable: true, get: function () { return connection_1.TraceFormat; } }));
909 Object.defineProperty(exports, "SetTraceNotification", ({ enumerable: true, get: function () { return connection_1.SetTraceNotification; } }));
910 Object.defineProperty(exports, "LogTraceNotification", ({ enumerable: true, get: function () { return connection_1.LogTraceNotification; } }));
911 Object.defineProperty(exports, "ConnectionErrors", ({ enumerable: true, get: function () { return connection_1.ConnectionErrors; } }));
912 Object.defineProperty(exports, "ConnectionError", ({ enumerable: true, get: function () { return connection_1.ConnectionError; } }));
913 Object.defineProperty(exports, "CancellationReceiverStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } }));
914 Object.defineProperty(exports, "CancellationSenderStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } }));
915 Object.defineProperty(exports, "CancellationStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationStrategy; } }));
916 const ral_1 = __webpack_require__(8);
917 exports.RAL = ral_1.default;
918 //# sourceMappingURL=api.js.map
922 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
925 /* --------------------------------------------------------------------------------------------
926 * Copyright (c) Microsoft Corporation. All rights reserved.
927 * Licensed under the MIT License. See License.txt in the project root for license information.
928 * ------------------------------------------------------------------------------------------ */
929 Object.defineProperty(exports, "__esModule", ({ value: true }));
930 exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
931 const is = __webpack_require__(14);
933 * Predefined error codes.
936 (function (ErrorCodes) {
937 // Defined by JSON RPC
938 ErrorCodes.ParseError = -32700;
939 ErrorCodes.InvalidRequest = -32600;
940 ErrorCodes.MethodNotFound = -32601;
941 ErrorCodes.InvalidParams = -32602;
942 ErrorCodes.InternalError = -32603;
944 * This is the start range of JSON RPC reserved error codes.
945 * It doesn't denote a real error code. No application error codes should
946 * be defined between the start and end range. For backwards
947 * compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
948 * are left in the range.
952 ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;
953 /** @deprecated use jsonrpcReservedErrorRangeStart */
954 ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart;
955 ErrorCodes.MessageWriteError = -32099;
956 ErrorCodes.MessageReadError = -32098;
957 ErrorCodes.ServerNotInitialized = -32002;
958 ErrorCodes.UnknownErrorCode = -32001;
960 * This is the end range of JSON RPC reserved error codes.
961 * It doesn't denote a real error code.
965 ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;
966 /** @deprecated use jsonrpcReservedErrorRangeEnd */
967 ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd;
968 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
970 * An error object return in a response in case a request
973 class ResponseError extends Error {
974 constructor(code, message, data) {
976 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
978 Object.setPrototypeOf(this, ResponseError.prototype);
983 message: this.message,
988 exports.ResponseError = ResponseError;
989 class ParameterStructures {
994 return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
1000 exports.ParameterStructures = ParameterStructures;
1002 * The parameter structure is automatically inferred on the number of parameters
1003 * and the parameter type in case of a single param.
1005 ParameterStructures.auto = new ParameterStructures('auto');
1007 * Forces `byPosition` parameter structure. This is useful if you have a single
1008 * parameter which has a literal type.
1010 ParameterStructures.byPosition = new ParameterStructures('byPosition');
1012 * Forces `byName` parameter structure. This is only useful when having a single
1013 * parameter. The library will report errors if used with a different number of
1016 ParameterStructures.byName = new ParameterStructures('byName');
1018 * An abstract implementation of a MessageType.
1020 class AbstractMessageSignature {
1021 constructor(method, numberOfParams) {
1022 this.method = method;
1023 this.numberOfParams = numberOfParams;
1025 get parameterStructures() {
1026 return ParameterStructures.auto;
1029 exports.AbstractMessageSignature = AbstractMessageSignature;
1031 * Classes to type request response pairs
1033 class RequestType0 extends AbstractMessageSignature {
1034 constructor(method) {
1038 exports.RequestType0 = RequestType0;
1039 class RequestType extends AbstractMessageSignature {
1040 constructor(method, _parameterStructures = ParameterStructures.auto) {
1042 this._parameterStructures = _parameterStructures;
1044 get parameterStructures() {
1045 return this._parameterStructures;
1048 exports.RequestType = RequestType;
1049 class RequestType1 extends AbstractMessageSignature {
1050 constructor(method, _parameterStructures = ParameterStructures.auto) {
1052 this._parameterStructures = _parameterStructures;
1054 get parameterStructures() {
1055 return this._parameterStructures;
1058 exports.RequestType1 = RequestType1;
1059 class RequestType2 extends AbstractMessageSignature {
1060 constructor(method) {
1064 exports.RequestType2 = RequestType2;
1065 class RequestType3 extends AbstractMessageSignature {
1066 constructor(method) {
1070 exports.RequestType3 = RequestType3;
1071 class RequestType4 extends AbstractMessageSignature {
1072 constructor(method) {
1076 exports.RequestType4 = RequestType4;
1077 class RequestType5 extends AbstractMessageSignature {
1078 constructor(method) {
1082 exports.RequestType5 = RequestType5;
1083 class RequestType6 extends AbstractMessageSignature {
1084 constructor(method) {
1088 exports.RequestType6 = RequestType6;
1089 class RequestType7 extends AbstractMessageSignature {
1090 constructor(method) {
1094 exports.RequestType7 = RequestType7;
1095 class RequestType8 extends AbstractMessageSignature {
1096 constructor(method) {
1100 exports.RequestType8 = RequestType8;
1101 class RequestType9 extends AbstractMessageSignature {
1102 constructor(method) {
1106 exports.RequestType9 = RequestType9;
1107 class NotificationType extends AbstractMessageSignature {
1108 constructor(method, _parameterStructures = ParameterStructures.auto) {
1110 this._parameterStructures = _parameterStructures;
1112 get parameterStructures() {
1113 return this._parameterStructures;
1116 exports.NotificationType = NotificationType;
1117 class NotificationType0 extends AbstractMessageSignature {
1118 constructor(method) {
1122 exports.NotificationType0 = NotificationType0;
1123 class NotificationType1 extends AbstractMessageSignature {
1124 constructor(method, _parameterStructures = ParameterStructures.auto) {
1126 this._parameterStructures = _parameterStructures;
1128 get parameterStructures() {
1129 return this._parameterStructures;
1132 exports.NotificationType1 = NotificationType1;
1133 class NotificationType2 extends AbstractMessageSignature {
1134 constructor(method) {
1138 exports.NotificationType2 = NotificationType2;
1139 class NotificationType3 extends AbstractMessageSignature {
1140 constructor(method) {
1144 exports.NotificationType3 = NotificationType3;
1145 class NotificationType4 extends AbstractMessageSignature {
1146 constructor(method) {
1150 exports.NotificationType4 = NotificationType4;
1151 class NotificationType5 extends AbstractMessageSignature {
1152 constructor(method) {
1156 exports.NotificationType5 = NotificationType5;
1157 class NotificationType6 extends AbstractMessageSignature {
1158 constructor(method) {
1162 exports.NotificationType6 = NotificationType6;
1163 class NotificationType7 extends AbstractMessageSignature {
1164 constructor(method) {
1168 exports.NotificationType7 = NotificationType7;
1169 class NotificationType8 extends AbstractMessageSignature {
1170 constructor(method) {
1174 exports.NotificationType8 = NotificationType8;
1175 class NotificationType9 extends AbstractMessageSignature {
1176 constructor(method) {
1180 exports.NotificationType9 = NotificationType9;
1182 * Tests if the given message is a request message
1184 function isRequestMessage(message) {
1185 const candidate = message;
1186 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
1188 exports.isRequestMessage = isRequestMessage;
1190 * Tests if the given message is a notification message
1192 function isNotificationMessage(message) {
1193 const candidate = message;
1194 return candidate && is.string(candidate.method) && message.id === void 0;
1196 exports.isNotificationMessage = isNotificationMessage;
1198 * Tests if the given message is a response message
1200 function isResponseMessage(message) {
1201 const candidate = message;
1202 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
1204 exports.isResponseMessage = isResponseMessage;
1205 //# sourceMappingURL=messages.js.map
1209 /***/ ((__unused_webpack_module, exports) => {
1212 /* --------------------------------------------------------------------------------------------
1213 * Copyright (c) Microsoft Corporation. All rights reserved.
1214 * Licensed under the MIT License. See License.txt in the project root for license information.
1215 * ------------------------------------------------------------------------------------------ */
1216 Object.defineProperty(exports, "__esModule", ({ value: true }));
1217 exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
1218 function boolean(value) {
1219 return value === true || value === false;
1221 exports.boolean = boolean;
1222 function string(value) {
1223 return typeof value === 'string' || value instanceof String;
1225 exports.string = string;
1226 function number(value) {
1227 return typeof value === 'number' || value instanceof Number;
1229 exports.number = number;
1230 function error(value) {
1231 return value instanceof Error;
1233 exports.error = error;
1234 function func(value) {
1235 return typeof value === 'function';
1237 exports.func = func;
1238 function array(value) {
1239 return Array.isArray(value);
1241 exports.array = array;
1242 function stringArray(value) {
1243 return array(value) && value.every(elem => string(elem));
1245 exports.stringArray = stringArray;
1246 //# sourceMappingURL=is.js.map
1250 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1253 /* --------------------------------------------------------------------------------------------
1254 * Copyright (c) Microsoft Corporation. All rights reserved.
1255 * Licensed under the MIT License. See License.txt in the project root for license information.
1256 * ------------------------------------------------------------------------------------------ */
1257 Object.defineProperty(exports, "__esModule", ({ value: true }));
1258 exports.Emitter = exports.Event = void 0;
1259 const ral_1 = __webpack_require__(8);
1262 const _disposable = { dispose() { } };
1263 Event.None = function () { return _disposable; };
1264 })(Event = exports.Event || (exports.Event = {}));
1265 class CallbackList {
1266 add(callback, context = null, bucket) {
1267 if (!this._callbacks) {
1268 this._callbacks = [];
1269 this._contexts = [];
1271 this._callbacks.push(callback);
1272 this._contexts.push(context);
1273 if (Array.isArray(bucket)) {
1274 bucket.push({ dispose: () => this.remove(callback, context) });
1277 remove(callback, context = null) {
1278 if (!this._callbacks) {
1281 let foundCallbackWithDifferentContext = false;
1282 for (let i = 0, len = this._callbacks.length; i < len; i++) {
1283 if (this._callbacks[i] === callback) {
1284 if (this._contexts[i] === context) {
1285 // callback & context match => remove it
1286 this._callbacks.splice(i, 1);
1287 this._contexts.splice(i, 1);
1291 foundCallbackWithDifferentContext = true;
1295 if (foundCallbackWithDifferentContext) {
1296 throw new Error('When adding a listener with a context, you should remove it with the same context');
1300 if (!this._callbacks) {
1303 const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
1304 for (let i = 0, len = callbacks.length; i < len; i++) {
1306 ret.push(callbacks[i].apply(contexts[i], args));
1309 // eslint-disable-next-line no-console
1310 ral_1.default().console.error(e);
1316 return !this._callbacks || this._callbacks.length === 0;
1319 this._callbacks = undefined;
1320 this._contexts = undefined;
1324 constructor(_options) {
1325 this._options = _options;
1328 * For the public to allow to subscribe
1329 * to events from this Emitter
1333 this._event = (listener, thisArgs, disposables) => {
1334 if (!this._callbacks) {
1335 this._callbacks = new CallbackList();
1337 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
1338 this._options.onFirstListenerAdd(this);
1340 this._callbacks.add(listener, thisArgs);
1343 if (!this._callbacks) {
1344 // disposable is disposed after emitter is disposed.
1347 this._callbacks.remove(listener, thisArgs);
1348 result.dispose = Emitter._noop;
1349 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
1350 this._options.onLastListenerRemove(this);
1354 if (Array.isArray(disposables)) {
1355 disposables.push(result);
1363 * To be kept private to fire an event to
1367 if (this._callbacks) {
1368 this._callbacks.invoke.call(this._callbacks, event);
1372 if (this._callbacks) {
1373 this._callbacks.dispose();
1374 this._callbacks = undefined;
1378 exports.Emitter = Emitter;
1379 Emitter._noop = function () { };
1380 //# sourceMappingURL=events.js.map
1384 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1387 /*---------------------------------------------------------------------------------------------
1388 * Copyright (c) Microsoft Corporation. All rights reserved.
1389 * Licensed under the MIT License. See License.txt in the project root for license information.
1390 *--------------------------------------------------------------------------------------------*/
1391 Object.defineProperty(exports, "__esModule", ({ value: true }));
1392 exports.CancellationTokenSource = exports.CancellationToken = void 0;
1393 const ral_1 = __webpack_require__(8);
1394 const Is = __webpack_require__(14);
1395 const events_1 = __webpack_require__(15);
1396 var CancellationToken;
1397 (function (CancellationToken) {
1398 CancellationToken.None = Object.freeze({
1399 isCancellationRequested: false,
1400 onCancellationRequested: events_1.Event.None
1402 CancellationToken.Cancelled = Object.freeze({
1403 isCancellationRequested: true,
1404 onCancellationRequested: events_1.Event.None
1406 function is(value) {
1407 const candidate = value;
1408 return candidate && (candidate === CancellationToken.None
1409 || candidate === CancellationToken.Cancelled
1410 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
1412 CancellationToken.is = is;
1413 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
1414 const shortcutEvent = Object.freeze(function (callback, context) {
1415 const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
1416 return { dispose() { ral_1.default().timer.clearTimeout(handle); } };
1418 class MutableToken {
1420 this._isCancelled = false;
1423 if (!this._isCancelled) {
1424 this._isCancelled = true;
1425 if (this._emitter) {
1426 this._emitter.fire(undefined);
1431 get isCancellationRequested() {
1432 return this._isCancelled;
1434 get onCancellationRequested() {
1435 if (this._isCancelled) {
1436 return shortcutEvent;
1438 if (!this._emitter) {
1439 this._emitter = new events_1.Emitter();
1441 return this._emitter.event;
1444 if (this._emitter) {
1445 this._emitter.dispose();
1446 this._emitter = undefined;
1450 class CancellationTokenSource {
1453 // be lazy and create the token only when
1455 this._token = new MutableToken();
1461 // save an object by returning the default
1462 // cancelled token when cancellation happens
1463 // before someone asks for the token
1464 this._token = CancellationToken.Cancelled;
1467 this._token.cancel();
1472 // ensure to initialize with an empty token if we had none
1473 this._token = CancellationToken.None;
1475 else if (this._token instanceof MutableToken) {
1477 this._token.dispose();
1481 exports.CancellationTokenSource = CancellationTokenSource;
1482 //# sourceMappingURL=cancellation.js.map
1486 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1489 /* --------------------------------------------------------------------------------------------
1490 * Copyright (c) Microsoft Corporation. All rights reserved.
1491 * Licensed under the MIT License. See License.txt in the project root for license information.
1492 * ------------------------------------------------------------------------------------------ */
1493 Object.defineProperty(exports, "__esModule", ({ value: true }));
1494 exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
1495 const ral_1 = __webpack_require__(8);
1496 const Is = __webpack_require__(14);
1497 const events_1 = __webpack_require__(15);
1499 (function (MessageReader) {
1500 function is(value) {
1501 let candidate = value;
1502 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
1503 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
1505 MessageReader.is = is;
1506 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
1507 class AbstractMessageReader {
1509 this.errorEmitter = new events_1.Emitter();
1510 this.closeEmitter = new events_1.Emitter();
1511 this.partialMessageEmitter = new events_1.Emitter();
1514 this.errorEmitter.dispose();
1515 this.closeEmitter.dispose();
1518 return this.errorEmitter.event;
1521 this.errorEmitter.fire(this.asError(error));
1524 return this.closeEmitter.event;
1527 this.closeEmitter.fire(undefined);
1529 get onPartialMessage() {
1530 return this.partialMessageEmitter.event;
1532 firePartialMessage(info) {
1533 this.partialMessageEmitter.fire(info);
1536 if (error instanceof Error) {
1540 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
1544 exports.AbstractMessageReader = AbstractMessageReader;
1545 var ResolvedMessageReaderOptions;
1546 (function (ResolvedMessageReaderOptions) {
1547 function fromOptions(options) {
1552 const contentDecoders = new Map();
1553 let contentTypeDecoder;
1554 const contentTypeDecoders = new Map();
1555 if (options === undefined || typeof options === 'string') {
1556 charset = options !== null && options !== void 0 ? options : 'utf-8';
1559 charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8';
1560 if (options.contentDecoder !== undefined) {
1561 contentDecoder = options.contentDecoder;
1562 contentDecoders.set(contentDecoder.name, contentDecoder);
1564 if (options.contentDecoders !== undefined) {
1565 for (const decoder of options.contentDecoders) {
1566 contentDecoders.set(decoder.name, decoder);
1569 if (options.contentTypeDecoder !== undefined) {
1570 contentTypeDecoder = options.contentTypeDecoder;
1571 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
1573 if (options.contentTypeDecoders !== undefined) {
1574 for (const decoder of options.contentTypeDecoders) {
1575 contentTypeDecoders.set(decoder.name, decoder);
1579 if (contentTypeDecoder === undefined) {
1580 contentTypeDecoder = ral_1.default().applicationJson.decoder;
1581 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
1583 return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
1585 ResolvedMessageReaderOptions.fromOptions = fromOptions;
1586 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
1587 class ReadableStreamMessageReader extends AbstractMessageReader {
1588 constructor(readable, options) {
1590 this.readable = readable;
1591 this.options = ResolvedMessageReaderOptions.fromOptions(options);
1592 this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
1593 this._partialMessageTimeout = 10000;
1594 this.nextMessageLength = -1;
1595 this.messageToken = 0;
1597 set partialMessageTimeout(timeout) {
1598 this._partialMessageTimeout = timeout;
1600 get partialMessageTimeout() {
1601 return this._partialMessageTimeout;
1604 this.nextMessageLength = -1;
1605 this.messageToken = 0;
1606 this.partialMessageTimer = undefined;
1607 this.callback = callback;
1608 const result = this.readable.onData((data) => {
1611 this.readable.onError((error) => this.fireError(error));
1612 this.readable.onClose(() => this.fireClose());
1616 this.buffer.append(data);
1618 if (this.nextMessageLength === -1) {
1619 const headers = this.buffer.tryReadHeaders();
1623 const contentLength = headers.get('Content-Length');
1624 if (!contentLength) {
1625 throw new Error('Header must provide a Content-Length property.');
1627 const length = parseInt(contentLength);
1628 if (isNaN(length)) {
1629 throw new Error('Content-Length value must be a number.');
1631 this.nextMessageLength = length;
1633 const body = this.buffer.tryReadBody(this.nextMessageLength);
1634 if (body === undefined) {
1635 /** We haven't received the full message yet. */
1636 this.setPartialMessageTimer();
1639 this.clearPartialMessageTimer();
1640 this.nextMessageLength = -1;
1642 if (this.options.contentDecoder !== undefined) {
1643 p = this.options.contentDecoder.decode(body);
1646 p = Promise.resolve(body);
1649 this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
1652 this.fireError(error);
1655 this.fireError(error);
1659 clearPartialMessageTimer() {
1660 if (this.partialMessageTimer) {
1661 ral_1.default().timer.clearTimeout(this.partialMessageTimer);
1662 this.partialMessageTimer = undefined;
1665 setPartialMessageTimer() {
1666 this.clearPartialMessageTimer();
1667 if (this._partialMessageTimeout <= 0) {
1670 this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
1671 this.partialMessageTimer = undefined;
1672 if (token === this.messageToken) {
1673 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
1674 this.setPartialMessageTimer();
1676 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
1679 exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
1680 //# sourceMappingURL=messageReader.js.map
1684 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1687 /* --------------------------------------------------------------------------------------------
1688 * Copyright (c) Microsoft Corporation. All rights reserved.
1689 * Licensed under the MIT License. See License.txt in the project root for license information.
1690 * ------------------------------------------------------------------------------------------ */
1691 Object.defineProperty(exports, "__esModule", ({ value: true }));
1692 exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
1693 const ral_1 = __webpack_require__(8);
1694 const Is = __webpack_require__(14);
1695 const semaphore_1 = __webpack_require__(19);
1696 const events_1 = __webpack_require__(15);
1697 const ContentLength = 'Content-Length: ';
1698 const CRLF = '\r\n';
1700 (function (MessageWriter) {
1701 function is(value) {
1702 let candidate = value;
1703 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
1704 Is.func(candidate.onError) && Is.func(candidate.write);
1706 MessageWriter.is = is;
1707 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
1708 class AbstractMessageWriter {
1710 this.errorEmitter = new events_1.Emitter();
1711 this.closeEmitter = new events_1.Emitter();
1714 this.errorEmitter.dispose();
1715 this.closeEmitter.dispose();
1718 return this.errorEmitter.event;
1720 fireError(error, message, count) {
1721 this.errorEmitter.fire([this.asError(error), message, count]);
1724 return this.closeEmitter.event;
1727 this.closeEmitter.fire(undefined);
1730 if (error instanceof Error) {
1734 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
1738 exports.AbstractMessageWriter = AbstractMessageWriter;
1739 var ResolvedMessageWriterOptions;
1740 (function (ResolvedMessageWriterOptions) {
1741 function fromOptions(options) {
1743 if (options === undefined || typeof options === 'string') {
1744 return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder };
1747 return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder };
1750 ResolvedMessageWriterOptions.fromOptions = fromOptions;
1751 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
1752 class WriteableStreamMessageWriter extends AbstractMessageWriter {
1753 constructor(writable, options) {
1755 this.writable = writable;
1756 this.options = ResolvedMessageWriterOptions.fromOptions(options);
1757 this.errorCount = 0;
1758 this.writeSemaphore = new semaphore_1.Semaphore(1);
1759 this.writable.onError((error) => this.fireError(error));
1760 this.writable.onClose(() => this.fireClose());
1763 return this.writeSemaphore.lock(async () => {
1764 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
1765 if (this.options.contentEncoder !== undefined) {
1766 return this.options.contentEncoder.encode(buffer);
1772 return payload.then((buffer) => {
1774 headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
1776 return this.doWrite(msg, headers, buffer);
1778 this.fireError(error);
1783 async doWrite(msg, headers, data) {
1785 await this.writable.write(headers.join(''), 'ascii');
1786 return this.writable.write(data);
1789 this.handleError(error, msg);
1790 return Promise.reject(error);
1793 handleError(error, msg) {
1795 this.fireError(error, msg, this.errorCount);
1798 this.writable.end();
1801 exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
1802 //# sourceMappingURL=messageWriter.js.map
1806 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1809 /* --------------------------------------------------------------------------------------------
1810 * Copyright (c) Microsoft Corporation. All rights reserved.
1811 * Licensed under the MIT License. See License.txt in the project root for license information.
1812 * ------------------------------------------------------------------------------------------ */
1813 Object.defineProperty(exports, "__esModule", ({ value: true }));
1814 exports.Semaphore = void 0;
1815 const ral_1 = __webpack_require__(8);
1817 constructor(capacity = 1) {
1818 if (capacity <= 0) {
1819 throw new Error('Capacity must be greater than 0');
1821 this._capacity = capacity;
1826 return new Promise((resolve, reject) => {
1827 this._waiting.push({ thunk, resolve, reject });
1832 return this._active;
1835 if (this._waiting.length === 0 || this._active === this._capacity) {
1838 ral_1.default().timer.setImmediate(() => this.doRunNext());
1841 if (this._waiting.length === 0 || this._active === this._capacity) {
1844 const next = this._waiting.shift();
1846 if (this._active > this._capacity) {
1847 throw new Error(`To many thunks active`);
1850 const result = next.thunk();
1851 if (result instanceof Promise) {
1852 result.then((value) => {
1854 next.resolve(value);
1864 next.resolve(result);
1875 exports.Semaphore = Semaphore;
1876 //# sourceMappingURL=semaphore.js.map
1880 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1883 /* --------------------------------------------------------------------------------------------
1884 * Copyright (c) Microsoft Corporation. All rights reserved.
1885 * Licensed under the MIT License. See License.txt in the project root for license information.
1886 * ------------------------------------------------------------------------------------------ */
1887 Object.defineProperty(exports, "__esModule", ({ value: true }));
1888 exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0;
1889 const ral_1 = __webpack_require__(8);
1890 const Is = __webpack_require__(14);
1891 const messages_1 = __webpack_require__(13);
1892 const linkedMap_1 = __webpack_require__(21);
1893 const events_1 = __webpack_require__(15);
1894 const cancellation_1 = __webpack_require__(16);
1895 var CancelNotification;
1896 (function (CancelNotification) {
1897 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
1898 })(CancelNotification || (CancelNotification = {}));
1899 var ProgressNotification;
1900 (function (ProgressNotification) {
1901 ProgressNotification.type = new messages_1.NotificationType('$/progress');
1902 })(ProgressNotification || (ProgressNotification = {}));
1903 class ProgressType {
1907 exports.ProgressType = ProgressType;
1908 var StarRequestHandler;
1909 (function (StarRequestHandler) {
1910 function is(value) {
1911 return Is.func(value);
1913 StarRequestHandler.is = is;
1914 })(StarRequestHandler || (StarRequestHandler = {}));
1915 exports.NullLogger = Object.freeze({
1923 Trace[Trace["Off"] = 0] = "Off";
1924 Trace[Trace["Messages"] = 1] = "Messages";
1925 Trace[Trace["Verbose"] = 2] = "Verbose";
1926 })(Trace = exports.Trace || (exports.Trace = {}));
1928 function fromString(value) {
1929 if (!Is.string(value)) {
1932 value = value.toLowerCase();
1937 return Trace.Messages;
1939 return Trace.Verbose;
1944 Trace.fromString = fromString;
1945 function toString(value) {
1949 case Trace.Messages:
1957 Trace.toString = toString;
1958 })(Trace = exports.Trace || (exports.Trace = {}));
1960 (function (TraceFormat) {
1961 TraceFormat["Text"] = "text";
1962 TraceFormat["JSON"] = "json";
1963 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
1964 (function (TraceFormat) {
1965 function fromString(value) {
1966 value = value.toLowerCase();
1967 if (value === 'json') {
1968 return TraceFormat.JSON;
1971 return TraceFormat.Text;
1974 TraceFormat.fromString = fromString;
1975 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
1976 var SetTraceNotification;
1977 (function (SetTraceNotification) {
1978 SetTraceNotification.type = new messages_1.NotificationType('$/setTrace');
1979 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
1980 var LogTraceNotification;
1981 (function (LogTraceNotification) {
1982 LogTraceNotification.type = new messages_1.NotificationType('$/logTrace');
1983 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
1984 var ConnectionErrors;
1985 (function (ConnectionErrors) {
1987 * The connection is closed.
1989 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
1991 * The connection got disposed.
1993 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
1995 * The connection is already in listening mode.
1997 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
1998 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
1999 class ConnectionError extends Error {
2000 constructor(code, message) {
2003 Object.setPrototypeOf(this, ConnectionError.prototype);
2006 exports.ConnectionError = ConnectionError;
2007 var ConnectionStrategy;
2008 (function (ConnectionStrategy) {
2009 function is(value) {
2010 const candidate = value;
2011 return candidate && Is.func(candidate.cancelUndispatched);
2013 ConnectionStrategy.is = is;
2014 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
2015 var CancellationReceiverStrategy;
2016 (function (CancellationReceiverStrategy) {
2017 CancellationReceiverStrategy.Message = Object.freeze({
2018 createCancellationTokenSource(_) {
2019 return new cancellation_1.CancellationTokenSource();
2022 function is(value) {
2023 const candidate = value;
2024 return candidate && Is.func(candidate.createCancellationTokenSource);
2026 CancellationReceiverStrategy.is = is;
2027 })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {}));
2028 var CancellationSenderStrategy;
2029 (function (CancellationSenderStrategy) {
2030 CancellationSenderStrategy.Message = Object.freeze({
2031 sendCancellation(conn, id) {
2032 conn.sendNotification(CancelNotification.type, { id });
2036 function is(value) {
2037 const candidate = value;
2038 return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
2040 CancellationSenderStrategy.is = is;
2041 })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {}));
2042 var CancellationStrategy;
2043 (function (CancellationStrategy) {
2044 CancellationStrategy.Message = Object.freeze({
2045 receiver: CancellationReceiverStrategy.Message,
2046 sender: CancellationSenderStrategy.Message
2048 function is(value) {
2049 const candidate = value;
2050 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
2052 CancellationStrategy.is = is;
2053 })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {}));
2054 var ConnectionOptions;
2055 (function (ConnectionOptions) {
2056 function is(value) {
2057 const candidate = value;
2058 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
2060 ConnectionOptions.is = is;
2061 })(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {}));
2062 var ConnectionState;
2063 (function (ConnectionState) {
2064 ConnectionState[ConnectionState["New"] = 1] = "New";
2065 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
2066 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
2067 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
2068 })(ConnectionState || (ConnectionState = {}));
2069 function createMessageConnection(messageReader, messageWriter, _logger, options) {
2070 const logger = _logger !== undefined ? _logger : exports.NullLogger;
2071 let sequenceNumber = 0;
2072 let notificationSquenceNumber = 0;
2073 let unknownResponseSquenceNumber = 0;
2074 const version = '2.0';
2075 let starRequestHandler = undefined;
2076 const requestHandlers = Object.create(null);
2077 let starNotificationHandler = undefined;
2078 const notificationHandlers = Object.create(null);
2079 const progressHandlers = new Map();
2081 let messageQueue = new linkedMap_1.LinkedMap();
2082 let responsePromises = Object.create(null);
2083 let requestTokens = Object.create(null);
2084 let trace = Trace.Off;
2085 let traceFormat = TraceFormat.Text;
2087 let state = ConnectionState.New;
2088 const errorEmitter = new events_1.Emitter();
2089 const closeEmitter = new events_1.Emitter();
2090 const unhandledNotificationEmitter = new events_1.Emitter();
2091 const unhandledProgressEmitter = new events_1.Emitter();
2092 const disposeEmitter = new events_1.Emitter();
2093 const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message;
2094 function createRequestQueueKey(id) {
2096 throw new Error(`Can't send requests with id null since the response can't be correlated.`);
2098 return 'req-' + id.toString();
2100 function createResponseQueueKey(id) {
2102 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
2105 return 'res-' + id.toString();
2108 function createNotificationQueueKey() {
2109 return 'not-' + (++notificationSquenceNumber).toString();
2111 function addMessageToQueue(queue, message) {
2112 if (messages_1.isRequestMessage(message)) {
2113 queue.set(createRequestQueueKey(message.id), message);
2115 else if (messages_1.isResponseMessage(message)) {
2116 queue.set(createResponseQueueKey(message.id), message);
2119 queue.set(createNotificationQueueKey(), message);
2122 function cancelUndispatched(_message) {
2125 function isListening() {
2126 return state === ConnectionState.Listening;
2128 function isClosed() {
2129 return state === ConnectionState.Closed;
2131 function isDisposed() {
2132 return state === ConnectionState.Disposed;
2134 function closeHandler() {
2135 if (state === ConnectionState.New || state === ConnectionState.Listening) {
2136 state = ConnectionState.Closed;
2137 closeEmitter.fire(undefined);
2139 // If the connection is disposed don't sent close events.
2141 function readErrorHandler(error) {
2142 errorEmitter.fire([error, undefined, undefined]);
2144 function writeErrorHandler(data) {
2145 errorEmitter.fire(data);
2147 messageReader.onClose(closeHandler);
2148 messageReader.onError(readErrorHandler);
2149 messageWriter.onClose(closeHandler);
2150 messageWriter.onError(writeErrorHandler);
2151 function triggerMessageQueue() {
2152 if (timer || messageQueue.size === 0) {
2155 timer = ral_1.default().timer.setImmediate(() => {
2157 processMessageQueue();
2160 function processMessageQueue() {
2161 if (messageQueue.size === 0) {
2164 const message = messageQueue.shift();
2166 if (messages_1.isRequestMessage(message)) {
2167 handleRequest(message);
2169 else if (messages_1.isNotificationMessage(message)) {
2170 handleNotification(message);
2172 else if (messages_1.isResponseMessage(message)) {
2173 handleResponse(message);
2176 handleInvalidMessage(message);
2180 triggerMessageQueue();
2183 const callback = (message) => {
2185 // We have received a cancellation message. Check if the message is still in the queue
2186 // and cancel it if allowed to do so.
2187 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
2188 const key = createRequestQueueKey(message.params.id);
2189 const toCancel = messageQueue.get(key);
2190 if (messages_1.isRequestMessage(toCancel)) {
2191 const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
2192 const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
2193 if (response && (response.error !== undefined || response.result !== undefined)) {
2194 messageQueue.delete(key);
2195 response.id = toCancel.id;
2196 traceSendingResponse(response, message.method, Date.now());
2197 messageWriter.write(response);
2202 addMessageToQueue(messageQueue, message);
2205 triggerMessageQueue();
2208 function handleRequest(requestMessage) {
2210 // we return here silently since we fired an event when the
2211 // connection got disposed.
2214 function reply(resultOrError, method, startTime) {
2217 id: requestMessage.id
2219 if (resultOrError instanceof messages_1.ResponseError) {
2220 message.error = resultOrError.toJson();
2223 message.result = resultOrError === undefined ? null : resultOrError;
2225 traceSendingResponse(message, method, startTime);
2226 messageWriter.write(message);
2228 function replyError(error, method, startTime) {
2231 id: requestMessage.id,
2232 error: error.toJson()
2234 traceSendingResponse(message, method, startTime);
2235 messageWriter.write(message);
2237 function replySuccess(result, method, startTime) {
2238 // The JSON RPC defines that a response must either have a result or an error
2239 // So we can't treat undefined as a valid response result.
2240 if (result === undefined) {
2245 id: requestMessage.id,
2248 traceSendingResponse(message, method, startTime);
2249 messageWriter.write(message);
2251 traceReceivedRequest(requestMessage);
2252 const element = requestHandlers[requestMessage.method];
2256 type = element.type;
2257 requestHandler = element.handler;
2259 const startTime = Date.now();
2260 if (requestHandler || starRequestHandler) {
2261 const tokenKey = String(requestMessage.id);
2262 const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
2263 requestTokens[tokenKey] = cancellationSource;
2266 if (requestHandler) {
2267 if (requestMessage.params === undefined) {
2268 if (type !== undefined && type.numberOfParams !== 0) {
2269 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
2272 handlerResult = requestHandler(cancellationSource.token);
2274 else if (Array.isArray(requestMessage.params)) {
2275 if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byName) {
2276 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
2279 handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
2282 if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2283 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
2286 handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
2289 else if (starRequestHandler) {
2290 handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
2292 const promise = handlerResult;
2293 if (!handlerResult) {
2294 delete requestTokens[tokenKey];
2295 replySuccess(handlerResult, requestMessage.method, startTime);
2297 else if (promise.then) {
2298 promise.then((resultOrError) => {
2299 delete requestTokens[tokenKey];
2300 reply(resultOrError, requestMessage.method, startTime);
2302 delete requestTokens[tokenKey];
2303 if (error instanceof messages_1.ResponseError) {
2304 replyError(error, requestMessage.method, startTime);
2306 else if (error && Is.string(error.message)) {
2307 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2310 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2315 delete requestTokens[tokenKey];
2316 reply(handlerResult, requestMessage.method, startTime);
2320 delete requestTokens[tokenKey];
2321 if (error instanceof messages_1.ResponseError) {
2322 reply(error, requestMessage.method, startTime);
2324 else if (error && Is.string(error.message)) {
2325 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2328 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2333 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
2336 function handleResponse(responseMessage) {
2338 // See handle request.
2341 if (responseMessage.id === null) {
2342 if (responseMessage.error) {
2343 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
2346 logger.error(`Received response message without id. No further error information provided.`);
2350 const key = String(responseMessage.id);
2351 const responsePromise = responsePromises[key];
2352 traceReceivedResponse(responseMessage, responsePromise);
2353 if (responsePromise) {
2354 delete responsePromises[key];
2356 if (responseMessage.error) {
2357 const error = responseMessage.error;
2358 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
2360 else if (responseMessage.result !== undefined) {
2361 responsePromise.resolve(responseMessage.result);
2364 throw new Error('Should never happen.');
2368 if (error.message) {
2369 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
2372 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
2378 function handleNotification(message) {
2380 // See handle request.
2383 let type = undefined;
2384 let notificationHandler;
2385 if (message.method === CancelNotification.type.method) {
2386 notificationHandler = (params) => {
2387 const id = params.id;
2388 const source = requestTokens[String(id)];
2395 const element = notificationHandlers[message.method];
2397 notificationHandler = element.handler;
2398 type = element.type;
2401 if (notificationHandler || starNotificationHandler) {
2403 traceReceivedNotification(message);
2404 if (notificationHandler) {
2405 if (message.params === undefined) {
2406 if (type !== undefined) {
2407 if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
2408 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
2411 notificationHandler();
2413 else if (Array.isArray(message.params)) {
2414 if (type !== undefined) {
2415 if (type.parameterStructures === messages_1.ParameterStructures.byName) {
2416 logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
2418 if (type.numberOfParams !== message.params.length) {
2419 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
2422 notificationHandler(...message.params);
2425 if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2426 logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
2428 notificationHandler(message.params);
2431 else if (starNotificationHandler) {
2432 starNotificationHandler(message.method, message.params);
2436 if (error.message) {
2437 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
2440 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
2445 unhandledNotificationEmitter.fire(message);
2448 function handleInvalidMessage(message) {
2450 logger.error('Received empty message.');
2453 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
2454 // Test whether we find an id to reject the promise
2455 const responseMessage = message;
2456 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
2457 const key = String(responseMessage.id);
2458 const responseHandler = responsePromises[key];
2459 if (responseHandler) {
2460 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
2464 function traceSendingRequest(message) {
2465 if (trace === Trace.Off || !tracer) {
2468 if (traceFormat === TraceFormat.Text) {
2469 let data = undefined;
2470 if (trace === Trace.Verbose && message.params) {
2471 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2473 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
2476 logLSPMessage('send-request', message);
2479 function traceSendingNotification(message) {
2480 if (trace === Trace.Off || !tracer) {
2483 if (traceFormat === TraceFormat.Text) {
2484 let data = undefined;
2485 if (trace === Trace.Verbose) {
2486 if (message.params) {
2487 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2490 data = 'No parameters provided.\n\n';
2493 tracer.log(`Sending notification '${message.method}'.`, data);
2496 logLSPMessage('send-notification', message);
2499 function traceSendingResponse(message, method, startTime) {
2500 if (trace === Trace.Off || !tracer) {
2503 if (traceFormat === TraceFormat.Text) {
2504 let data = undefined;
2505 if (trace === Trace.Verbose) {
2506 if (message.error && message.error.data) {
2507 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
2510 if (message.result) {
2511 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
2513 else if (message.error === undefined) {
2514 data = 'No result returned.\n\n';
2518 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
2521 logLSPMessage('send-response', message);
2524 function traceReceivedRequest(message) {
2525 if (trace === Trace.Off || !tracer) {
2528 if (traceFormat === TraceFormat.Text) {
2529 let data = undefined;
2530 if (trace === Trace.Verbose && message.params) {
2531 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2533 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
2536 logLSPMessage('receive-request', message);
2539 function traceReceivedNotification(message) {
2540 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
2543 if (traceFormat === TraceFormat.Text) {
2544 let data = undefined;
2545 if (trace === Trace.Verbose) {
2546 if (message.params) {
2547 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2550 data = 'No parameters provided.\n\n';
2553 tracer.log(`Received notification '${message.method}'.`, data);
2556 logLSPMessage('receive-notification', message);
2559 function traceReceivedResponse(message, responsePromise) {
2560 if (trace === Trace.Off || !tracer) {
2563 if (traceFormat === TraceFormat.Text) {
2564 let data = undefined;
2565 if (trace === Trace.Verbose) {
2566 if (message.error && message.error.data) {
2567 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
2570 if (message.result) {
2571 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
2573 else if (message.error === undefined) {
2574 data = 'No result returned.\n\n';
2578 if (responsePromise) {
2579 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
2580 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
2583 tracer.log(`Received response ${message.id} without active response promise.`, data);
2587 logLSPMessage('receive-response', message);
2590 function logLSPMessage(type, message) {
2591 if (!tracer || trace === Trace.Off) {
2594 const lspMessage = {
2598 timestamp: Date.now()
2600 tracer.log(lspMessage);
2602 function throwIfClosedOrDisposed() {
2604 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
2607 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
2610 function throwIfListening() {
2611 if (isListening()) {
2612 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
2615 function throwIfNotListening() {
2616 if (!isListening()) {
2617 throw new Error('Call listen() first.');
2620 function undefinedToNull(param) {
2621 if (param === undefined) {
2628 function nullToUndefined(param) {
2629 if (param === null) {
2636 function isNamedParam(param) {
2637 return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';
2639 function computeSingleParam(parameterStructures, param) {
2640 switch (parameterStructures) {
2641 case messages_1.ParameterStructures.auto:
2642 if (isNamedParam(param)) {
2643 return nullToUndefined(param);
2646 return [undefinedToNull(param)];
2649 case messages_1.ParameterStructures.byName:
2650 if (!isNamedParam(param)) {
2651 throw new Error(`Recevied parameters by name but param is not an object literal.`);
2653 return nullToUndefined(param);
2654 case messages_1.ParameterStructures.byPosition:
2655 return [undefinedToNull(param)];
2657 throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
2660 function computeMessageParams(type, params) {
2662 const numberOfParams = type.numberOfParams;
2663 switch (numberOfParams) {
2668 result = computeSingleParam(type.parameterStructures, params[0]);
2672 for (let i = 0; i < params.length && i < numberOfParams; i++) {
2673 result.push(undefinedToNull(params[i]));
2675 if (params.length < numberOfParams) {
2676 for (let i = params.length; i < numberOfParams; i++) {
2684 const connection = {
2685 sendNotification: (type, ...args) => {
2686 throwIfClosedOrDisposed();
2689 if (Is.string(type)) {
2691 const first = args[0];
2693 let parameterStructures = messages_1.ParameterStructures.auto;
2694 if (messages_1.ParameterStructures.is(first)) {
2696 parameterStructures = first;
2698 let paramEnd = args.length;
2699 const numberOfParams = paramEnd - paramStart;
2700 switch (numberOfParams) {
2702 messageParams = undefined;
2705 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2708 if (parameterStructures === messages_1.ParameterStructures.byName) {
2709 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
2711 messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
2716 const params = args;
2717 method = type.method;
2718 messageParams = computeMessageParams(type, params);
2720 const notificationMessage = {
2723 params: messageParams
2725 traceSendingNotification(notificationMessage);
2726 messageWriter.write(notificationMessage);
2728 onNotification: (type, handler) => {
2729 throwIfClosedOrDisposed();
2731 if (Is.func(type)) {
2732 starNotificationHandler = type;
2735 if (Is.string(type)) {
2737 notificationHandlers[type] = { type: undefined, handler };
2740 method = type.method;
2741 notificationHandlers[type.method] = { type, handler };
2746 if (method !== undefined) {
2747 delete notificationHandlers[method];
2750 starNotificationHandler = undefined;
2755 onProgress: (_type, token, handler) => {
2756 if (progressHandlers.has(token)) {
2757 throw new Error(`Progress handler for token ${token} already registered`);
2759 progressHandlers.set(token, handler);
2762 progressHandlers.delete(token);
2766 sendProgress: (_type, token, value) => {
2767 connection.sendNotification(ProgressNotification.type, { token, value });
2769 onUnhandledProgress: unhandledProgressEmitter.event,
2770 sendRequest: (type, ...args) => {
2771 throwIfClosedOrDisposed();
2772 throwIfNotListening();
2775 let token = undefined;
2776 if (Is.string(type)) {
2778 const first = args[0];
2779 const last = args[args.length - 1];
2781 let parameterStructures = messages_1.ParameterStructures.auto;
2782 if (messages_1.ParameterStructures.is(first)) {
2784 parameterStructures = first;
2786 let paramEnd = args.length;
2787 if (cancellation_1.CancellationToken.is(last)) {
2788 paramEnd = paramEnd - 1;
2791 const numberOfParams = paramEnd - paramStart;
2792 switch (numberOfParams) {
2794 messageParams = undefined;
2797 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2800 if (parameterStructures === messages_1.ParameterStructures.byName) {
2801 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
2803 messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
2808 const params = args;
2809 method = type.method;
2810 messageParams = computeMessageParams(type, params);
2811 const numberOfParams = type.numberOfParams;
2812 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
2814 const id = sequenceNumber++;
2817 disposable = token.onCancellationRequested(() => {
2818 cancellationStrategy.sender.sendCancellation(connection, id);
2821 const result = new Promise((resolve, reject) => {
2822 const requestMessage = {
2826 params: messageParams
2828 const resolveWithCleanup = (r) => {
2830 cancellationStrategy.sender.cleanup(id);
2831 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2833 const rejectWithCleanup = (r) => {
2835 cancellationStrategy.sender.cleanup(id);
2836 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2838 let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
2839 traceSendingRequest(requestMessage);
2841 messageWriter.write(requestMessage);
2844 // Writing the message failed. So we need to reject the promise.
2845 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
2846 responsePromise = null;
2848 if (responsePromise) {
2849 responsePromises[String(id)] = responsePromise;
2854 onRequest: (type, handler) => {
2855 throwIfClosedOrDisposed();
2857 if (StarRequestHandler.is(type)) {
2859 starRequestHandler = type;
2861 else if (Is.string(type)) {
2863 if (handler !== undefined) {
2865 requestHandlers[type] = { handler: handler, type: undefined };
2869 if (handler !== undefined) {
2870 method = type.method;
2871 requestHandlers[type.method] = { type, handler };
2876 if (method === null) {
2879 if (method !== undefined) {
2880 delete requestHandlers[method];
2883 starRequestHandler = undefined;
2888 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
2889 let _sendNotification = false;
2890 let _traceFormat = TraceFormat.Text;
2891 if (sendNotificationOrTraceOptions !== undefined) {
2892 if (Is.boolean(sendNotificationOrTraceOptions)) {
2893 _sendNotification = sendNotificationOrTraceOptions;
2896 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2897 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2901 traceFormat = _traceFormat;
2902 if (trace === Trace.Off) {
2908 if (_sendNotification && !isClosed() && !isDisposed()) {
2909 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
2912 onError: errorEmitter.event,
2913 onClose: closeEmitter.event,
2914 onUnhandledNotification: unhandledNotificationEmitter.event,
2915 onDispose: disposeEmitter.event,
2917 messageWriter.end();
2923 state = ConnectionState.Disposed;
2924 disposeEmitter.fire(undefined);
2925 const error = new Error('Connection got disposed.');
2926 Object.keys(responsePromises).forEach((key) => {
2927 responsePromises[key].reject(error);
2929 responsePromises = Object.create(null);
2930 requestTokens = Object.create(null);
2931 messageQueue = new linkedMap_1.LinkedMap();
2932 // Test for backwards compatibility
2933 if (Is.func(messageWriter.dispose)) {
2934 messageWriter.dispose();
2936 if (Is.func(messageReader.dispose)) {
2937 messageReader.dispose();
2941 throwIfClosedOrDisposed();
2943 state = ConnectionState.Listening;
2944 messageReader.listen(callback);
2947 // eslint-disable-next-line no-console
2948 ral_1.default().console.log('inspect');
2951 connection.onNotification(LogTraceNotification.type, (params) => {
2952 if (trace === Trace.Off || !tracer) {
2955 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
2957 connection.onNotification(ProgressNotification.type, (params) => {
2958 const handler = progressHandlers.get(params.token);
2960 handler(params.value);
2963 unhandledProgressEmitter.fire(params);
2968 exports.createMessageConnection = createMessageConnection;
2969 //# sourceMappingURL=connection.js.map
2973 /***/ ((__unused_webpack_module, exports) => {
2976 /*---------------------------------------------------------------------------------------------
2977 * Copyright (c) Microsoft Corporation. All rights reserved.
2978 * Licensed under the MIT License. See License.txt in the project root for license information.
2979 *--------------------------------------------------------------------------------------------*/
2980 Object.defineProperty(exports, "__esModule", ({ value: true }));
2981 exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
2986 Touch.AsOld = Touch.First;
2988 Touch.AsNew = Touch.Last;
2989 })(Touch = exports.Touch || (exports.Touch = {}));
2992 this[Symbol.toStringTag] = 'LinkedMap';
2993 this._map = new Map();
2994 this._head = undefined;
2995 this._tail = undefined;
3001 this._head = undefined;
3002 this._tail = undefined;
3007 return !this._head && !this._tail;
3014 return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
3018 return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
3021 return this._map.has(key);
3023 get(key, touch = Touch.None) {
3024 const item = this._map.get(key);
3028 if (touch !== Touch.None) {
3029 this.touch(item, touch);
3033 set(key, value, touch = Touch.None) {
3034 let item = this._map.get(key);
3037 if (touch !== Touch.None) {
3038 this.touch(item, touch);
3042 item = { key, value, next: undefined, previous: undefined };
3045 this.addItemLast(item);
3048 this.addItemFirst(item);
3051 this.addItemLast(item);
3054 this.addItemLast(item);
3057 this._map.set(key, item);
3063 return !!this.remove(key);
3066 const item = this._map.get(key);
3070 this._map.delete(key);
3071 this.removeItem(item);
3076 if (!this._head && !this._tail) {
3079 if (!this._head || !this._tail) {
3080 throw new Error('Invalid list');
3082 const item = this._head;
3083 this._map.delete(item.key);
3084 this.removeItem(item);
3088 forEach(callbackfn, thisArg) {
3089 const state = this._state;
3090 let current = this._head;
3093 callbackfn.bind(thisArg)(current.value, current.key, this);
3096 callbackfn(current.value, current.key, this);
3098 if (this._state !== state) {
3099 throw new Error(`LinkedMap got modified during iteration.`);
3101 current = current.next;
3106 const state = this._state;
3107 let current = this._head;
3109 [Symbol.iterator]() {
3113 if (map._state !== state) {
3114 throw new Error(`LinkedMap got modified during iteration.`);
3117 const result = { value: current.key, done: false };
3118 current = current.next;
3122 return { value: undefined, done: true };
3130 const state = this._state;
3131 let current = this._head;
3133 [Symbol.iterator]() {
3137 if (map._state !== state) {
3138 throw new Error(`LinkedMap got modified during iteration.`);
3141 const result = { value: current.value, done: false };
3142 current = current.next;
3146 return { value: undefined, done: true };
3154 const state = this._state;
3155 let current = this._head;
3157 [Symbol.iterator]() {
3161 if (map._state !== state) {
3162 throw new Error(`LinkedMap got modified during iteration.`);
3165 const result = { value: [current.key, current.value], done: false };
3166 current = current.next;
3170 return { value: undefined, done: true };
3176 [Symbol.iterator]() {
3177 return this.entries();
3180 if (newSize >= this.size) {
3183 if (newSize === 0) {
3187 let current = this._head;
3188 let currentSize = this.size;
3189 while (current && currentSize > newSize) {
3190 this._map.delete(current.key);
3191 current = current.next;
3194 this._head = current;
3195 this._size = currentSize;
3197 current.previous = undefined;
3201 addItemFirst(item) {
3202 // First time Insert
3203 if (!this._head && !this._tail) {
3206 else if (!this._head) {
3207 throw new Error('Invalid list');
3210 item.next = this._head;
3211 this._head.previous = item;
3217 // First time Insert
3218 if (!this._head && !this._tail) {
3221 else if (!this._tail) {
3222 throw new Error('Invalid list');
3225 item.previous = this._tail;
3226 this._tail.next = item;
3232 if (item === this._head && item === this._tail) {
3233 this._head = undefined;
3234 this._tail = undefined;
3236 else if (item === this._head) {
3237 // This can only happend if size === 1 which is handle
3238 // by the case above.
3240 throw new Error('Invalid list');
3242 item.next.previous = undefined;
3243 this._head = item.next;
3245 else if (item === this._tail) {
3246 // This can only happend if size === 1 which is handle
3247 // by the case above.
3248 if (!item.previous) {
3249 throw new Error('Invalid list');
3251 item.previous.next = undefined;
3252 this._tail = item.previous;
3255 const next = item.next;
3256 const previous = item.previous;
3257 if (!next || !previous) {
3258 throw new Error('Invalid list');
3260 next.previous = previous;
3261 previous.next = next;
3263 item.next = undefined;
3264 item.previous = undefined;
3267 touch(item, touch) {
3268 if (!this._head || !this._tail) {
3269 throw new Error('Invalid list');
3271 if ((touch !== Touch.First && touch !== Touch.Last)) {
3274 if (touch === Touch.First) {
3275 if (item === this._head) {
3278 const next = item.next;
3279 const previous = item.previous;
3281 if (item === this._tail) {
3282 // previous must be defined since item was not head but is tail
3283 // So there are more than on item in the map
3284 previous.next = undefined;
3285 this._tail = previous;
3288 // Both next and previous are not undefined since item was neither head nor tail.
3289 next.previous = previous;
3290 previous.next = next;
3292 // Insert the node at head
3293 item.previous = undefined;
3294 item.next = this._head;
3295 this._head.previous = item;
3299 else if (touch === Touch.Last) {
3300 if (item === this._tail) {
3303 const next = item.next;
3304 const previous = item.previous;
3306 if (item === this._head) {
3307 // next must be defined since item was not tail but is head
3308 // So there are more than on item in the map
3309 next.previous = undefined;
3313 // Both next and previous are not undefined since item was neither head nor tail.
3314 next.previous = previous;
3315 previous.next = next;
3317 item.next = undefined;
3318 item.previous = this._tail;
3319 this._tail.next = item;
3326 this.forEach((value, key) => {
3327 data.push([key, value]);
3333 for (const [key, value] of data) {
3334 this.set(key, value);
3338 exports.LinkedMap = LinkedMap;
3339 class LRUCache extends LinkedMap {
3340 constructor(limit, ratio = 1) {
3342 this._limit = limit;
3343 this._ratio = Math.min(Math.max(0, ratio), 1);
3349 this._limit = limit;
3356 this._ratio = Math.min(Math.max(0, ratio), 1);
3359 get(key, touch = Touch.AsNew) {
3360 return super.get(key, touch);
3363 return super.get(key, Touch.None);
3366 super.set(key, value, Touch.Last);
3371 if (this.size > this._limit) {
3372 this.trimOld(Math.round(this._limit * this._ratio));
3376 exports.LRUCache = LRUCache;
3377 //# sourceMappingURL=linkedMap.js.map
3381 /***/ ((module) => {
3383 module.exports = require("os");;
3387 /***/ ((module) => {
3389 module.exports = require("crypto");;
3393 /***/ ((module) => {
3395 module.exports = require("net");;
3399 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3402 /* --------------------------------------------------------------------------------------------
3403 * Copyright (c) Microsoft Corporation. All rights reserved.
3404 * Licensed under the MIT License. See License.txt in the project root for license information.
3405 * ------------------------------------------------------------------------------------------ */
3406 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3407 if (k2 === undefined) k2 = k;
3408 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3409 }) : (function(o, m, k, k2) {
3410 if (k2 === undefined) k2 = k;
3413 var __exportStar = (this && this.__exportStar) || function(m, exports) {
3414 for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3416 Object.defineProperty(exports, "__esModule", ({ value: true }));
3417 exports.LSPErrorCodes = exports.createProtocolConnection = void 0;
3418 __exportStar(__webpack_require__(6), exports);
3419 __exportStar(__webpack_require__(26), exports);
3420 __exportStar(__webpack_require__(27), exports);
3421 __exportStar(__webpack_require__(28), exports);
3422 var connection_1 = __webpack_require__(45);
3423 Object.defineProperty(exports, "createProtocolConnection", ({ enumerable: true, get: function () { return connection_1.createProtocolConnection; } }));
3425 (function (LSPErrorCodes) {
3427 * This is the start range of LSP reserved error codes.
3428 * It doesn't denote a real error code.
3432 LSPErrorCodes.lspReservedErrorRangeStart = -32899;
3433 LSPErrorCodes.ContentModified = -32801;
3434 LSPErrorCodes.RequestCancelled = -32800;
3436 * This is the end range of LSP reserved error codes.
3437 * It doesn't denote a real error code.
3441 LSPErrorCodes.lspReservedErrorRangeEnd = -32800;
3442 })(LSPErrorCodes = exports.LSPErrorCodes || (exports.LSPErrorCodes = {}));
3443 //# sourceMappingURL=api.js.map
3447 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3449 __webpack_require__.r(__webpack_exports__);
3450 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3451 /* harmony export */ "integer": () => /* binding */ integer,
3452 /* harmony export */ "uinteger": () => /* binding */ uinteger,
3453 /* harmony export */ "Position": () => /* binding */ Position,
3454 /* harmony export */ "Range": () => /* binding */ Range,
3455 /* harmony export */ "Location": () => /* binding */ Location,
3456 /* harmony export */ "LocationLink": () => /* binding */ LocationLink,
3457 /* harmony export */ "Color": () => /* binding */ Color,
3458 /* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
3459 /* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
3460 /* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
3461 /* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
3462 /* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
3463 /* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
3464 /* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
3465 /* harmony export */ "CodeDescription": () => /* binding */ CodeDescription,
3466 /* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
3467 /* harmony export */ "Command": () => /* binding */ Command,
3468 /* harmony export */ "TextEdit": () => /* binding */ TextEdit,
3469 /* harmony export */ "ChangeAnnotation": () => /* binding */ ChangeAnnotation,
3470 /* harmony export */ "ChangeAnnotationIdentifier": () => /* binding */ ChangeAnnotationIdentifier,
3471 /* harmony export */ "AnnotatedTextEdit": () => /* binding */ AnnotatedTextEdit,
3472 /* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
3473 /* harmony export */ "CreateFile": () => /* binding */ CreateFile,
3474 /* harmony export */ "RenameFile": () => /* binding */ RenameFile,
3475 /* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
3476 /* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
3477 /* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
3478 /* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
3479 /* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
3480 /* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* binding */ OptionalVersionedTextDocumentIdentifier,
3481 /* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
3482 /* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
3483 /* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
3484 /* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
3485 /* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
3486 /* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
3487 /* harmony export */ "InsertReplaceEdit": () => /* binding */ InsertReplaceEdit,
3488 /* harmony export */ "InsertTextMode": () => /* binding */ InsertTextMode,
3489 /* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
3490 /* harmony export */ "CompletionList": () => /* binding */ CompletionList,
3491 /* harmony export */ "MarkedString": () => /* binding */ MarkedString,
3492 /* harmony export */ "Hover": () => /* binding */ Hover,
3493 /* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
3494 /* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
3495 /* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
3496 /* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
3497 /* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
3498 /* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
3499 /* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
3500 /* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
3501 /* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
3502 /* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
3503 /* harmony export */ "CodeAction": () => /* binding */ CodeAction,
3504 /* harmony export */ "CodeLens": () => /* binding */ CodeLens,
3505 /* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
3506 /* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
3507 /* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
3508 /* harmony export */ "EOL": () => /* binding */ EOL,
3509 /* harmony export */ "TextDocument": () => /* binding */ TextDocument
3510 /* harmony export */ });
3511 /* --------------------------------------------------------------------------------------------
3512 * Copyright (c) Microsoft Corporation. All rights reserved.
3513 * Licensed under the MIT License. See License.txt in the project root for license information.
3514 * ------------------------------------------------------------------------------------------ */
3517 (function (integer) {
3518 integer.MIN_VALUE = -2147483648;
3519 integer.MAX_VALUE = 2147483647;
3520 })(integer || (integer = {}));
3522 (function (uinteger) {
3523 uinteger.MIN_VALUE = 0;
3524 uinteger.MAX_VALUE = 2147483647;
3525 })(uinteger || (uinteger = {}));
3527 * The Position namespace provides helper functions to work with
3528 * [Position](#Position) literals.
3531 (function (Position) {
3533 * Creates a new Position literal from the given line and character.
3534 * @param line The position's line.
3535 * @param character The position's character.
3537 function create(line, character) {
3538 if (line === Number.MAX_VALUE) {
3539 line = uinteger.MAX_VALUE;
3541 if (character === Number.MAX_VALUE) {
3542 character = uinteger.MAX_VALUE;
3544 return { line: line, character: character };
3546 Position.create = create;
3548 * Checks whether the given literal conforms to the [Position](#Position) interface.
3550 function is(value) {
3551 var candidate = value;
3552 return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
3555 })(Position || (Position = {}));
3557 * The Range namespace provides helper functions to work with
3558 * [Range](#Range) literals.
3562 function create(one, two, three, four) {
3563 if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
3564 return { start: Position.create(one, two), end: Position.create(three, four) };
3566 else if (Position.is(one) && Position.is(two)) {
3567 return { start: one, end: two };
3570 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
3573 Range.create = create;
3575 * Checks whether the given literal conforms to the [Range](#Range) interface.
3577 function is(value) {
3578 var candidate = value;
3579 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
3582 })(Range || (Range = {}));
3584 * The Location namespace provides helper functions to work with
3585 * [Location](#Location) literals.
3588 (function (Location) {
3590 * Creates a Location literal.
3591 * @param uri The location's uri.
3592 * @param range The location's range.
3594 function create(uri, range) {
3595 return { uri: uri, range: range };
3597 Location.create = create;
3599 * Checks whether the given literal conforms to the [Location](#Location) interface.
3601 function is(value) {
3602 var candidate = value;
3603 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3606 })(Location || (Location = {}));
3608 * The LocationLink namespace provides helper functions to work with
3609 * [LocationLink](#LocationLink) literals.
3612 (function (LocationLink) {
3614 * Creates a LocationLink literal.
3615 * @param targetUri The definition's uri.
3616 * @param targetRange The full range of the definition.
3617 * @param targetSelectionRange The span of the symbol definition at the target.
3618 * @param originSelectionRange The span of the symbol being defined in the originating source file.
3620 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
3621 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
3623 LocationLink.create = create;
3625 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
3627 function is(value) {
3628 var candidate = value;
3629 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
3630 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
3631 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3633 LocationLink.is = is;
3634 })(LocationLink || (LocationLink = {}));
3636 * The Color namespace provides helper functions to work with
3637 * [Color](#Color) literals.
3642 * Creates a new Color literal.
3644 function create(red, green, blue, alpha) {
3652 Color.create = create;
3654 * Checks whether the given literal conforms to the [Color](#Color) interface.
3656 function is(value) {
3657 var candidate = value;
3658 return Is.numberRange(candidate.red, 0, 1)
3659 && Is.numberRange(candidate.green, 0, 1)
3660 && Is.numberRange(candidate.blue, 0, 1)
3661 && Is.numberRange(candidate.alpha, 0, 1);
3664 })(Color || (Color = {}));
3666 * The ColorInformation namespace provides helper functions to work with
3667 * [ColorInformation](#ColorInformation) literals.
3669 var ColorInformation;
3670 (function (ColorInformation) {
3672 * Creates a new ColorInformation literal.
3674 function create(range, color) {
3680 ColorInformation.create = create;
3682 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
3684 function is(value) {
3685 var candidate = value;
3686 return Range.is(candidate.range) && Color.is(candidate.color);
3688 ColorInformation.is = is;
3689 })(ColorInformation || (ColorInformation = {}));
3691 * The Color namespace provides helper functions to work with
3692 * [ColorPresentation](#ColorPresentation) literals.
3694 var ColorPresentation;
3695 (function (ColorPresentation) {
3697 * Creates a new ColorInformation literal.
3699 function create(label, textEdit, additionalTextEdits) {
3703 additionalTextEdits: additionalTextEdits,
3706 ColorPresentation.create = create;
3708 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
3710 function is(value) {
3711 var candidate = value;
3712 return Is.string(candidate.label)
3713 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
3714 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
3716 ColorPresentation.is = is;
3717 })(ColorPresentation || (ColorPresentation = {}));
3719 * Enum of known range kinds
3721 var FoldingRangeKind;
3722 (function (FoldingRangeKind) {
3724 * Folding range for a comment
3726 FoldingRangeKind["Comment"] = "comment";
3728 * Folding range for a imports or includes
3730 FoldingRangeKind["Imports"] = "imports";
3732 * Folding range for a region (e.g. `#region`)
3734 FoldingRangeKind["Region"] = "region";
3735 })(FoldingRangeKind || (FoldingRangeKind = {}));
3737 * The folding range namespace provides helper functions to work with
3738 * [FoldingRange](#FoldingRange) literals.
3741 (function (FoldingRange) {
3743 * Creates a new FoldingRange literal.
3745 function create(startLine, endLine, startCharacter, endCharacter, kind) {
3747 startLine: startLine,
3750 if (Is.defined(startCharacter)) {
3751 result.startCharacter = startCharacter;
3753 if (Is.defined(endCharacter)) {
3754 result.endCharacter = endCharacter;
3756 if (Is.defined(kind)) {
3761 FoldingRange.create = create;
3763 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
3765 function is(value) {
3766 var candidate = value;
3767 return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
3768 && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
3769 && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
3770 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
3772 FoldingRange.is = is;
3773 })(FoldingRange || (FoldingRange = {}));
3775 * The DiagnosticRelatedInformation namespace provides helper functions to work with
3776 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
3778 var DiagnosticRelatedInformation;
3779 (function (DiagnosticRelatedInformation) {
3781 * Creates a new DiagnosticRelatedInformation literal.
3783 function create(location, message) {
3789 DiagnosticRelatedInformation.create = create;
3791 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
3793 function is(value) {
3794 var candidate = value;
3795 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
3797 DiagnosticRelatedInformation.is = is;
3798 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
3800 * The diagnostic's severity.
3802 var DiagnosticSeverity;
3803 (function (DiagnosticSeverity) {
3807 DiagnosticSeverity.Error = 1;
3809 * Reports a warning.
3811 DiagnosticSeverity.Warning = 2;
3813 * Reports an information.
3815 DiagnosticSeverity.Information = 3;
3819 DiagnosticSeverity.Hint = 4;
3820 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
3822 * The diagnostic tags.
3827 (function (DiagnosticTag) {
3829 * Unused or unnecessary code.
3831 * Clients are allowed to render diagnostics with this tag faded out instead of having
3832 * an error squiggle.
3834 DiagnosticTag.Unnecessary = 1;
3836 * Deprecated or obsolete code.
3838 * Clients are allowed to rendered diagnostics with this tag strike through.
3840 DiagnosticTag.Deprecated = 2;
3841 })(DiagnosticTag || (DiagnosticTag = {}));
3843 * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
3847 var CodeDescription;
3848 (function (CodeDescription) {
3849 function is(value) {
3850 var candidate = value;
3851 return candidate !== undefined && candidate !== null && Is.string(candidate.href);
3853 CodeDescription.is = is;
3854 })(CodeDescription || (CodeDescription = {}));
3856 * The Diagnostic namespace provides helper functions to work with
3857 * [Diagnostic](#Diagnostic) literals.
3860 (function (Diagnostic) {
3862 * Creates a new Diagnostic literal.
3864 function create(range, message, severity, code, source, relatedInformation) {
3865 var result = { range: range, message: message };
3866 if (Is.defined(severity)) {
3867 result.severity = severity;
3869 if (Is.defined(code)) {
3872 if (Is.defined(source)) {
3873 result.source = source;
3875 if (Is.defined(relatedInformation)) {
3876 result.relatedInformation = relatedInformation;
3880 Diagnostic.create = create;
3882 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
3884 function is(value) {
3886 var candidate = value;
3887 return Is.defined(candidate)
3888 && Range.is(candidate.range)
3889 && Is.string(candidate.message)
3890 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
3891 && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
3892 && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
3893 && (Is.string(candidate.source) || Is.undefined(candidate.source))
3894 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
3897 })(Diagnostic || (Diagnostic = {}));
3899 * The Command namespace provides helper functions to work with
3900 * [Command](#Command) literals.
3903 (function (Command) {
3905 * Creates a new Command literal.
3907 function create(title, command) {
3909 for (var _i = 2; _i < arguments.length; _i++) {
3910 args[_i - 2] = arguments[_i];
3912 var result = { title: title, command: command };
3913 if (Is.defined(args) && args.length > 0) {
3914 result.arguments = args;
3918 Command.create = create;
3920 * Checks whether the given literal conforms to the [Command](#Command) interface.
3922 function is(value) {
3923 var candidate = value;
3924 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
3927 })(Command || (Command = {}));
3929 * The TextEdit namespace provides helper function to create replace,
3930 * insert and delete edits more easily.
3933 (function (TextEdit) {
3935 * Creates a replace text edit.
3936 * @param range The range of text to be replaced.
3937 * @param newText The new text.
3939 function replace(range, newText) {
3940 return { range: range, newText: newText };
3942 TextEdit.replace = replace;
3944 * Creates a insert text edit.
3945 * @param position The position to insert the text at.
3946 * @param newText The text to be inserted.
3948 function insert(position, newText) {
3949 return { range: { start: position, end: position }, newText: newText };
3951 TextEdit.insert = insert;
3953 * Creates a delete text edit.
3954 * @param range The range of text to be deleted.
3956 function del(range) {
3957 return { range: range, newText: '' };
3960 function is(value) {
3961 var candidate = value;
3962 return Is.objectLiteral(candidate)
3963 && Is.string(candidate.newText)
3964 && Range.is(candidate.range);
3967 })(TextEdit || (TextEdit = {}));
3968 var ChangeAnnotation;
3969 (function (ChangeAnnotation) {
3970 function create(label, needsConfirmation, description) {
3971 var result = { label: label };
3972 if (needsConfirmation !== undefined) {
3973 result.needsConfirmation = needsConfirmation;
3975 if (description !== undefined) {
3976 result.description = description;
3980 ChangeAnnotation.create = create;
3981 function is(value) {
3982 var candidate = value;
3983 return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
3984 (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
3985 (Is.string(candidate.description) || candidate.description === undefined);
3987 ChangeAnnotation.is = is;
3988 })(ChangeAnnotation || (ChangeAnnotation = {}));
3989 var ChangeAnnotationIdentifier;
3990 (function (ChangeAnnotationIdentifier) {
3991 function is(value) {
3992 var candidate = value;
3993 return typeof candidate === 'string';
3995 ChangeAnnotationIdentifier.is = is;
3996 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
3997 var AnnotatedTextEdit;
3998 (function (AnnotatedTextEdit) {
4000 * Creates an annotated replace text edit.
4002 * @param range The range of text to be replaced.
4003 * @param newText The new text.
4004 * @param annotation The annotation.
4006 function replace(range, newText, annotation) {
4007 return { range: range, newText: newText, annotationId: annotation };
4009 AnnotatedTextEdit.replace = replace;
4011 * Creates an annotated insert text edit.
4013 * @param position The position to insert the text at.
4014 * @param newText The text to be inserted.
4015 * @param annotation The annotation.
4017 function insert(position, newText, annotation) {
4018 return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
4020 AnnotatedTextEdit.insert = insert;
4022 * Creates an annotated delete text edit.
4024 * @param range The range of text to be deleted.
4025 * @param annotation The annotation.
4027 function del(range, annotation) {
4028 return { range: range, newText: '', annotationId: annotation };
4030 AnnotatedTextEdit.del = del;
4031 function is(value) {
4032 var candidate = value;
4033 return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
4035 AnnotatedTextEdit.is = is;
4036 })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
4038 * The TextDocumentEdit namespace provides helper function to create
4039 * an edit that manipulates a text document.
4041 var TextDocumentEdit;
4042 (function (TextDocumentEdit) {
4044 * Creates a new `TextDocumentEdit`
4046 function create(textDocument, edits) {
4047 return { textDocument: textDocument, edits: edits };
4049 TextDocumentEdit.create = create;
4050 function is(value) {
4051 var candidate = value;
4052 return Is.defined(candidate)
4053 && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
4054 && Array.isArray(candidate.edits);
4056 TextDocumentEdit.is = is;
4057 })(TextDocumentEdit || (TextDocumentEdit = {}));
4059 (function (CreateFile) {
4060 function create(uri, options, annotation) {
4065 if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
4066 result.options = options;
4068 if (annotation !== undefined) {
4069 result.annotationId = annotation;
4073 CreateFile.create = create;
4074 function is(value) {
4075 var candidate = value;
4076 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
4077 ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
4080 })(CreateFile || (CreateFile = {}));
4082 (function (RenameFile) {
4083 function create(oldUri, newUri, options, annotation) {
4089 if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
4090 result.options = options;
4092 if (annotation !== undefined) {
4093 result.annotationId = annotation;
4097 RenameFile.create = create;
4098 function is(value) {
4099 var candidate = value;
4100 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
4101 ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
4104 })(RenameFile || (RenameFile = {}));
4106 (function (DeleteFile) {
4107 function create(uri, options, annotation) {
4112 if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
4113 result.options = options;
4115 if (annotation !== undefined) {
4116 result.annotationId = annotation;
4120 DeleteFile.create = create;
4121 function is(value) {
4122 var candidate = value;
4123 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
4124 ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
4127 })(DeleteFile || (DeleteFile = {}));
4129 (function (WorkspaceEdit) {
4130 function is(value) {
4131 var candidate = value;
4133 (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
4134 (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
4135 if (Is.string(change.kind)) {
4136 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
4139 return TextDocumentEdit.is(change);
4143 WorkspaceEdit.is = is;
4144 })(WorkspaceEdit || (WorkspaceEdit = {}));
4145 var TextEditChangeImpl = /** @class */ (function () {
4146 function TextEditChangeImpl(edits, changeAnnotations) {
4148 this.changeAnnotations = changeAnnotations;
4150 TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
4153 if (annotation === undefined) {
4154 edit = TextEdit.insert(position, newText);
4156 else if (ChangeAnnotationIdentifier.is(annotation)) {
4158 edit = AnnotatedTextEdit.insert(position, newText, annotation);
4161 this.assertChangeAnnotations(this.changeAnnotations);
4162 id = this.changeAnnotations.manage(annotation);
4163 edit = AnnotatedTextEdit.insert(position, newText, id);
4165 this.edits.push(edit);
4166 if (id !== undefined) {
4170 TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
4173 if (annotation === undefined) {
4174 edit = TextEdit.replace(range, newText);
4176 else if (ChangeAnnotationIdentifier.is(annotation)) {
4178 edit = AnnotatedTextEdit.replace(range, newText, annotation);
4181 this.assertChangeAnnotations(this.changeAnnotations);
4182 id = this.changeAnnotations.manage(annotation);
4183 edit = AnnotatedTextEdit.replace(range, newText, id);
4185 this.edits.push(edit);
4186 if (id !== undefined) {
4190 TextEditChangeImpl.prototype.delete = function (range, annotation) {
4193 if (annotation === undefined) {
4194 edit = TextEdit.del(range);
4196 else if (ChangeAnnotationIdentifier.is(annotation)) {
4198 edit = AnnotatedTextEdit.del(range, annotation);
4201 this.assertChangeAnnotations(this.changeAnnotations);
4202 id = this.changeAnnotations.manage(annotation);
4203 edit = AnnotatedTextEdit.del(range, id);
4205 this.edits.push(edit);
4206 if (id !== undefined) {
4210 TextEditChangeImpl.prototype.add = function (edit) {
4211 this.edits.push(edit);
4213 TextEditChangeImpl.prototype.all = function () {
4216 TextEditChangeImpl.prototype.clear = function () {
4217 this.edits.splice(0, this.edits.length);
4219 TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
4220 if (value === undefined) {
4221 throw new Error("Text edit change is not configured to manage change annotations.");
4224 return TextEditChangeImpl;
4229 var ChangeAnnotations = /** @class */ (function () {
4230 function ChangeAnnotations(annotations) {
4231 this._annotations = annotations === undefined ? Object.create(null) : annotations;
4235 ChangeAnnotations.prototype.all = function () {
4236 return this._annotations;
4238 Object.defineProperty(ChangeAnnotations.prototype, "size", {
4245 ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
4247 if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
4248 id = idOrAnnotation;
4252 annotation = idOrAnnotation;
4254 if (this._annotations[id] !== undefined) {
4255 throw new Error("Id " + id + " is already in use.");
4257 if (annotation === undefined) {
4258 throw new Error("No annotation provided for id " + id);
4260 this._annotations[id] = annotation;
4264 ChangeAnnotations.prototype.nextId = function () {
4266 return this._counter.toString();
4268 return ChangeAnnotations;
4271 * A workspace change helps constructing changes to a workspace.
4273 var WorkspaceChange = /** @class */ (function () {
4274 function WorkspaceChange(workspaceEdit) {
4276 this._textEditChanges = Object.create(null);
4277 if (workspaceEdit !== undefined) {
4278 this._workspaceEdit = workspaceEdit;
4279 if (workspaceEdit.documentChanges) {
4280 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
4281 workspaceEdit.changeAnnotations = this._changeAnnotations.all();
4282 workspaceEdit.documentChanges.forEach(function (change) {
4283 if (TextDocumentEdit.is(change)) {
4284 var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
4285 _this._textEditChanges[change.textDocument.uri] = textEditChange;
4289 else if (workspaceEdit.changes) {
4290 Object.keys(workspaceEdit.changes).forEach(function (key) {
4291 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
4292 _this._textEditChanges[key] = textEditChange;
4297 this._workspaceEdit = {};
4300 Object.defineProperty(WorkspaceChange.prototype, "edit", {
4302 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
4303 * use to be returned from a workspace edit operation like rename.
4306 this.initDocumentChanges();
4307 if (this._changeAnnotations !== undefined) {
4308 if (this._changeAnnotations.size === 0) {
4309 this._workspaceEdit.changeAnnotations = undefined;
4312 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
4315 return this._workspaceEdit;
4320 WorkspaceChange.prototype.getTextEditChange = function (key) {
4321 if (OptionalVersionedTextDocumentIdentifier.is(key)) {
4322 this.initDocumentChanges();
4323 if (this._workspaceEdit.documentChanges === undefined) {
4324 throw new Error('Workspace edit is not configured for document changes.');
4326 var textDocument = { uri: key.uri, version: key.version };
4327 var result = this._textEditChanges[textDocument.uri];
4330 var textDocumentEdit = {
4331 textDocument: textDocument,
4334 this._workspaceEdit.documentChanges.push(textDocumentEdit);
4335 result = new TextEditChangeImpl(edits, this._changeAnnotations);
4336 this._textEditChanges[textDocument.uri] = result;
4342 if (this._workspaceEdit.changes === undefined) {
4343 throw new Error('Workspace edit is not configured for normal text edit changes.');
4345 var result = this._textEditChanges[key];
4348 this._workspaceEdit.changes[key] = edits;
4349 result = new TextEditChangeImpl(edits);
4350 this._textEditChanges[key] = result;
4355 WorkspaceChange.prototype.initDocumentChanges = function () {
4356 if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
4357 this._changeAnnotations = new ChangeAnnotations();
4358 this._workspaceEdit.documentChanges = [];
4359 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
4362 WorkspaceChange.prototype.initChanges = function () {
4363 if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
4364 this._workspaceEdit.changes = Object.create(null);
4367 WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
4368 this.initDocumentChanges();
4369 if (this._workspaceEdit.documentChanges === undefined) {
4370 throw new Error('Workspace edit is not configured for document changes.');
4373 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
4374 annotation = optionsOrAnnotation;
4377 options = optionsOrAnnotation;
4381 if (annotation === undefined) {
4382 operation = CreateFile.create(uri, options);
4385 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
4386 operation = CreateFile.create(uri, options, id);
4388 this._workspaceEdit.documentChanges.push(operation);
4389 if (id !== undefined) {
4393 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
4394 this.initDocumentChanges();
4395 if (this._workspaceEdit.documentChanges === undefined) {
4396 throw new Error('Workspace edit is not configured for document changes.');
4399 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
4400 annotation = optionsOrAnnotation;
4403 options = optionsOrAnnotation;
4407 if (annotation === undefined) {
4408 operation = RenameFile.create(oldUri, newUri, options);
4411 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
4412 operation = RenameFile.create(oldUri, newUri, options, id);
4414 this._workspaceEdit.documentChanges.push(operation);
4415 if (id !== undefined) {
4419 WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
4420 this.initDocumentChanges();
4421 if (this._workspaceEdit.documentChanges === undefined) {
4422 throw new Error('Workspace edit is not configured for document changes.');
4425 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
4426 annotation = optionsOrAnnotation;
4429 options = optionsOrAnnotation;
4433 if (annotation === undefined) {
4434 operation = DeleteFile.create(uri, options);
4437 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
4438 operation = DeleteFile.create(uri, options, id);
4440 this._workspaceEdit.documentChanges.push(operation);
4441 if (id !== undefined) {
4445 return WorkspaceChange;
4449 * The TextDocumentIdentifier namespace provides helper functions to work with
4450 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
4452 var TextDocumentIdentifier;
4453 (function (TextDocumentIdentifier) {
4455 * Creates a new TextDocumentIdentifier literal.
4456 * @param uri The document's uri.
4458 function create(uri) {
4459 return { uri: uri };
4461 TextDocumentIdentifier.create = create;
4463 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
4465 function is(value) {
4466 var candidate = value;
4467 return Is.defined(candidate) && Is.string(candidate.uri);
4469 TextDocumentIdentifier.is = is;
4470 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
4472 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
4473 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
4475 var VersionedTextDocumentIdentifier;
4476 (function (VersionedTextDocumentIdentifier) {
4478 * Creates a new VersionedTextDocumentIdentifier literal.
4479 * @param uri The document's uri.
4480 * @param uri The document's text.
4482 function create(uri, version) {
4483 return { uri: uri, version: version };
4485 VersionedTextDocumentIdentifier.create = create;
4487 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
4489 function is(value) {
4490 var candidate = value;
4491 return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
4493 VersionedTextDocumentIdentifier.is = is;
4494 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
4496 * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
4497 * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
4499 var OptionalVersionedTextDocumentIdentifier;
4500 (function (OptionalVersionedTextDocumentIdentifier) {
4502 * Creates a new OptionalVersionedTextDocumentIdentifier literal.
4503 * @param uri The document's uri.
4504 * @param uri The document's text.
4506 function create(uri, version) {
4507 return { uri: uri, version: version };
4509 OptionalVersionedTextDocumentIdentifier.create = create;
4511 * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
4513 function is(value) {
4514 var candidate = value;
4515 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
4517 OptionalVersionedTextDocumentIdentifier.is = is;
4518 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
4520 * The TextDocumentItem namespace provides helper functions to work with
4521 * [TextDocumentItem](#TextDocumentItem) literals.
4523 var TextDocumentItem;
4524 (function (TextDocumentItem) {
4526 * Creates a new TextDocumentItem literal.
4527 * @param uri The document's uri.
4528 * @param languageId The document's language identifier.
4529 * @param version The document's version number.
4530 * @param text The document's text.
4532 function create(uri, languageId, version, text) {
4533 return { uri: uri, languageId: languageId, version: version, text: text };
4535 TextDocumentItem.create = create;
4537 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
4539 function is(value) {
4540 var candidate = value;
4541 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
4543 TextDocumentItem.is = is;
4544 })(TextDocumentItem || (TextDocumentItem = {}));
4546 * Describes the content type that a client supports in various
4547 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
4549 * Please note that `MarkupKinds` must not start with a `$`. This kinds
4550 * are reserved for internal usage.
4553 (function (MarkupKind) {
4555 * Plain text is supported as a content format
4557 MarkupKind.PlainText = 'plaintext';
4559 * Markdown is supported as a content format
4561 MarkupKind.Markdown = 'markdown';
4562 })(MarkupKind || (MarkupKind = {}));
4563 (function (MarkupKind) {
4565 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
4567 function is(value) {
4568 var candidate = value;
4569 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
4572 })(MarkupKind || (MarkupKind = {}));
4574 (function (MarkupContent) {
4576 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
4578 function is(value) {
4579 var candidate = value;
4580 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
4582 MarkupContent.is = is;
4583 })(MarkupContent || (MarkupContent = {}));
4585 * The kind of a completion entry.
4587 var CompletionItemKind;
4588 (function (CompletionItemKind) {
4589 CompletionItemKind.Text = 1;
4590 CompletionItemKind.Method = 2;
4591 CompletionItemKind.Function = 3;
4592 CompletionItemKind.Constructor = 4;
4593 CompletionItemKind.Field = 5;
4594 CompletionItemKind.Variable = 6;
4595 CompletionItemKind.Class = 7;
4596 CompletionItemKind.Interface = 8;
4597 CompletionItemKind.Module = 9;
4598 CompletionItemKind.Property = 10;
4599 CompletionItemKind.Unit = 11;
4600 CompletionItemKind.Value = 12;
4601 CompletionItemKind.Enum = 13;
4602 CompletionItemKind.Keyword = 14;
4603 CompletionItemKind.Snippet = 15;
4604 CompletionItemKind.Color = 16;
4605 CompletionItemKind.File = 17;
4606 CompletionItemKind.Reference = 18;
4607 CompletionItemKind.Folder = 19;
4608 CompletionItemKind.EnumMember = 20;
4609 CompletionItemKind.Constant = 21;
4610 CompletionItemKind.Struct = 22;
4611 CompletionItemKind.Event = 23;
4612 CompletionItemKind.Operator = 24;
4613 CompletionItemKind.TypeParameter = 25;
4614 })(CompletionItemKind || (CompletionItemKind = {}));
4616 * Defines whether the insert text in a completion item should be interpreted as
4617 * plain text or a snippet.
4619 var InsertTextFormat;
4620 (function (InsertTextFormat) {
4622 * The primary text to be inserted is treated as a plain string.
4624 InsertTextFormat.PlainText = 1;
4626 * The primary text to be inserted is treated as a snippet.
4628 * A snippet can define tab stops and placeholders with `$1`, `$2`
4629 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
4630 * the end of the snippet. Placeholders with equal identifiers are linked,
4631 * that is typing in one will update others too.
4633 * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
4635 InsertTextFormat.Snippet = 2;
4636 })(InsertTextFormat || (InsertTextFormat = {}));
4638 * Completion item tags are extra annotations that tweak the rendering of a completion
4643 var CompletionItemTag;
4644 (function (CompletionItemTag) {
4646 * Render a completion as obsolete, usually using a strike-out.
4648 CompletionItemTag.Deprecated = 1;
4649 })(CompletionItemTag || (CompletionItemTag = {}));
4651 * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
4655 var InsertReplaceEdit;
4656 (function (InsertReplaceEdit) {
4658 * Creates a new insert / replace edit
4660 function create(newText, insert, replace) {
4661 return { newText: newText, insert: insert, replace: replace };
4663 InsertReplaceEdit.create = create;
4665 * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
4667 function is(value) {
4668 var candidate = value;
4669 return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
4671 InsertReplaceEdit.is = is;
4672 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
4674 * How whitespace and indentation is handled during completion
4680 (function (InsertTextMode) {
4682 * The insertion or replace strings is taken as it is. If the
4683 * value is multi line the lines below the cursor will be
4684 * inserted using the indentation defined in the string value.
4685 * The client will not apply any kind of adjustments to the
4688 InsertTextMode.asIs = 1;
4690 * The editor adjusts leading whitespace of new lines so that
4691 * they match the indentation up to the cursor of the line for
4692 * which the item is accepted.
4694 * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
4695 * multi line completion item is indented using 2 tabs and all
4696 * following lines inserted will be indented using 2 tabs as well.
4698 InsertTextMode.adjustIndentation = 2;
4699 })(InsertTextMode || (InsertTextMode = {}));
4701 * The CompletionItem namespace provides functions to deal with
4705 (function (CompletionItem) {
4707 * Create a completion item and seed it with a label.
4708 * @param label The completion item's label
4710 function create(label) {
4711 return { label: label };
4713 CompletionItem.create = create;
4714 })(CompletionItem || (CompletionItem = {}));
4716 * The CompletionList namespace provides functions to deal with
4720 (function (CompletionList) {
4722 * Creates a new completion list.
4724 * @param items The completion items.
4725 * @param isIncomplete The list is not complete.
4727 function create(items, isIncomplete) {
4728 return { items: items ? items : [], isIncomplete: !!isIncomplete };
4730 CompletionList.create = create;
4731 })(CompletionList || (CompletionList = {}));
4733 (function (MarkedString) {
4735 * Creates a marked string from plain text.
4737 * @param plainText The plain text.
4739 function fromPlainText(plainText) {
4740 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
4742 MarkedString.fromPlainText = fromPlainText;
4744 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
4746 function is(value) {
4747 var candidate = value;
4748 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
4750 MarkedString.is = is;
4751 })(MarkedString || (MarkedString = {}));
4755 * Checks whether the given value conforms to the [Hover](#Hover) interface.
4757 function is(value) {
4758 var candidate = value;
4759 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
4760 MarkedString.is(candidate.contents) ||
4761 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
4764 })(Hover || (Hover = {}));
4766 * The ParameterInformation namespace provides helper functions to work with
4767 * [ParameterInformation](#ParameterInformation) literals.
4769 var ParameterInformation;
4770 (function (ParameterInformation) {
4772 * Creates a new parameter information literal.
4774 * @param label A label string.
4775 * @param documentation A doc string.
4777 function create(label, documentation) {
4778 return documentation ? { label: label, documentation: documentation } : { label: label };
4780 ParameterInformation.create = create;
4781 })(ParameterInformation || (ParameterInformation = {}));
4783 * The SignatureInformation namespace provides helper functions to work with
4784 * [SignatureInformation](#SignatureInformation) literals.
4786 var SignatureInformation;
4787 (function (SignatureInformation) {
4788 function create(label, documentation) {
4789 var parameters = [];
4790 for (var _i = 2; _i < arguments.length; _i++) {
4791 parameters[_i - 2] = arguments[_i];
4793 var result = { label: label };
4794 if (Is.defined(documentation)) {
4795 result.documentation = documentation;
4797 if (Is.defined(parameters)) {
4798 result.parameters = parameters;
4801 result.parameters = [];
4805 SignatureInformation.create = create;
4806 })(SignatureInformation || (SignatureInformation = {}));
4808 * A document highlight kind.
4810 var DocumentHighlightKind;
4811 (function (DocumentHighlightKind) {
4813 * A textual occurrence.
4815 DocumentHighlightKind.Text = 1;
4817 * Read-access of a symbol, like reading a variable.
4819 DocumentHighlightKind.Read = 2;
4821 * Write-access of a symbol, like writing to a variable.
4823 DocumentHighlightKind.Write = 3;
4824 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
4826 * DocumentHighlight namespace to provide helper functions to work with
4827 * [DocumentHighlight](#DocumentHighlight) literals.
4829 var DocumentHighlight;
4830 (function (DocumentHighlight) {
4832 * Create a DocumentHighlight object.
4833 * @param range The range the highlight applies to.
4835 function create(range, kind) {
4836 var result = { range: range };
4837 if (Is.number(kind)) {
4842 DocumentHighlight.create = create;
4843 })(DocumentHighlight || (DocumentHighlight = {}));
4848 (function (SymbolKind) {
4849 SymbolKind.File = 1;
4850 SymbolKind.Module = 2;
4851 SymbolKind.Namespace = 3;
4852 SymbolKind.Package = 4;
4853 SymbolKind.Class = 5;
4854 SymbolKind.Method = 6;
4855 SymbolKind.Property = 7;
4856 SymbolKind.Field = 8;
4857 SymbolKind.Constructor = 9;
4858 SymbolKind.Enum = 10;
4859 SymbolKind.Interface = 11;
4860 SymbolKind.Function = 12;
4861 SymbolKind.Variable = 13;
4862 SymbolKind.Constant = 14;
4863 SymbolKind.String = 15;
4864 SymbolKind.Number = 16;
4865 SymbolKind.Boolean = 17;
4866 SymbolKind.Array = 18;
4867 SymbolKind.Object = 19;
4868 SymbolKind.Key = 20;
4869 SymbolKind.Null = 21;
4870 SymbolKind.EnumMember = 22;
4871 SymbolKind.Struct = 23;
4872 SymbolKind.Event = 24;
4873 SymbolKind.Operator = 25;
4874 SymbolKind.TypeParameter = 26;
4875 })(SymbolKind || (SymbolKind = {}));
4877 * Symbol tags are extra annotations that tweak the rendering of a symbol.
4881 (function (SymbolTag) {
4883 * Render a symbol as obsolete, usually using a strike-out.
4885 SymbolTag.Deprecated = 1;
4886 })(SymbolTag || (SymbolTag = {}));
4887 var SymbolInformation;
4888 (function (SymbolInformation) {
4890 * Creates a new symbol information literal.
4892 * @param name The name of the symbol.
4893 * @param kind The kind of the symbol.
4894 * @param range The range of the location of the symbol.
4895 * @param uri The resource of the location of symbol, defaults to the current document.
4896 * @param containerName The name of the symbol containing the symbol.
4898 function create(name, kind, range, uri, containerName) {
4902 location: { uri: uri, range: range }
4904 if (containerName) {
4905 result.containerName = containerName;
4909 SymbolInformation.create = create;
4910 })(SymbolInformation || (SymbolInformation = {}));
4912 (function (DocumentSymbol) {
4914 * Creates a new symbol information literal.
4916 * @param name The name of the symbol.
4917 * @param detail The detail of the symbol.
4918 * @param kind The kind of the symbol.
4919 * @param range The range of the symbol.
4920 * @param selectionRange The selectionRange of the symbol.
4921 * @param children Children of the symbol.
4923 function create(name, detail, kind, range, selectionRange, children) {
4929 selectionRange: selectionRange
4931 if (children !== undefined) {
4932 result.children = children;
4936 DocumentSymbol.create = create;
4938 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
4940 function is(value) {
4941 var candidate = value;
4943 Is.string(candidate.name) && Is.number(candidate.kind) &&
4944 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
4945 (candidate.detail === undefined || Is.string(candidate.detail)) &&
4946 (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
4947 (candidate.children === undefined || Array.isArray(candidate.children)) &&
4948 (candidate.tags === undefined || Array.isArray(candidate.tags));
4950 DocumentSymbol.is = is;
4951 })(DocumentSymbol || (DocumentSymbol = {}));
4953 * A set of predefined code action kinds
4956 (function (CodeActionKind) {
4960 CodeActionKind.Empty = '';
4962 * Base kind for quickfix actions: 'quickfix'
4964 CodeActionKind.QuickFix = 'quickfix';
4966 * Base kind for refactoring actions: 'refactor'
4968 CodeActionKind.Refactor = 'refactor';
4970 * Base kind for refactoring extraction actions: 'refactor.extract'
4972 * Example extract actions:
4975 * - Extract function
4976 * - Extract variable
4977 * - Extract interface from class
4980 CodeActionKind.RefactorExtract = 'refactor.extract';
4982 * Base kind for refactoring inline actions: 'refactor.inline'
4984 * Example inline actions:
4991 CodeActionKind.RefactorInline = 'refactor.inline';
4993 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
4995 * Example rewrite actions:
4997 * - Convert JavaScript function to class
4998 * - Add or remove parameter
4999 * - Encapsulate field
5000 * - Make method static
5001 * - Move method to base class
5004 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
5006 * Base kind for source actions: `source`
5008 * Source code actions apply to the entire file.
5010 CodeActionKind.Source = 'source';
5012 * Base kind for an organize imports source action: `source.organizeImports`
5014 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
5016 * Base kind for auto-fix source actions: `source.fixAll`.
5018 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
5019 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
5023 CodeActionKind.SourceFixAll = 'source.fixAll';
5024 })(CodeActionKind || (CodeActionKind = {}));
5026 * The CodeActionContext namespace provides helper functions to work with
5027 * [CodeActionContext](#CodeActionContext) literals.
5029 var CodeActionContext;
5030 (function (CodeActionContext) {
5032 * Creates a new CodeActionContext literal.
5034 function create(diagnostics, only) {
5035 var result = { diagnostics: diagnostics };
5036 if (only !== undefined && only !== null) {
5041 CodeActionContext.create = create;
5043 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
5045 function is(value) {
5046 var candidate = value;
5047 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
5049 CodeActionContext.is = is;
5050 })(CodeActionContext || (CodeActionContext = {}));
5052 (function (CodeAction) {
5053 function create(title, kindOrCommandOrEdit, kind) {
5054 var result = { title: title };
5055 var checkKind = true;
5056 if (typeof kindOrCommandOrEdit === 'string') {
5058 result.kind = kindOrCommandOrEdit;
5060 else if (Command.is(kindOrCommandOrEdit)) {
5061 result.command = kindOrCommandOrEdit;
5064 result.edit = kindOrCommandOrEdit;
5066 if (checkKind && kind !== undefined) {
5071 CodeAction.create = create;
5072 function is(value) {
5073 var candidate = value;
5074 return candidate && Is.string(candidate.title) &&
5075 (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
5076 (candidate.kind === undefined || Is.string(candidate.kind)) &&
5077 (candidate.edit !== undefined || candidate.command !== undefined) &&
5078 (candidate.command === undefined || Command.is(candidate.command)) &&
5079 (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
5080 (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
5083 })(CodeAction || (CodeAction = {}));
5085 * The CodeLens namespace provides helper functions to work with
5086 * [CodeLens](#CodeLens) literals.
5089 (function (CodeLens) {
5091 * Creates a new CodeLens literal.
5093 function create(range, data) {
5094 var result = { range: range };
5095 if (Is.defined(data)) {
5100 CodeLens.create = create;
5102 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
5104 function is(value) {
5105 var candidate = value;
5106 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
5109 })(CodeLens || (CodeLens = {}));
5111 * The FormattingOptions namespace provides helper functions to work with
5112 * [FormattingOptions](#FormattingOptions) literals.
5114 var FormattingOptions;
5115 (function (FormattingOptions) {
5117 * Creates a new FormattingOptions literal.
5119 function create(tabSize, insertSpaces) {
5120 return { tabSize: tabSize, insertSpaces: insertSpaces };
5122 FormattingOptions.create = create;
5124 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
5126 function is(value) {
5127 var candidate = value;
5128 return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
5130 FormattingOptions.is = is;
5131 })(FormattingOptions || (FormattingOptions = {}));
5133 * The DocumentLink namespace provides helper functions to work with
5134 * [DocumentLink](#DocumentLink) literals.
5137 (function (DocumentLink) {
5139 * Creates a new DocumentLink literal.
5141 function create(range, target, data) {
5142 return { range: range, target: target, data: data };
5144 DocumentLink.create = create;
5146 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
5148 function is(value) {
5149 var candidate = value;
5150 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
5152 DocumentLink.is = is;
5153 })(DocumentLink || (DocumentLink = {}));
5155 * The SelectionRange namespace provides helper function to work with
5156 * SelectionRange literals.
5159 (function (SelectionRange) {
5161 * Creates a new SelectionRange
5162 * @param range the range.
5163 * @param parent an optional parent.
5165 function create(range, parent) {
5166 return { range: range, parent: parent };
5168 SelectionRange.create = create;
5169 function is(value) {
5170 var candidate = value;
5171 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
5173 SelectionRange.is = is;
5174 })(SelectionRange || (SelectionRange = {}));
5175 var EOL = ['\n', '\r\n', '\r'];
5177 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
5180 (function (TextDocument) {
5182 * Creates a new ITextDocument literal from the given uri and content.
5183 * @param uri The document's uri.
5184 * @param languageId The document's language Id.
5185 * @param content The document's content.
5187 function create(uri, languageId, version, content) {
5188 return new FullTextDocument(uri, languageId, version, content);
5190 TextDocument.create = create;
5192 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
5194 function is(value) {
5195 var candidate = value;
5196 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
5197 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
5199 TextDocument.is = is;
5200 function applyEdits(document, edits) {
5201 var text = document.getText();
5202 var sortedEdits = mergeSort(edits, function (a, b) {
5203 var diff = a.range.start.line - b.range.start.line;
5205 return a.range.start.character - b.range.start.character;
5209 var lastModifiedOffset = text.length;
5210 for (var i = sortedEdits.length - 1; i >= 0; i--) {
5211 var e = sortedEdits[i];
5212 var startOffset = document.offsetAt(e.range.start);
5213 var endOffset = document.offsetAt(e.range.end);
5214 if (endOffset <= lastModifiedOffset) {
5215 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
5218 throw new Error('Overlapping edit');
5220 lastModifiedOffset = startOffset;
5224 TextDocument.applyEdits = applyEdits;
5225 function mergeSort(data, compare) {
5226 if (data.length <= 1) {
5230 var p = (data.length / 2) | 0;
5231 var left = data.slice(0, p);
5232 var right = data.slice(p);
5233 mergeSort(left, compare);
5234 mergeSort(right, compare);
5238 while (leftIdx < left.length && rightIdx < right.length) {
5239 var ret = compare(left[leftIdx], right[rightIdx]);
5241 // smaller_equal -> take left to preserve order
5242 data[i++] = left[leftIdx++];
5245 // greater -> take right
5246 data[i++] = right[rightIdx++];
5249 while (leftIdx < left.length) {
5250 data[i++] = left[leftIdx++];
5252 while (rightIdx < right.length) {
5253 data[i++] = right[rightIdx++];
5257 })(TextDocument || (TextDocument = {}));
5259 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
5261 var FullTextDocument = /** @class */ (function () {
5262 function FullTextDocument(uri, languageId, version, content) {
5264 this._languageId = languageId;
5265 this._version = version;
5266 this._content = content;
5267 this._lineOffsets = undefined;
5269 Object.defineProperty(FullTextDocument.prototype, "uri", {
5276 Object.defineProperty(FullTextDocument.prototype, "languageId", {
5278 return this._languageId;
5283 Object.defineProperty(FullTextDocument.prototype, "version", {
5285 return this._version;
5290 FullTextDocument.prototype.getText = function (range) {
5292 var start = this.offsetAt(range.start);
5293 var end = this.offsetAt(range.end);
5294 return this._content.substring(start, end);
5296 return this._content;
5298 FullTextDocument.prototype.update = function (event, version) {
5299 this._content = event.text;
5300 this._version = version;
5301 this._lineOffsets = undefined;
5303 FullTextDocument.prototype.getLineOffsets = function () {
5304 if (this._lineOffsets === undefined) {
5305 var lineOffsets = [];
5306 var text = this._content;
5307 var isLineStart = true;
5308 for (var i = 0; i < text.length; i++) {
5310 lineOffsets.push(i);
5311 isLineStart = false;
5313 var ch = text.charAt(i);
5314 isLineStart = (ch === '\r' || ch === '\n');
5315 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
5319 if (isLineStart && text.length > 0) {
5320 lineOffsets.push(text.length);
5322 this._lineOffsets = lineOffsets;
5324 return this._lineOffsets;
5326 FullTextDocument.prototype.positionAt = function (offset) {
5327 offset = Math.max(Math.min(offset, this._content.length), 0);
5328 var lineOffsets = this.getLineOffsets();
5329 var low = 0, high = lineOffsets.length;
5331 return Position.create(0, offset);
5333 while (low < high) {
5334 var mid = Math.floor((low + high) / 2);
5335 if (lineOffsets[mid] > offset) {
5342 // low is the least x for which the line offset is larger than the current offset
5343 // or array.length if no line offset is larger than the current offset
5345 return Position.create(line, offset - lineOffsets[line]);
5347 FullTextDocument.prototype.offsetAt = function (position) {
5348 var lineOffsets = this.getLineOffsets();
5349 if (position.line >= lineOffsets.length) {
5350 return this._content.length;
5352 else if (position.line < 0) {
5355 var lineOffset = lineOffsets[position.line];
5356 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
5357 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
5359 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
5361 return this.getLineOffsets().length;
5366 return FullTextDocument;
5370 var toString = Object.prototype.toString;
5371 function defined(value) {
5372 return typeof value !== 'undefined';
5374 Is.defined = defined;
5375 function undefined(value) {
5376 return typeof value === 'undefined';
5378 Is.undefined = undefined;
5379 function boolean(value) {
5380 return value === true || value === false;
5382 Is.boolean = boolean;
5383 function string(value) {
5384 return toString.call(value) === '[object String]';
5387 function number(value) {
5388 return toString.call(value) === '[object Number]';
5391 function numberRange(value, min, max) {
5392 return toString.call(value) === '[object Number]' && min <= value && value <= max;
5394 Is.numberRange = numberRange;
5395 function integer(value) {
5396 return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
5398 Is.integer = integer;
5399 function uinteger(value) {
5400 return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
5402 Is.uinteger = uinteger;
5403 function func(value) {
5404 return toString.call(value) === '[object Function]';
5407 function objectLiteral(value) {
5408 // Strictly speaking class instances pass this check as well. Since the LSP
5409 // doesn't use classes we ignore this for now. If we do we need to add something
5410 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
5411 return value !== null && typeof value === 'object';
5413 Is.objectLiteral = objectLiteral;
5414 function typedArray(value, check) {
5415 return Array.isArray(value) && value.every(check);
5417 Is.typedArray = typedArray;
5418 })(Is || (Is = {}));
5423 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5426 /* --------------------------------------------------------------------------------------------
5427 * Copyright (c) Microsoft Corporation. All rights reserved.
5428 * Licensed under the MIT License. See License.txt in the project root for license information.
5429 * ------------------------------------------------------------------------------------------ */
5430 Object.defineProperty(exports, "__esModule", ({ value: true }));
5431 exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0;
5432 const vscode_jsonrpc_1 = __webpack_require__(6);
5433 class RegistrationType {
5434 constructor(method) {
5435 this.method = method;
5438 exports.RegistrationType = RegistrationType;
5439 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
5440 constructor(method) {
5444 exports.ProtocolRequestType0 = ProtocolRequestType0;
5445 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
5446 constructor(method) {
5447 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
5450 exports.ProtocolRequestType = ProtocolRequestType;
5451 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
5452 constructor(method) {
5456 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
5457 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
5458 constructor(method) {
5459 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
5462 exports.ProtocolNotificationType = ProtocolNotificationType;
5463 // let x: ProtocolNotificationType<number, { value: number}>;
5464 // let y: ProtocolNotificationType<string, { value: number}>;
5466 //# sourceMappingURL=messages.js.map
5470 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5473 /* --------------------------------------------------------------------------------------------
5474 * Copyright (c) Microsoft Corporation. All rights reserved.
5475 * Licensed under the MIT License. See License.txt in the project root for license information.
5476 * ------------------------------------------------------------------------------------------ */
5477 Object.defineProperty(exports, "__esModule", ({ value: true }));
5478 exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0;
5479 exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0;
5480 const Is = __webpack_require__(29);
5481 const messages_1 = __webpack_require__(27);
5482 const protocol_implementation_1 = __webpack_require__(30);
5483 Object.defineProperty(exports, "ImplementationRequest", ({ enumerable: true, get: function () { return protocol_implementation_1.ImplementationRequest; } }));
5484 const protocol_typeDefinition_1 = __webpack_require__(31);
5485 Object.defineProperty(exports, "TypeDefinitionRequest", ({ enumerable: true, get: function () { return protocol_typeDefinition_1.TypeDefinitionRequest; } }));
5486 const protocol_workspaceFolders_1 = __webpack_require__(32);
5487 Object.defineProperty(exports, "WorkspaceFoldersRequest", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.WorkspaceFoldersRequest; } }));
5488 Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; } }));
5489 const protocol_configuration_1 = __webpack_require__(33);
5490 Object.defineProperty(exports, "ConfigurationRequest", ({ enumerable: true, get: function () { return protocol_configuration_1.ConfigurationRequest; } }));
5491 const protocol_colorProvider_1 = __webpack_require__(34);
5492 Object.defineProperty(exports, "DocumentColorRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.DocumentColorRequest; } }));
5493 Object.defineProperty(exports, "ColorPresentationRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.ColorPresentationRequest; } }));
5494 const protocol_foldingRange_1 = __webpack_require__(35);
5495 Object.defineProperty(exports, "FoldingRangeRequest", ({ enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRequest; } }));
5496 const protocol_declaration_1 = __webpack_require__(36);
5497 Object.defineProperty(exports, "DeclarationRequest", ({ enumerable: true, get: function () { return protocol_declaration_1.DeclarationRequest; } }));
5498 const protocol_selectionRange_1 = __webpack_require__(37);
5499 Object.defineProperty(exports, "SelectionRangeRequest", ({ enumerable: true, get: function () { return protocol_selectionRange_1.SelectionRangeRequest; } }));
5500 const protocol_progress_1 = __webpack_require__(38);
5501 Object.defineProperty(exports, "WorkDoneProgress", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgress; } }));
5502 Object.defineProperty(exports, "WorkDoneProgressCreateRequest", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCreateRequest; } }));
5503 Object.defineProperty(exports, "WorkDoneProgressCancelNotification", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCancelNotification; } }));
5504 const protocol_callHierarchy_1 = __webpack_require__(39);
5505 Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } }));
5506 Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } }));
5507 Object.defineProperty(exports, "CallHierarchyPrepareRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } }));
5508 const protocol_semanticTokens_1 = __webpack_require__(40);
5509 Object.defineProperty(exports, "SemanticTokenTypes", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenTypes; } }));
5510 Object.defineProperty(exports, "SemanticTokenModifiers", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenModifiers; } }));
5511 Object.defineProperty(exports, "SemanticTokens", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokens; } }));
5512 Object.defineProperty(exports, "TokenFormat", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.TokenFormat; } }));
5513 Object.defineProperty(exports, "SemanticTokensRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRequest; } }));
5514 Object.defineProperty(exports, "SemanticTokensDeltaRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } }));
5515 Object.defineProperty(exports, "SemanticTokensRangeRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } }));
5516 Object.defineProperty(exports, "SemanticTokensRefreshRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } }));
5517 Object.defineProperty(exports, "SemanticTokensRegistrationType", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } }));
5518 const protocol_showDocument_1 = __webpack_require__(41);
5519 Object.defineProperty(exports, "ShowDocumentRequest", ({ enumerable: true, get: function () { return protocol_showDocument_1.ShowDocumentRequest; } }));
5520 const protocol_linkedEditingRange_1 = __webpack_require__(42);
5521 Object.defineProperty(exports, "LinkedEditingRangeRequest", ({ enumerable: true, get: function () { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } }));
5522 const protocol_fileOperations_1 = __webpack_require__(43);
5523 Object.defineProperty(exports, "FileOperationPatternKind", ({ enumerable: true, get: function () { return protocol_fileOperations_1.FileOperationPatternKind; } }));
5524 Object.defineProperty(exports, "DidCreateFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidCreateFilesNotification; } }));
5525 Object.defineProperty(exports, "WillCreateFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillCreateFilesRequest; } }));
5526 Object.defineProperty(exports, "DidRenameFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidRenameFilesNotification; } }));
5527 Object.defineProperty(exports, "WillRenameFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillRenameFilesRequest; } }));
5528 Object.defineProperty(exports, "DidDeleteFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidDeleteFilesNotification; } }));
5529 Object.defineProperty(exports, "WillDeleteFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillDeleteFilesRequest; } }));
5530 const protocol_moniker_1 = __webpack_require__(44);
5531 Object.defineProperty(exports, "UniquenessLevel", ({ enumerable: true, get: function () { return protocol_moniker_1.UniquenessLevel; } }));
5532 Object.defineProperty(exports, "MonikerKind", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerKind; } }));
5533 Object.defineProperty(exports, "MonikerRequest", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerRequest; } }));
5534 // @ts-ignore: to avoid inlining LocationLink as dynamic import
5535 let __noDynamicImport;
5537 * The DocumentFilter namespace provides helper functions to work with
5538 * [DocumentFilter](#DocumentFilter) literals.
5541 (function (DocumentFilter) {
5542 function is(value) {
5543 const candidate = value;
5544 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
5546 DocumentFilter.is = is;
5547 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
5549 * The DocumentSelector namespace provides helper functions to work with
5550 * [DocumentSelector](#DocumentSelector)s.
5552 var DocumentSelector;
5553 (function (DocumentSelector) {
5554 function is(value) {
5555 if (!Array.isArray(value)) {
5558 for (let elem of value) {
5559 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
5565 DocumentSelector.is = is;
5566 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
5568 * The `client/registerCapability` request is sent from the server to the client to register a new capability
5569 * handler on the client side.
5571 var RegistrationRequest;
5572 (function (RegistrationRequest) {
5573 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
5574 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
5576 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
5577 * handler on the client side.
5579 var UnregistrationRequest;
5580 (function (UnregistrationRequest) {
5581 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
5582 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
5583 var ResourceOperationKind;
5584 (function (ResourceOperationKind) {
5586 * Supports creating new files and folders.
5588 ResourceOperationKind.Create = 'create';
5590 * Supports renaming existing files and folders.
5592 ResourceOperationKind.Rename = 'rename';
5594 * Supports deleting existing files and folders.
5596 ResourceOperationKind.Delete = 'delete';
5597 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
5598 var FailureHandlingKind;
5599 (function (FailureHandlingKind) {
5601 * Applying the workspace change is simply aborted if one of the changes provided
5602 * fails. All operations executed before the failing operation stay executed.
5604 FailureHandlingKind.Abort = 'abort';
5606 * All operations are executed transactional. That means they either all
5607 * succeed or no changes at all are applied to the workspace.
5609 FailureHandlingKind.Transactional = 'transactional';
5611 * If the workspace edit contains only textual file changes they are executed transactional.
5612 * If resource changes (create, rename or delete file) are part of the change the failure
5613 * handling strategy is abort.
5615 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
5617 * The client tries to undo the operations already executed. But there is no
5618 * guarantee that this is succeeding.
5620 FailureHandlingKind.Undo = 'undo';
5621 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
5623 * The StaticRegistrationOptions namespace provides helper functions to work with
5624 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
5626 var StaticRegistrationOptions;
5627 (function (StaticRegistrationOptions) {
5628 function hasId(value) {
5629 const candidate = value;
5630 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
5632 StaticRegistrationOptions.hasId = hasId;
5633 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
5635 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
5636 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
5638 var TextDocumentRegistrationOptions;
5639 (function (TextDocumentRegistrationOptions) {
5640 function is(value) {
5641 const candidate = value;
5642 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
5644 TextDocumentRegistrationOptions.is = is;
5645 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
5647 * The WorkDoneProgressOptions namespace provides helper functions to work with
5648 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
5650 var WorkDoneProgressOptions;
5651 (function (WorkDoneProgressOptions) {
5652 function is(value) {
5653 const candidate = value;
5654 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
5656 WorkDoneProgressOptions.is = is;
5657 function hasWorkDoneProgress(value) {
5658 const candidate = value;
5659 return candidate && Is.boolean(candidate.workDoneProgress);
5661 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
5662 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
5664 * The initialize request is sent from the client to the server.
5665 * It is sent once as the request after starting up the server.
5666 * The requests parameter is of type [InitializeParams](#InitializeParams)
5667 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
5670 var InitializeRequest;
5671 (function (InitializeRequest) {
5672 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
5673 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
5675 * Known error codes for an `InitializeError`;
5677 var InitializeError;
5678 (function (InitializeError) {
5680 * If the protocol version provided by the client can't be handled by the server.
5681 * @deprecated This initialize error got replaced by client capabilities. There is
5682 * no version handshake in version 3.0x
5684 InitializeError.unknownProtocolVersion = 1;
5685 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
5687 * The initialized notification is sent from the client to the
5688 * server after the client is fully initialized and the server
5689 * is allowed to send requests from the server to the client.
5691 var InitializedNotification;
5692 (function (InitializedNotification) {
5693 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
5694 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
5695 //---- Shutdown Method ----
5697 * A shutdown request is sent from the client to the server.
5698 * It is sent once when the client decides to shutdown the
5699 * server. The only notification that is sent after a shutdown request
5700 * is the exit event.
5702 var ShutdownRequest;
5703 (function (ShutdownRequest) {
5704 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
5705 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
5706 //---- Exit Notification ----
5708 * The exit event is sent from the client to the server to
5709 * ask the server to exit its process.
5711 var ExitNotification;
5712 (function (ExitNotification) {
5713 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
5714 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
5716 * The configuration change notification is sent from the client to the server
5717 * when the client's configuration has changed. The notification contains
5718 * the changed configuration as defined by the language client.
5720 var DidChangeConfigurationNotification;
5721 (function (DidChangeConfigurationNotification) {
5722 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
5723 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
5724 //---- Message show and log notifications ----
5729 (function (MessageType) {
5733 MessageType.Error = 1;
5735 * A warning message.
5737 MessageType.Warning = 2;
5739 * An information message.
5741 MessageType.Info = 3;
5745 MessageType.Log = 4;
5746 })(MessageType = exports.MessageType || (exports.MessageType = {}));
5748 * The show message notification is sent from a server to a client to ask
5749 * the client to display a particular message in the user interface.
5751 var ShowMessageNotification;
5752 (function (ShowMessageNotification) {
5753 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
5754 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
5756 * The show message request is sent from the server to the client to show a message
5757 * and a set of options actions to the user.
5759 var ShowMessageRequest;
5760 (function (ShowMessageRequest) {
5761 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
5762 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
5764 * The log message notification is sent from the server to the client to ask
5765 * the client to log a particular message.
5767 var LogMessageNotification;
5768 (function (LogMessageNotification) {
5769 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
5770 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
5771 //---- Telemetry notification
5773 * The telemetry event notification is sent from the server to the client to ask
5774 * the client to log telemetry data.
5776 var TelemetryEventNotification;
5777 (function (TelemetryEventNotification) {
5778 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
5779 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
5781 * Defines how the host (editor) should sync
5782 * document changes to the language server.
5784 var TextDocumentSyncKind;
5785 (function (TextDocumentSyncKind) {
5787 * Documents should not be synced at all.
5789 TextDocumentSyncKind.None = 0;
5791 * Documents are synced by always sending the full content
5794 TextDocumentSyncKind.Full = 1;
5796 * Documents are synced by sending the full content on open.
5797 * After that only incremental updates to the document are
5800 TextDocumentSyncKind.Incremental = 2;
5801 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
5803 * The document open notification is sent from the client to the server to signal
5804 * newly opened text documents. The document's truth is now managed by the client
5805 * and the server must not try to read the document's truth using the document's
5806 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
5807 * mean that its content is presented in an editor. An open notification must not
5808 * be sent more than once without a corresponding close notification send before.
5809 * This means open and close notification must be balanced and the max open count
5812 var DidOpenTextDocumentNotification;
5813 (function (DidOpenTextDocumentNotification) {
5814 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
5815 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
5816 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
5817 var TextDocumentContentChangeEvent;
5818 (function (TextDocumentContentChangeEvent) {
5820 * Checks whether the information describes a delta event.
5822 function isIncremental(event) {
5823 let candidate = event;
5824 return candidate !== undefined && candidate !== null &&
5825 typeof candidate.text === 'string' && candidate.range !== undefined &&
5826 (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
5828 TextDocumentContentChangeEvent.isIncremental = isIncremental;
5830 * Checks whether the information describes a full replacement event.
5832 function isFull(event) {
5833 let candidate = event;
5834 return candidate !== undefined && candidate !== null &&
5835 typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
5837 TextDocumentContentChangeEvent.isFull = isFull;
5838 })(TextDocumentContentChangeEvent = exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {}));
5840 * The document change notification is sent from the client to the server to signal
5841 * changes to a text document.
5843 var DidChangeTextDocumentNotification;
5844 (function (DidChangeTextDocumentNotification) {
5845 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
5846 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
5847 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
5849 * The document close notification is sent from the client to the server when
5850 * the document got closed in the client. The document's truth now exists where
5851 * the document's uri points to (e.g. if the document's uri is a file uri the
5852 * truth now exists on disk). As with the open notification the close notification
5853 * is about managing the document's content. Receiving a close notification
5854 * doesn't mean that the document was open in an editor before. A close
5855 * notification requires a previous open notification to be sent.
5857 var DidCloseTextDocumentNotification;
5858 (function (DidCloseTextDocumentNotification) {
5859 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
5860 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
5861 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
5863 * The document save notification is sent from the client to the server when
5864 * the document got saved in the client.
5866 var DidSaveTextDocumentNotification;
5867 (function (DidSaveTextDocumentNotification) {
5868 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
5869 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
5870 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
5872 * Represents reasons why a text document is saved.
5874 var TextDocumentSaveReason;
5875 (function (TextDocumentSaveReason) {
5877 * Manually triggered, e.g. by the user pressing save, by starting debugging,
5878 * or by an API call.
5880 TextDocumentSaveReason.Manual = 1;
5882 * Automatic after a delay.
5884 TextDocumentSaveReason.AfterDelay = 2;
5886 * When the editor lost focus.
5888 TextDocumentSaveReason.FocusOut = 3;
5889 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
5891 * A document will save notification is sent from the client to the server before
5892 * the document is actually saved.
5894 var WillSaveTextDocumentNotification;
5895 (function (WillSaveTextDocumentNotification) {
5896 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
5897 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
5898 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
5900 * A document will save request is sent from the client to the server before
5901 * the document is actually saved. The request can return an array of TextEdits
5902 * which will be applied to the text document before it is saved. Please note that
5903 * clients might drop results if computing the text edits took too long or if a
5904 * server constantly fails on this request. This is done to keep the save fast and
5907 var WillSaveTextDocumentWaitUntilRequest;
5908 (function (WillSaveTextDocumentWaitUntilRequest) {
5909 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
5910 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
5911 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
5913 * The watched files notification is sent from the client to the server when
5914 * the client detects changes to file watched by the language client.
5916 var DidChangeWatchedFilesNotification;
5917 (function (DidChangeWatchedFilesNotification) {
5918 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
5919 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
5921 * The file event type
5924 (function (FileChangeType) {
5926 * The file got created.
5928 FileChangeType.Created = 1;
5930 * The file got changed.
5932 FileChangeType.Changed = 2;
5934 * The file got deleted.
5936 FileChangeType.Deleted = 3;
5937 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
5939 (function (WatchKind) {
5941 * Interested in create events.
5943 WatchKind.Create = 1;
5945 * Interested in change events
5947 WatchKind.Change = 2;
5949 * Interested in delete events
5951 WatchKind.Delete = 4;
5952 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
5954 * Diagnostics notification are sent from the server to the client to signal
5955 * results of validation runs.
5957 var PublishDiagnosticsNotification;
5958 (function (PublishDiagnosticsNotification) {
5959 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
5960 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
5962 * How a completion was triggered
5964 var CompletionTriggerKind;
5965 (function (CompletionTriggerKind) {
5967 * Completion was triggered by typing an identifier (24x7 code
5968 * complete), manual invocation (e.g Ctrl+Space) or via API.
5970 CompletionTriggerKind.Invoked = 1;
5972 * Completion was triggered by a trigger character specified by
5973 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
5975 CompletionTriggerKind.TriggerCharacter = 2;
5977 * Completion was re-triggered as current completion list is incomplete
5979 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
5980 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
5982 * Request to request completion at a given text document position. The request's
5983 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
5984 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
5985 * or a Thenable that resolves to such.
5987 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
5988 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
5989 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
5990 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
5992 var CompletionRequest;
5993 (function (CompletionRequest) {
5994 CompletionRequest.method = 'textDocument/completion';
5995 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
5996 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
5998 * Request to resolve additional information for a given completion item.The request's
5999 * parameter is of type [CompletionItem](#CompletionItem) the response
6000 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
6002 var CompletionResolveRequest;
6003 (function (CompletionResolveRequest) {
6004 CompletionResolveRequest.method = 'completionItem/resolve';
6005 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
6006 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
6008 * Request to request hover information at a given text document position. The request's
6009 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
6010 * type [Hover](#Hover) or a Thenable that resolves to such.
6013 (function (HoverRequest) {
6014 HoverRequest.method = 'textDocument/hover';
6015 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
6016 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
6018 * How a signature help was triggered.
6022 var SignatureHelpTriggerKind;
6023 (function (SignatureHelpTriggerKind) {
6025 * Signature help was invoked manually by the user or by a command.
6027 SignatureHelpTriggerKind.Invoked = 1;
6029 * Signature help was triggered by a trigger character.
6031 SignatureHelpTriggerKind.TriggerCharacter = 2;
6033 * Signature help was triggered by the cursor moving or by the document content changing.
6035 SignatureHelpTriggerKind.ContentChange = 3;
6036 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
6037 var SignatureHelpRequest;
6038 (function (SignatureHelpRequest) {
6039 SignatureHelpRequest.method = 'textDocument/signatureHelp';
6040 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
6041 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
6043 * A request to resolve the definition location of a symbol at a given text
6044 * document position. The request's parameter is of type [TextDocumentPosition]
6045 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
6046 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
6049 var DefinitionRequest;
6050 (function (DefinitionRequest) {
6051 DefinitionRequest.method = 'textDocument/definition';
6052 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
6053 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
6055 * A request to resolve project-wide references for the symbol denoted
6056 * by the given text document position. The request's parameter is of
6057 * type [ReferenceParams](#ReferenceParams) the response is of type
6058 * [Location[]](#Location) or a Thenable that resolves to such.
6060 var ReferencesRequest;
6061 (function (ReferencesRequest) {
6062 ReferencesRequest.method = 'textDocument/references';
6063 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
6064 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
6066 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
6067 * text document position. The request's parameter is of type [TextDocumentPosition]
6068 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
6069 * (#DocumentHighlight) or a Thenable that resolves to such.
6071 var DocumentHighlightRequest;
6072 (function (DocumentHighlightRequest) {
6073 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
6074 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
6075 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
6077 * A request to list all symbols found in a given text document. The request's
6078 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
6079 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
6080 * that resolves to such.
6082 var DocumentSymbolRequest;
6083 (function (DocumentSymbolRequest) {
6084 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
6085 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
6086 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
6088 * A request to provide commands for the given text document and range.
6090 var CodeActionRequest;
6091 (function (CodeActionRequest) {
6092 CodeActionRequest.method = 'textDocument/codeAction';
6093 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
6094 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
6096 * Request to resolve additional information for a given code action.The request's
6097 * parameter is of type [CodeAction](#CodeAction) the response
6098 * is of type [CodeAction](#CodeAction) or a Thenable that resolves to such.
6100 var CodeActionResolveRequest;
6101 (function (CodeActionResolveRequest) {
6102 CodeActionResolveRequest.method = 'codeAction/resolve';
6103 CodeActionResolveRequest.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest.method);
6104 })(CodeActionResolveRequest = exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {}));
6106 * A request to list project-wide symbols matching the query string given
6107 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
6108 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
6111 var WorkspaceSymbolRequest;
6112 (function (WorkspaceSymbolRequest) {
6113 WorkspaceSymbolRequest.method = 'workspace/symbol';
6114 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
6115 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
6117 * A request to provide code lens for the given text document.
6119 var CodeLensRequest;
6120 (function (CodeLensRequest) {
6121 CodeLensRequest.method = 'textDocument/codeLens';
6122 CodeLensRequest.type = new messages_1.ProtocolRequestType(CodeLensRequest.method);
6123 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
6125 * A request to resolve a command for a given code lens.
6127 var CodeLensResolveRequest;
6128 (function (CodeLensResolveRequest) {
6129 CodeLensResolveRequest.method = 'codeLens/resolve';
6130 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest.method);
6131 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
6133 * A request to refresh all code actions
6137 var CodeLensRefreshRequest;
6138 (function (CodeLensRefreshRequest) {
6139 CodeLensRefreshRequest.method = `workspace/codeLens/refresh`;
6140 CodeLensRefreshRequest.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest.method);
6141 })(CodeLensRefreshRequest = exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {}));
6143 * A request to provide document links
6145 var DocumentLinkRequest;
6146 (function (DocumentLinkRequest) {
6147 DocumentLinkRequest.method = 'textDocument/documentLink';
6148 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
6149 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
6151 * Request to resolve additional information for a given document link. The request's
6152 * parameter is of type [DocumentLink](#DocumentLink) the response
6153 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
6155 var DocumentLinkResolveRequest;
6156 (function (DocumentLinkResolveRequest) {
6157 DocumentLinkResolveRequest.method = 'documentLink/resolve';
6158 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest.method);
6159 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
6161 * A request to to format a whole document.
6163 var DocumentFormattingRequest;
6164 (function (DocumentFormattingRequest) {
6165 DocumentFormattingRequest.method = 'textDocument/formatting';
6166 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
6167 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
6169 * A request to to format a range in a document.
6171 var DocumentRangeFormattingRequest;
6172 (function (DocumentRangeFormattingRequest) {
6173 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
6174 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
6175 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
6177 * A request to format a document on type.
6179 var DocumentOnTypeFormattingRequest;
6180 (function (DocumentOnTypeFormattingRequest) {
6181 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
6182 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
6183 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
6184 //---- Rename ----------------------------------------------
6185 var PrepareSupportDefaultBehavior;
6186 (function (PrepareSupportDefaultBehavior) {
6188 * The client's default behavior is to select the identifier
6189 * according the to language's syntax rule.
6191 PrepareSupportDefaultBehavior.Identifier = 1;
6192 })(PrepareSupportDefaultBehavior = exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {}));
6194 * A request to rename a symbol.
6197 (function (RenameRequest) {
6198 RenameRequest.method = 'textDocument/rename';
6199 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
6200 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
6202 * A request to test and perform the setup necessary for a rename.
6204 * @since 3.16 - support for default behavior
6206 var PrepareRenameRequest;
6207 (function (PrepareRenameRequest) {
6208 PrepareRenameRequest.method = 'textDocument/prepareRename';
6209 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
6210 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
6212 * A request send from the client to the server to execute a command. The request might return
6213 * a workspace edit which the client will apply to the workspace.
6215 var ExecuteCommandRequest;
6216 (function (ExecuteCommandRequest) {
6217 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
6218 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
6220 * A request sent from the server to the client to modified certain resources.
6222 var ApplyWorkspaceEditRequest;
6223 (function (ApplyWorkspaceEditRequest) {
6224 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
6225 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
6226 //# sourceMappingURL=protocol.js.map
6230 /***/ ((__unused_webpack_module, exports) => {
6232 /* --------------------------------------------------------------------------------------------
6233 * Copyright (c) Microsoft Corporation. All rights reserved.
6234 * Licensed under the MIT License. See License.txt in the project root for license information.
6235 * ------------------------------------------------------------------------------------------ */
6237 Object.defineProperty(exports, "__esModule", ({ value: true }));
6238 exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
6239 function boolean(value) {
6240 return value === true || value === false;
6242 exports.boolean = boolean;
6243 function string(value) {
6244 return typeof value === 'string' || value instanceof String;
6246 exports.string = string;
6247 function number(value) {
6248 return typeof value === 'number' || value instanceof Number;
6250 exports.number = number;
6251 function error(value) {
6252 return value instanceof Error;
6254 exports.error = error;
6255 function func(value) {
6256 return typeof value === 'function';
6258 exports.func = func;
6259 function array(value) {
6260 return Array.isArray(value);
6262 exports.array = array;
6263 function stringArray(value) {
6264 return array(value) && value.every(elem => string(elem));
6266 exports.stringArray = stringArray;
6267 function typedArray(value, check) {
6268 return Array.isArray(value) && value.every(check);
6270 exports.typedArray = typedArray;
6271 function objectLiteral(value) {
6272 // Strictly speaking class instances pass this check as well. Since the LSP
6273 // doesn't use classes we ignore this for now. If we do we need to add something
6274 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
6275 return value !== null && typeof value === 'object';
6277 exports.objectLiteral = objectLiteral;
6278 //# sourceMappingURL=is.js.map
6282 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6285 /* --------------------------------------------------------------------------------------------
6286 * Copyright (c) Microsoft Corporation. All rights reserved.
6287 * Licensed under the MIT License. See License.txt in the project root for license information.
6288 * ------------------------------------------------------------------------------------------ */
6289 Object.defineProperty(exports, "__esModule", ({ value: true }));
6290 exports.ImplementationRequest = void 0;
6291 const messages_1 = __webpack_require__(27);
6292 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
6293 let __noDynamicImport;
6295 * A request to resolve the implementation locations of a symbol at a given text
6296 * document position. The request's parameter is of type [TextDocumentPositioParams]
6297 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
6298 * Thenable that resolves to such.
6300 var ImplementationRequest;
6301 (function (ImplementationRequest) {
6302 ImplementationRequest.method = 'textDocument/implementation';
6303 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
6304 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
6305 //# sourceMappingURL=protocol.implementation.js.map
6309 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6312 /* --------------------------------------------------------------------------------------------
6313 * Copyright (c) Microsoft Corporation. All rights reserved.
6314 * Licensed under the MIT License. See License.txt in the project root for license information.
6315 * ------------------------------------------------------------------------------------------ */
6316 Object.defineProperty(exports, "__esModule", ({ value: true }));
6317 exports.TypeDefinitionRequest = void 0;
6318 const messages_1 = __webpack_require__(27);
6319 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
6320 let __noDynamicImport;
6322 * A request to resolve the type definition locations of a symbol at a given text
6323 * document position. The request's parameter is of type [TextDocumentPositioParams]
6324 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
6325 * Thenable that resolves to such.
6327 var TypeDefinitionRequest;
6328 (function (TypeDefinitionRequest) {
6329 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
6330 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
6331 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
6332 //# sourceMappingURL=protocol.typeDefinition.js.map
6336 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6339 /* --------------------------------------------------------------------------------------------
6340 * Copyright (c) Microsoft Corporation. All rights reserved.
6341 * Licensed under the MIT License. See License.txt in the project root for license information.
6342 * ------------------------------------------------------------------------------------------ */
6343 Object.defineProperty(exports, "__esModule", ({ value: true }));
6344 exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0;
6345 const messages_1 = __webpack_require__(27);
6347 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
6349 var WorkspaceFoldersRequest;
6350 (function (WorkspaceFoldersRequest) {
6351 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
6352 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
6354 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
6355 * folder configuration changes.
6357 var DidChangeWorkspaceFoldersNotification;
6358 (function (DidChangeWorkspaceFoldersNotification) {
6359 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
6360 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
6361 //# sourceMappingURL=protocol.workspaceFolders.js.map
6365 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6368 /* --------------------------------------------------------------------------------------------
6369 * Copyright (c) Microsoft Corporation. All rights reserved.
6370 * Licensed under the MIT License. See License.txt in the project root for license information.
6371 * ------------------------------------------------------------------------------------------ */
6372 Object.defineProperty(exports, "__esModule", ({ value: true }));
6373 exports.ConfigurationRequest = void 0;
6374 const messages_1 = __webpack_require__(27);
6376 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
6377 * configuration setting.
6379 * This pull model replaces the old push model were the client signaled configuration change via an
6380 * event. If the server still needs to react to configuration changes (since the server caches the
6381 * result of `workspace/configuration` requests) the server should register for an empty configuration
6382 * change event and empty the cache if such an event is received.
6384 var ConfigurationRequest;
6385 (function (ConfigurationRequest) {
6386 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
6387 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
6388 //# sourceMappingURL=protocol.configuration.js.map
6392 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6395 /* --------------------------------------------------------------------------------------------
6396 * Copyright (c) Microsoft Corporation. All rights reserved.
6397 * Licensed under the MIT License. See License.txt in the project root for license information.
6398 * ------------------------------------------------------------------------------------------ */
6399 Object.defineProperty(exports, "__esModule", ({ value: true }));
6400 exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0;
6401 const messages_1 = __webpack_require__(27);
6403 * A request to list all color symbols found in a given text document. The request's
6404 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
6405 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
6406 * that resolves to such.
6408 var DocumentColorRequest;
6409 (function (DocumentColorRequest) {
6410 DocumentColorRequest.method = 'textDocument/documentColor';
6411 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
6412 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
6414 * A request to list all presentation for a color. The request's
6415 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
6416 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
6417 * that resolves to such.
6419 var ColorPresentationRequest;
6420 (function (ColorPresentationRequest) {
6421 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
6422 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
6423 //# sourceMappingURL=protocol.colorProvider.js.map
6427 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6430 /*---------------------------------------------------------------------------------------------
6431 * Copyright (c) Microsoft Corporation. All rights reserved.
6432 * Licensed under the MIT License. See License.txt in the project root for license information.
6433 *--------------------------------------------------------------------------------------------*/
6434 Object.defineProperty(exports, "__esModule", ({ value: true }));
6435 exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0;
6436 const messages_1 = __webpack_require__(27);
6438 * Enum of known range kinds
6440 var FoldingRangeKind;
6441 (function (FoldingRangeKind) {
6443 * Folding range for a comment
6445 FoldingRangeKind["Comment"] = "comment";
6447 * Folding range for a imports or includes
6449 FoldingRangeKind["Imports"] = "imports";
6451 * Folding range for a region (e.g. `#region`)
6453 FoldingRangeKind["Region"] = "region";
6454 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
6456 * A request to provide folding ranges in a document. The request's
6457 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
6458 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
6459 * that resolves to such.
6461 var FoldingRangeRequest;
6462 (function (FoldingRangeRequest) {
6463 FoldingRangeRequest.method = 'textDocument/foldingRange';
6464 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
6465 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
6466 //# sourceMappingURL=protocol.foldingRange.js.map
6470 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6473 /* --------------------------------------------------------------------------------------------
6474 * Copyright (c) Microsoft Corporation. All rights reserved.
6475 * Licensed under the MIT License. See License.txt in the project root for license information.
6476 * ------------------------------------------------------------------------------------------ */
6477 Object.defineProperty(exports, "__esModule", ({ value: true }));
6478 exports.DeclarationRequest = void 0;
6479 const messages_1 = __webpack_require__(27);
6480 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
6481 let __noDynamicImport;
6483 * A request to resolve the type definition locations of a symbol at a given text
6484 * document position. The request's parameter is of type [TextDocumentPositioParams]
6485 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
6486 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
6489 var DeclarationRequest;
6490 (function (DeclarationRequest) {
6491 DeclarationRequest.method = 'textDocument/declaration';
6492 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
6493 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
6494 //# sourceMappingURL=protocol.declaration.js.map
6498 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6501 /*---------------------------------------------------------------------------------------------
6502 * Copyright (c) Microsoft Corporation. All rights reserved.
6503 * Licensed under the MIT License. See License.txt in the project root for license information.
6504 *--------------------------------------------------------------------------------------------*/
6505 Object.defineProperty(exports, "__esModule", ({ value: true }));
6506 exports.SelectionRangeRequest = void 0;
6507 const messages_1 = __webpack_require__(27);
6509 * A request to provide selection ranges in a document. The request's
6510 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
6511 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
6512 * that resolves to such.
6514 var SelectionRangeRequest;
6515 (function (SelectionRangeRequest) {
6516 SelectionRangeRequest.method = 'textDocument/selectionRange';
6517 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
6518 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
6519 //# sourceMappingURL=protocol.selectionRange.js.map
6523 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6526 /* --------------------------------------------------------------------------------------------
6527 * Copyright (c) Microsoft Corporation. All rights reserved.
6528 * Licensed under the MIT License. See License.txt in the project root for license information.
6529 * ------------------------------------------------------------------------------------------ */
6530 Object.defineProperty(exports, "__esModule", ({ value: true }));
6531 exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0;
6532 const vscode_jsonrpc_1 = __webpack_require__(6);
6533 const messages_1 = __webpack_require__(27);
6534 var WorkDoneProgress;
6535 (function (WorkDoneProgress) {
6536 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
6537 function is(value) {
6538 return value === WorkDoneProgress.type;
6540 WorkDoneProgress.is = is;
6541 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
6543 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
6544 * reporting from the server.
6546 var WorkDoneProgressCreateRequest;
6547 (function (WorkDoneProgressCreateRequest) {
6548 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
6549 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
6551 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
6552 * initiated on the server side.
6554 var WorkDoneProgressCancelNotification;
6555 (function (WorkDoneProgressCancelNotification) {
6556 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
6557 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
6558 //# sourceMappingURL=protocol.progress.js.map
6562 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6565 /* --------------------------------------------------------------------------------------------
6566 * Copyright (c) TypeFox and others. All rights reserved.
6567 * Licensed under the MIT License. See License.txt in the project root for license information.
6568 * ------------------------------------------------------------------------------------------ */
6569 Object.defineProperty(exports, "__esModule", ({ value: true }));
6570 exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0;
6571 const messages_1 = __webpack_require__(27);
6573 * A request to result a `CallHierarchyItem` in a document at a given position.
6574 * Can be used as an input to a incoming or outgoing call hierarchy.
6578 var CallHierarchyPrepareRequest;
6579 (function (CallHierarchyPrepareRequest) {
6580 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
6581 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
6582 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
6584 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
6588 var CallHierarchyIncomingCallsRequest;
6589 (function (CallHierarchyIncomingCallsRequest) {
6590 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
6591 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
6592 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
6594 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
6598 var CallHierarchyOutgoingCallsRequest;
6599 (function (CallHierarchyOutgoingCallsRequest) {
6600 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
6601 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
6602 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
6603 //# sourceMappingURL=protocol.callHierarchy.js.map
6607 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6610 /* --------------------------------------------------------------------------------------------
6611 * Copyright (c) Microsoft Corporation. All rights reserved.
6612 * Licensed under the MIT License. See License.txt in the project root for license information.
6613 * ------------------------------------------------------------------------------------------ */
6614 Object.defineProperty(exports, "__esModule", ({ value: true }));
6615 exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = void 0;
6616 const messages_1 = __webpack_require__(27);
6618 * A set of predefined token types. This set is not fixed
6619 * an clients can specify additional token types via the
6620 * corresponding client capabilities.
6624 var SemanticTokenTypes;
6625 (function (SemanticTokenTypes) {
6626 SemanticTokenTypes["namespace"] = "namespace";
6628 * Represents a generic type. Acts as a fallback for types which can't be mapped to
6629 * a specific type like class or enum.
6631 SemanticTokenTypes["type"] = "type";
6632 SemanticTokenTypes["class"] = "class";
6633 SemanticTokenTypes["enum"] = "enum";
6634 SemanticTokenTypes["interface"] = "interface";
6635 SemanticTokenTypes["struct"] = "struct";
6636 SemanticTokenTypes["typeParameter"] = "typeParameter";
6637 SemanticTokenTypes["parameter"] = "parameter";
6638 SemanticTokenTypes["variable"] = "variable";
6639 SemanticTokenTypes["property"] = "property";
6640 SemanticTokenTypes["enumMember"] = "enumMember";
6641 SemanticTokenTypes["event"] = "event";
6642 SemanticTokenTypes["function"] = "function";
6643 SemanticTokenTypes["method"] = "method";
6644 SemanticTokenTypes["macro"] = "macro";
6645 SemanticTokenTypes["keyword"] = "keyword";
6646 SemanticTokenTypes["modifier"] = "modifier";
6647 SemanticTokenTypes["comment"] = "comment";
6648 SemanticTokenTypes["string"] = "string";
6649 SemanticTokenTypes["number"] = "number";
6650 SemanticTokenTypes["regexp"] = "regexp";
6651 SemanticTokenTypes["operator"] = "operator";
6652 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
6654 * A set of predefined token modifiers. This set is not fixed
6655 * an clients can specify additional token types via the
6656 * corresponding client capabilities.
6660 var SemanticTokenModifiers;
6661 (function (SemanticTokenModifiers) {
6662 SemanticTokenModifiers["declaration"] = "declaration";
6663 SemanticTokenModifiers["definition"] = "definition";
6664 SemanticTokenModifiers["readonly"] = "readonly";
6665 SemanticTokenModifiers["static"] = "static";
6666 SemanticTokenModifiers["deprecated"] = "deprecated";
6667 SemanticTokenModifiers["abstract"] = "abstract";
6668 SemanticTokenModifiers["async"] = "async";
6669 SemanticTokenModifiers["modification"] = "modification";
6670 SemanticTokenModifiers["documentation"] = "documentation";
6671 SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
6672 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
6677 (function (SemanticTokens) {
6678 function is(value) {
6679 const candidate = value;
6680 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
6681 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
6683 SemanticTokens.is = is;
6684 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
6685 //------- 'textDocument/semanticTokens' -----
6687 (function (TokenFormat) {
6688 TokenFormat.Relative = 'relative';
6689 })(TokenFormat = exports.TokenFormat || (exports.TokenFormat = {}));
6690 var SemanticTokensRegistrationType;
6691 (function (SemanticTokensRegistrationType) {
6692 SemanticTokensRegistrationType.method = 'textDocument/semanticTokens';
6693 SemanticTokensRegistrationType.type = new messages_1.RegistrationType(SemanticTokensRegistrationType.method);
6694 })(SemanticTokensRegistrationType = exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {}));
6698 var SemanticTokensRequest;
6699 (function (SemanticTokensRequest) {
6700 SemanticTokensRequest.method = 'textDocument/semanticTokens/full';
6701 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
6702 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
6706 var SemanticTokensDeltaRequest;
6707 (function (SemanticTokensDeltaRequest) {
6708 SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta';
6709 SemanticTokensDeltaRequest.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest.method);
6710 })(SemanticTokensDeltaRequest = exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {}));
6714 var SemanticTokensRangeRequest;
6715 (function (SemanticTokensRangeRequest) {
6716 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
6717 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
6718 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
6722 var SemanticTokensRefreshRequest;
6723 (function (SemanticTokensRefreshRequest) {
6724 SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`;
6725 SemanticTokensRefreshRequest.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest.method);
6726 })(SemanticTokensRefreshRequest = exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {}));
6727 //# sourceMappingURL=protocol.semanticTokens.js.map
6731 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6734 /* --------------------------------------------------------------------------------------------
6735 * Copyright (c) Microsoft Corporation. All rights reserved.
6736 * Licensed under the MIT License. See License.txt in the project root for license information.
6737 * ------------------------------------------------------------------------------------------ */
6738 Object.defineProperty(exports, "__esModule", ({ value: true }));
6739 exports.ShowDocumentRequest = void 0;
6740 const messages_1 = __webpack_require__(27);
6742 * A request to show a document. This request might open an
6743 * external program depending on the value of the URI to open.
6744 * For example a request to open `https://code.visualstudio.com/`
6745 * will very likely open the URI in a WEB browser.
6749 var ShowDocumentRequest;
6750 (function (ShowDocumentRequest) {
6751 ShowDocumentRequest.method = 'window/showDocument';
6752 ShowDocumentRequest.type = new messages_1.ProtocolRequestType(ShowDocumentRequest.method);
6753 })(ShowDocumentRequest = exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {}));
6754 //# sourceMappingURL=protocol.showDocument.js.map
6758 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6761 /*---------------------------------------------------------------------------------------------
6762 * Copyright (c) Microsoft Corporation. All rights reserved.
6763 * Licensed under the MIT License. See License.txt in the project root for license information.
6764 *--------------------------------------------------------------------------------------------*/
6765 Object.defineProperty(exports, "__esModule", ({ value: true }));
6766 exports.LinkedEditingRangeRequest = void 0;
6767 const messages_1 = __webpack_require__(27);
6769 * A request to provide ranges that can be edited together.
6773 var LinkedEditingRangeRequest;
6774 (function (LinkedEditingRangeRequest) {
6775 LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange';
6776 LinkedEditingRangeRequest.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest.method);
6777 })(LinkedEditingRangeRequest = exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {}));
6778 //# sourceMappingURL=protocol.linkedEditingRange.js.map
6782 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6785 /* --------------------------------------------------------------------------------------------
6786 * Copyright (c) Microsoft Corporation. All rights reserved.
6787 * Licensed under the MIT License. See License.txt in the project root for license information.
6788 * ------------------------------------------------------------------------------------------ */
6789 Object.defineProperty(exports, "__esModule", ({ value: true }));
6790 exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0;
6791 const messages_1 = __webpack_require__(27);
6793 * A pattern kind describing if a glob pattern matches a file a folder or
6798 var FileOperationPatternKind;
6799 (function (FileOperationPatternKind) {
6801 * The pattern matches a file only.
6803 FileOperationPatternKind.file = 'file';
6805 * The pattern matches a folder only.
6807 FileOperationPatternKind.folder = 'folder';
6808 })(FileOperationPatternKind = exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {}));
6810 * The will create files request is sent from the client to the server before files are actually
6811 * created as long as the creation is triggered from within the client.
6815 var WillCreateFilesRequest;
6816 (function (WillCreateFilesRequest) {
6817 WillCreateFilesRequest.method = 'workspace/willCreateFiles';
6818 WillCreateFilesRequest.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest.method);
6819 })(WillCreateFilesRequest = exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {}));
6821 * The did create files notification is sent from the client to the server when
6822 * files were created from within the client.
6826 var DidCreateFilesNotification;
6827 (function (DidCreateFilesNotification) {
6828 DidCreateFilesNotification.method = 'workspace/didCreateFiles';
6829 DidCreateFilesNotification.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification.method);
6830 })(DidCreateFilesNotification = exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {}));
6832 * The will rename files request is sent from the client to the server before files are actually
6833 * renamed as long as the rename is triggered from within the client.
6837 var WillRenameFilesRequest;
6838 (function (WillRenameFilesRequest) {
6839 WillRenameFilesRequest.method = 'workspace/willRenameFiles';
6840 WillRenameFilesRequest.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest.method);
6841 })(WillRenameFilesRequest = exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {}));
6843 * The did rename files notification is sent from the client to the server when
6844 * files were renamed from within the client.
6848 var DidRenameFilesNotification;
6849 (function (DidRenameFilesNotification) {
6850 DidRenameFilesNotification.method = 'workspace/didRenameFiles';
6851 DidRenameFilesNotification.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification.method);
6852 })(DidRenameFilesNotification = exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {}));
6854 * The will delete files request is sent from the client to the server before files are actually
6855 * deleted as long as the deletion is triggered from within the client.
6859 var DidDeleteFilesNotification;
6860 (function (DidDeleteFilesNotification) {
6861 DidDeleteFilesNotification.method = 'workspace/didDeleteFiles';
6862 DidDeleteFilesNotification.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification.method);
6863 })(DidDeleteFilesNotification = exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {}));
6865 * The did delete files notification is sent from the client to the server when
6866 * files were deleted from within the client.
6870 var WillDeleteFilesRequest;
6871 (function (WillDeleteFilesRequest) {
6872 WillDeleteFilesRequest.method = 'workspace/willDeleteFiles';
6873 WillDeleteFilesRequest.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest.method);
6874 })(WillDeleteFilesRequest = exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {}));
6875 //# sourceMappingURL=protocol.fileOperations.js.map
6879 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6882 /* --------------------------------------------------------------------------------------------
6883 * Copyright (c) Microsoft Corporation. All rights reserved.
6884 * Licensed under the MIT License. See License.txt in the project root for license information.
6885 * ------------------------------------------------------------------------------------------ */
6886 Object.defineProperty(exports, "__esModule", ({ value: true }));
6887 exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0;
6888 const messages_1 = __webpack_require__(27);
6890 * Moniker uniqueness level to define scope of the moniker.
6894 var UniquenessLevel;
6895 (function (UniquenessLevel) {
6897 * The moniker is only unique inside a document
6899 UniquenessLevel["document"] = "document";
6901 * The moniker is unique inside a project for which a dump got created
6903 UniquenessLevel["project"] = "project";
6905 * The moniker is unique inside the group to which a project belongs
6907 UniquenessLevel["group"] = "group";
6909 * The moniker is unique inside the moniker scheme.
6911 UniquenessLevel["scheme"] = "scheme";
6913 * The moniker is globally unique
6915 UniquenessLevel["global"] = "global";
6916 })(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {}));
6923 (function (MonikerKind) {
6925 * The moniker represent a symbol that is imported into a project
6927 MonikerKind["import"] = "import";
6929 * The moniker represents a symbol that is exported from a project
6931 MonikerKind["export"] = "export";
6933 * The moniker represents a symbol that is local to a project (e.g. a local
6934 * variable of a function, a class not visible outside the project, ...)
6936 MonikerKind["local"] = "local";
6937 })(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {}));
6939 * A request to get the moniker of a symbol at a given text document position.
6940 * The request parameter is of type [TextDocumentPositionParams](#TextDocumentPositionParams).
6941 * The response is of type [Moniker[]](#Moniker[]) or `null`.
6944 (function (MonikerRequest) {
6945 MonikerRequest.method = 'textDocument/moniker';
6946 MonikerRequest.type = new messages_1.ProtocolRequestType(MonikerRequest.method);
6947 })(MonikerRequest = exports.MonikerRequest || (exports.MonikerRequest = {}));
6948 //# sourceMappingURL=protocol.moniker.js.map
6952 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6955 /* --------------------------------------------------------------------------------------------
6956 * Copyright (c) Microsoft Corporation. All rights reserved.
6957 * Licensed under the MIT License. See License.txt in the project root for license information.
6958 * ------------------------------------------------------------------------------------------ */
6959 Object.defineProperty(exports, "__esModule", ({ value: true }));
6960 exports.createProtocolConnection = void 0;
6961 const vscode_jsonrpc_1 = __webpack_require__(6);
6962 function createProtocolConnection(input, output, logger, options) {
6963 if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
6964 options = { connectionStrategy: options };
6966 return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
6968 exports.createProtocolConnection = createProtocolConnection;
6969 //# sourceMappingURL=connection.js.map
6973 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6976 /*---------------------------------------------------------------------------------------------
6977 * Copyright (c) Microsoft Corporation. All rights reserved.
6978 * Licensed under the MIT License. See License.txt in the project root for license information.
6979 *--------------------------------------------------------------------------------------------*/
6980 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6981 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6982 return new (P || (P = Promise))(function (resolve, reject) {
6983 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6984 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6985 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6986 step((generator = generator.apply(thisArg, _arguments || [])).next());
6989 Object.defineProperty(exports, "__esModule", ({ value: true }));
6990 exports.activateTagClosing = void 0;
6991 const coc_nvim_1 = __webpack_require__(1);
6992 const vscode_languageserver_protocol_1 = __webpack_require__(4);
6993 function activateTagClosing(tagProvider, supportedLanguages, configName) {
6994 let disposables = [];
6995 coc_nvim_1.workspace.onDidChangeTextDocument(event => {
6996 const document = coc_nvim_1.workspace.getDocument(event.textDocument.uri);
7000 onDidChangeTextDocument(document.textDocument, event.contentChanges)
7004 }, null, disposables);
7005 let isEnabled = false;
7006 updateEnabledState().catch(() => {
7009 disposables.push(coc_nvim_1.workspace.registerAutocmd({
7010 event: ['BufEnter'],
7012 callback: updateEnabledState,
7015 function updateEnabledState() {
7016 return __awaiter(this, void 0, void 0, function* () {
7018 const doc = yield coc_nvim_1.workspace.document;
7022 const document = doc.textDocument;
7023 if (supportedLanguages.indexOf(document.languageId) === -1) {
7026 if (!coc_nvim_1.workspace.getConfiguration(undefined, document.uri).get(configName)) {
7032 function onDidChangeTextDocument(document, changes) {
7033 return __awaiter(this, void 0, void 0, function* () {
7037 const doc = yield coc_nvim_1.workspace.document;
7041 let activeDocument = doc.textDocument;
7042 if (document.uri !== activeDocument.uri || changes.length === 0) {
7045 if (typeof timeout !== 'undefined') {
7046 clearTimeout(timeout);
7048 let lastChange = changes[changes.length - 1];
7049 if (!vscode_languageserver_protocol_1.Range.is(lastChange['range']) || !lastChange.text) {
7052 let lastCharacter = lastChange.text[lastChange.text.length - 1];
7053 if (lastCharacter !== '>' && lastCharacter !== '/') {
7056 let rangeStart = lastChange['range'].start;
7057 let version = document.version;
7058 timeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
7059 let position = vscode_languageserver_protocol_1.Position.create(rangeStart.line, rangeStart.character + lastChange.text.length);
7060 tagProvider(document, position).then((text) => __awaiter(this, void 0, void 0, function* () {
7061 if (text && isEnabled) {
7062 const doc = yield coc_nvim_1.workspace.document;
7066 let activeDocument = doc.textDocument;
7067 if (document.uri === activeDocument.uri && activeDocument.version === version) {
7068 coc_nvim_1.snippetManager.insertSnippet(text, false, vscode_languageserver_protocol_1.Range.create(position, position))
7075 timeout = undefined;
7079 return coc_nvim_1.Disposable.create(() => {
7080 disposables.forEach(disposable => {
7081 disposable.dispose();
7086 exports.activateTagClosing = activateTagClosing;
7087 function emptyRange(range) {
7088 return range.start.line == range.end.line && range.start.character == range.end.character;
7094 /************************************************************************/
7095 /******/ // The module cache
7096 /******/ var __webpack_module_cache__ = {};
7098 /******/ // The require function
7099 /******/ function __webpack_require__(moduleId) {
7100 /******/ // Check if module is in cache
7101 /******/ if(__webpack_module_cache__[moduleId]) {
7102 /******/ return __webpack_module_cache__[moduleId].exports;
7104 /******/ // Create a new module (and put it into the cache)
7105 /******/ var module = __webpack_module_cache__[moduleId] = {
7106 /******/ // no module.id needed
7107 /******/ // no module.loaded needed
7108 /******/ exports: {}
7111 /******/ // Execute the module function
7112 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
7114 /******/ // Return the exports of the module
7115 /******/ return module.exports;
7118 /************************************************************************/
7119 /******/ /* webpack/runtime/define property getters */
7121 /******/ // define getter functions for harmony exports
7122 /******/ __webpack_require__.d = (exports, definition) => {
7123 /******/ for(var key in definition) {
7124 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7125 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7131 /******/ /* webpack/runtime/hasOwnProperty shorthand */
7133 /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
7136 /******/ /* webpack/runtime/make namespace object */
7138 /******/ // define __esModule on exports
7139 /******/ __webpack_require__.r = (exports) => {
7140 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
7141 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7143 /******/ Object.defineProperty(exports, '__esModule', { value: true });
7147 /************************************************************************/
7148 /******/ // module exports must be returned from runtime so entry inlining is disabled
7150 /******/ // Load entry module and return exports
7151 /******/ return __webpack_require__(0);