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__(41);
25 (function (TagCloseRequest) {
26 TagCloseRequest.type = new vscode_languageserver_protocol_1.RequestType('html/tag');
27 })(TagCloseRequest || (TagCloseRequest = {}));
28 function activate(context) {
29 return __awaiter(this, void 0, void 0, function* () {
30 let { subscriptions } = context;
31 const config = coc_nvim_1.workspace.getConfiguration().get('html', {});
32 const enable = config.enable;
35 const file = context.asAbsolutePath('lib/server.js');
36 const selector = config.filetypes || ['html', 'handlebars', 'htmldjango', 'blade'];
37 const embeddedLanguages = { css: true, javascript: true };
41 transport: coc_nvim_1.TransportKind.ipc,
43 cwd: coc_nvim_1.workspace.root,
44 execArgv: config.execArgv || []
48 ...customData_1.getCustomDataPathsInAllWorkspaces(),
49 ...customData_1.getCustomDataPathsFromAllExtensions()
52 documentSelector: selector,
54 configurationSection: ['html', 'css', 'javascript']
56 outputChannelName: 'html',
57 initializationOptions: {
62 let client = new coc_nvim_1.LanguageClient('html', 'HTML language server', serverOptions, clientOptions);
63 client.onReady().then(() => {
64 selector.forEach(selector => {
65 context.subscriptions.push(coc_nvim_1.languages.registerSelectionRangeProvider(selector, {
66 provideSelectionRanges(document, positions) {
67 return __awaiter(this, void 0, void 0, function* () {
68 const textDocument = { uri: document.uri };
69 return yield Promise.resolve(client.sendRequest('$/textDocument/selectionRanges', { textDocument, positions }));
74 const tagRequestor = (document, position) => {
81 return client.sendRequest(TagCloseRequest.type, param);
83 context.subscriptions.push(tagClosing_1.activateTagClosing(tagRequestor, selector, 'html.autoClosingTags'));
87 subscriptions.push(coc_nvim_1.services.registLanguageClient(client));
90 exports.activate = activate;
97 module.exports = require("coc.nvim");;
101 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
104 /*---------------------------------------------------------------------------------------------
105 * Copyright (c) Microsoft Corporation. All rights reserved.
106 * Licensed under the MIT License. See License.txt in the project root for license information.
107 *--------------------------------------------------------------------------------------------*/
108 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
109 if (k2 === undefined) k2 = k;
110 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
111 }) : (function(o, m, k, k2) {
112 if (k2 === undefined) k2 = k;
115 var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
116 Object.defineProperty(o, "default", { enumerable: true, value: v });
117 }) : function(o, v) {
120 var __importStar = (this && this.__importStar) || function (mod) {
121 if (mod && mod.__esModule) return mod;
123 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
124 __setModuleDefault(result, mod);
127 Object.defineProperty(exports, "__esModule", ({ value: true }));
128 exports.getCustomDataPathsFromAllExtensions = exports.getCustomDataPathsInAllWorkspaces = void 0;
129 const path = __importStar(__webpack_require__(3));
130 const coc_nvim_1 = __webpack_require__(1);
131 function getCustomDataPathsInAllWorkspaces() {
132 const dataPaths = [];
133 const workspaceFolders = coc_nvim_1.workspace.workspaceFolders;
134 if (!workspaceFolders) {
137 workspaceFolders.forEach(wf => {
138 const allHtmlConfig = coc_nvim_1.workspace.getConfiguration(undefined, wf.uri);
139 const wfHtmlConfig = allHtmlConfig.inspect('html');
141 wfHtmlConfig.workspaceFolderValue &&
142 wfHtmlConfig.workspaceFolderValue.experimental &&
143 wfHtmlConfig.workspaceFolderValue.experimental.customData) {
144 const customData = wfHtmlConfig.workspaceFolderValue.experimental.customData;
145 if (Array.isArray(customData)) {
146 customData.forEach(t => {
147 if (typeof t === 'string') {
148 dataPaths.push(path.resolve(coc_nvim_1.Uri.parse(wf.uri).fsPath, t));
156 exports.getCustomDataPathsInAllWorkspaces = getCustomDataPathsInAllWorkspaces;
157 function getCustomDataPathsFromAllExtensions() {
158 const dataPaths = [];
159 for (const extension of coc_nvim_1.extensions.all) {
160 const contributes = extension.packageJSON && extension.packageJSON.contributes;
163 contributes.html.experimental.customData &&
164 Array.isArray(contributes.html.experimental.customData)) {
165 const relativePaths = contributes.html.experimental.customData;
166 relativePaths.forEach(rp => {
167 dataPaths.push(path.resolve(extension.extensionPath, rp));
173 exports.getCustomDataPathsFromAllExtensions = getCustomDataPathsFromAllExtensions;
180 module.exports = require("path");;
184 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
187 /* --------------------------------------------------------------------------------------------
188 * Copyright (c) Microsoft Corporation. All rights reserved.
189 * Licensed under the MIT License. See License.txt in the project root for license information.
190 * ------------------------------------------------------------------------------------------ */
191 function __export(m) {
192 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
194 Object.defineProperty(exports, "__esModule", ({ value: true }));
195 const node_1 = __webpack_require__(5);
196 __export(__webpack_require__(5));
197 __export(__webpack_require__(24));
198 function createProtocolConnection(input, output, logger, options) {
199 return node_1.createMessageConnection(input, output, logger, options);
201 exports.createProtocolConnection = createProtocolConnection;
202 //# sourceMappingURL=main.js.map
206 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
208 /* --------------------------------------------------------------------------------------------
209 * Copyright (c) Microsoft Corporation. All rights reserved.
210 * Licensed under the MIT License. See License.txt in the project root for license information.
211 * ----------------------------------------------------------------------------------------- */
214 module.exports = __webpack_require__(6);
218 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
221 function __export(m) {
222 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
224 Object.defineProperty(exports, "__esModule", ({ value: true }));
225 /* --------------------------------------------------------------------------------------------
226 * Copyright (c) Microsoft Corporation. All rights reserved.
227 * Licensed under the MIT License. See License.txt in the project root for license information.
228 * ----------------------------------------------------------------------------------------- */
229 const ril_1 = __webpack_require__(7);
230 // Install the node runtime abstract.
231 ril_1.default.install();
232 const api_1 = __webpack_require__(11);
233 const path = __webpack_require__(3);
234 const os = __webpack_require__(21);
235 const crypto_1 = __webpack_require__(22);
236 const net_1 = __webpack_require__(23);
237 __export(__webpack_require__(11));
238 class IPCMessageReader extends api_1.AbstractMessageReader {
239 constructor(process) {
241 this.process = process;
242 let eventEmitter = this.process;
243 eventEmitter.on('error', (error) => this.fireError(error));
244 eventEmitter.on('close', () => this.fireClose());
247 this.process.on('message', callback);
248 return api_1.Disposable.create(() => this.process.off('message', callback));
251 exports.IPCMessageReader = IPCMessageReader;
252 class IPCMessageWriter extends api_1.AbstractMessageWriter {
253 constructor(process) {
255 this.process = process;
257 let eventEmitter = this.process;
258 eventEmitter.on('error', (error) => this.fireError(error));
259 eventEmitter.on('close', () => this.fireClose);
263 if (typeof this.process.send === 'function') {
264 this.process.send(msg, undefined, undefined, (error) => {
267 this.handleError(error, msg);
274 return Promise.resolve();
277 this.handleError(error, msg);
278 return Promise.reject(error);
281 handleError(error, msg) {
283 this.fireError(error, msg, this.errorCount);
286 exports.IPCMessageWriter = IPCMessageWriter;
287 class SocketMessageReader extends api_1.ReadableStreamMessageReader {
288 constructor(socket, encoding = 'utf-8') {
289 super(ril_1.default().stream.asReadableStream(socket), encoding);
292 exports.SocketMessageReader = SocketMessageReader;
293 class SocketMessageWriter extends api_1.WriteableStreamMessageWriter {
294 constructor(socket, options) {
295 super(ril_1.default().stream.asWritableStream(socket), options);
296 this.socket = socket;
300 this.socket.destroy();
303 exports.SocketMessageWriter = SocketMessageWriter;
304 class StreamMessageReader extends api_1.ReadableStreamMessageReader {
305 constructor(readble, encoding) {
306 super(ril_1.default().stream.asReadableStream(readble), encoding);
309 exports.StreamMessageReader = StreamMessageReader;
310 class StreamMessageWriter extends api_1.WriteableStreamMessageWriter {
311 constructor(writable, options) {
312 super(ril_1.default().stream.asWritableStream(writable), options);
315 exports.StreamMessageWriter = StreamMessageWriter;
316 function generateRandomPipeName() {
317 const randomSuffix = crypto_1.randomBytes(21).toString('hex');
318 if (process.platform === 'win32') {
319 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
322 // Mac/Unix: use socket file
323 return path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
326 exports.generateRandomPipeName = generateRandomPipeName;
327 function createClientPipeTransport(pipeName, encoding = 'utf-8') {
329 const connected = new Promise((resolve, _reject) => {
330 connectResolve = resolve;
332 return new Promise((resolve, reject) => {
333 let server = net_1.createServer((socket) => {
336 new SocketMessageReader(socket, encoding),
337 new SocketMessageWriter(socket, encoding)
340 server.on('error', reject);
341 server.listen(pipeName, () => {
342 server.removeListener('error', reject);
344 onConnected: () => { return connected; }
349 exports.createClientPipeTransport = createClientPipeTransport;
350 function createServerPipeTransport(pipeName, encoding = 'utf-8') {
351 const socket = net_1.createConnection(pipeName);
353 new SocketMessageReader(socket, encoding),
354 new SocketMessageWriter(socket, encoding)
357 exports.createServerPipeTransport = createServerPipeTransport;
358 function createClientSocketTransport(port, encoding = 'utf-8') {
360 const connected = new Promise((resolve, _reject) => {
361 connectResolve = resolve;
363 return new Promise((resolve, reject) => {
364 const server = net_1.createServer((socket) => {
367 new SocketMessageReader(socket, encoding),
368 new SocketMessageWriter(socket, encoding)
371 server.on('error', reject);
372 server.listen(port, '127.0.0.1', () => {
373 server.removeListener('error', reject);
375 onConnected: () => { return connected; }
380 exports.createClientSocketTransport = createClientSocketTransport;
381 function createServerSocketTransport(port, encoding = 'utf-8') {
382 const socket = net_1.createConnection(port, '127.0.0.1');
384 new SocketMessageReader(socket, encoding),
385 new SocketMessageWriter(socket, encoding)
388 exports.createServerSocketTransport = createServerSocketTransport;
389 function isMessageReader(value) {
390 return value.listen !== undefined && value.read === undefined;
392 function isMessageWriter(value) {
393 return value.write !== undefined && value.end === undefined;
395 function createMessageConnection(input, output, logger, options) {
397 logger = api_1.NullLogger;
399 const reader = isMessageReader(input) ? input : new StreamMessageReader(input);
400 const writer = isMessageWriter(output) ? output : new StreamMessageWriter(output);
401 if (api_1.ConnectionStrategy.is(options)) {
402 options = { connectionStrategy: options };
404 return api_1.createMessageConnection(reader, writer, logger, options);
406 exports.createMessageConnection = createMessageConnection;
407 //# sourceMappingURL=main.js.map
411 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
414 /* --------------------------------------------------------------------------------------------
415 * Copyright (c) Microsoft Corporation. All rights reserved.
416 * Licensed under the MIT License. See License.txt in the project root for license information.
417 * ------------------------------------------------------------------------------------------ */
418 Object.defineProperty(exports, "__esModule", ({ value: true }));
419 const ral_1 = __webpack_require__(8);
420 const disposable_1 = __webpack_require__(9);
421 const util_1 = __webpack_require__(10);
422 const DefaultSize = 8192;
423 const CR = Buffer.from('\r', 'ascii')[0];
424 const LF = Buffer.from('\n', 'ascii')[0];
426 class MessageBuffer {
427 constructor(encoding = 'utf-8') {
428 this._encoding = encoding;
430 this.buffer = Buffer.allocUnsafe(DefaultSize);
433 return this._encoding;
437 if (typeof chunk === 'string') {
438 toAppend = Buffer.from(chunk, this._encoding);
443 if (this.buffer.length - this.index >= toAppend.length) {
444 this.buffer.set(toAppend, this.index);
447 var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;
448 if (this.index === 0) {
449 this.buffer = Buffer.allocUnsafe(newSize);
450 this.buffer.set(toAppend);
453 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);
456 this.index += toAppend.length;
460 while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {
463 // No header / body separator found (e.g CRLFCRLF)
464 if (current + 3 >= this.index) {
467 const result = new Map();
468 const headers = this.buffer.toString('ascii', 0, current).split(CRLF);
469 headers.forEach((header) => {
470 let index = header.indexOf(':');
472 throw new Error('Message header must separate key and value using :');
474 let key = header.substr(0, index);
475 let value = header.substr(index + 1).trim();
476 result.set(key, value);
478 let nextStart = current + 4;
479 this.buffer = this.buffer.slice(nextStart);
480 this.index = this.index - nextStart;
483 tryReadBody(length) {
484 if (this.index < length) {
487 const result = Buffer.alloc(length);
488 this.buffer.copy(result, 0, 0, length);
489 const nextStart = length;
490 this.buffer.copy(this.buffer, 0, nextStart);
491 this.index = this.index - nextStart;
494 get numberOfBytes() {
498 class ReadableStreamWrapper {
499 constructor(stream) {
500 this.stream = stream;
503 this.stream.on('close', listener);
504 return disposable_1.Disposable.create(() => this.stream.off('close', listener));
507 this.stream.on('error', listener);
508 return disposable_1.Disposable.create(() => this.stream.off('error', listener));
511 this.stream.on('end', listener);
512 return disposable_1.Disposable.create(() => this.stream.off('end', listener));
515 this.stream.on('data', listener);
516 return disposable_1.Disposable.create(() => this.stream.off('data', listener));
519 class WritableStreamWrapper {
520 constructor(stream) {
521 this.stream = stream;
524 this.stream.on('close', listener);
525 return disposable_1.Disposable.create(() => this.stream.off('close', listener));
528 this.stream.on('error', listener);
529 return disposable_1.Disposable.create(() => this.stream.off('error', listener));
532 this.stream.on('end', listener);
533 return disposable_1.Disposable.create(() => this.stream.off('end', listener));
535 write(data, encoding) {
536 return new Promise((resolve, reject) => {
537 const callback = (error) => {
538 if (error === undefined || error === null) {
545 if (typeof data === 'string') {
546 this.stream.write(data, encoding, callback);
549 this.stream.write(data, callback);
557 const _ril = Object.freeze({
558 messageBuffer: Object.freeze({
559 create: (encoding) => new MessageBuffer(encoding)
561 applicationJson: Object.freeze({
562 encoder: Object.freeze({
563 name: 'application/json',
564 encode: (msg, options) => {
565 return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
568 decoder: Object.freeze({
569 name: 'application/json',
570 decode: (buffer, options) => {
571 if (buffer instanceof Buffer) {
572 return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
575 return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
580 stream: Object.freeze({
581 asReadableStream: (socket) => new ReadableStreamWrapper(socket),
582 asWritableStream: (socket) => new WritableStreamWrapper(socket)
585 timer: Object.freeze({
586 setTimeout(callback, ms, ...args) {
587 return setTimeout(callback, ms, ...args);
589 clearTimeout(handle) {
590 clearTimeout(handle);
592 setImmediate(callback, ...args) {
593 return setImmediate(callback, ...args);
595 clearImmediate(handle) {
596 clearImmediate(handle);
605 ral_1.default.install(_ril);
607 RIL.install = install;
608 })(RIL || (RIL = {}));
609 exports.default = RIL;
610 //# sourceMappingURL=ril.js.map
614 /***/ ((__unused_webpack_module, exports) => {
617 /* --------------------------------------------------------------------------------------------
618 * Copyright (c) Microsoft Corporation. All rights reserved.
619 * Licensed under the MIT License. See License.txt in the project root for license information.
620 * ------------------------------------------------------------------------------------------ */
621 Object.defineProperty(exports, "__esModule", ({ value: true }));
624 if (_ral === undefined) {
625 throw new Error(`No runtime abstraction layer installed`);
630 function install(ral) {
631 if (ral === undefined) {
632 throw new Error(`No runtime abstraction layer provided`);
636 RAL.install = install;
637 })(RAL || (RAL = {}));
638 exports.default = RAL;
639 //# sourceMappingURL=ral.js.map
643 /***/ ((__unused_webpack_module, exports) => {
646 /*---------------------------------------------------------------------------------------------
647 * Copyright (c) Microsoft Corporation. All rights reserved.
648 * Licensed under the MIT License. See License.txt in the project root for license information.
649 *--------------------------------------------------------------------------------------------*/
650 Object.defineProperty(exports, "__esModule", ({ value: true }));
652 (function (Disposable) {
653 function create(func) {
658 Disposable.create = create;
659 })(Disposable = exports.Disposable || (exports.Disposable = {}));
660 //# sourceMappingURL=disposable.js.map
666 module.exports = require("util");;
670 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
673 /* --------------------------------------------------------------------------------------------
674 * Copyright (c) Microsoft Corporation. All rights reserved.
675 * Licensed under the MIT License. See License.txt in the project root for license information.
676 * ------------------------------------------------------------------------------------------ */
677 /// <reference path="../../typings/thenable.d.ts" />
678 Object.defineProperty(exports, "__esModule", ({ value: true }));
679 const messages_1 = __webpack_require__(12);
680 exports.RequestType = messages_1.RequestType;
681 exports.RequestType0 = messages_1.RequestType0;
682 exports.RequestType1 = messages_1.RequestType1;
683 exports.RequestType2 = messages_1.RequestType2;
684 exports.RequestType3 = messages_1.RequestType3;
685 exports.RequestType4 = messages_1.RequestType4;
686 exports.RequestType5 = messages_1.RequestType5;
687 exports.RequestType6 = messages_1.RequestType6;
688 exports.RequestType7 = messages_1.RequestType7;
689 exports.RequestType8 = messages_1.RequestType8;
690 exports.RequestType9 = messages_1.RequestType9;
691 exports.ResponseError = messages_1.ResponseError;
692 exports.ErrorCodes = messages_1.ErrorCodes;
693 exports.NotificationType = messages_1.NotificationType;
694 exports.NotificationType0 = messages_1.NotificationType0;
695 exports.NotificationType1 = messages_1.NotificationType1;
696 exports.NotificationType2 = messages_1.NotificationType2;
697 exports.NotificationType3 = messages_1.NotificationType3;
698 exports.NotificationType4 = messages_1.NotificationType4;
699 exports.NotificationType5 = messages_1.NotificationType5;
700 exports.NotificationType6 = messages_1.NotificationType6;
701 exports.NotificationType7 = messages_1.NotificationType7;
702 exports.NotificationType8 = messages_1.NotificationType8;
703 exports.NotificationType9 = messages_1.NotificationType9;
704 const disposable_1 = __webpack_require__(9);
705 exports.Disposable = disposable_1.Disposable;
706 const events_1 = __webpack_require__(14);
707 exports.Event = events_1.Event;
708 exports.Emitter = events_1.Emitter;
709 const cancellation_1 = __webpack_require__(15);
710 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;
711 exports.CancellationToken = cancellation_1.CancellationToken;
712 const messageReader_1 = __webpack_require__(16);
713 exports.MessageReader = messageReader_1.MessageReader;
714 exports.AbstractMessageReader = messageReader_1.AbstractMessageReader;
715 exports.ReadableStreamMessageReader = messageReader_1.ReadableStreamMessageReader;
716 const messageWriter_1 = __webpack_require__(17);
717 exports.MessageWriter = messageWriter_1.MessageWriter;
718 exports.AbstractMessageWriter = messageWriter_1.AbstractMessageWriter;
719 exports.WriteableStreamMessageWriter = messageWriter_1.WriteableStreamMessageWriter;
720 const connection_1 = __webpack_require__(19);
721 exports.ConnectionStrategy = connection_1.ConnectionStrategy;
722 exports.ConnectionOptions = connection_1.ConnectionOptions;
723 exports.NullLogger = connection_1.NullLogger;
724 exports.createMessageConnection = connection_1.createMessageConnection;
725 exports.ProgressType = connection_1.ProgressType;
726 exports.Trace = connection_1.Trace;
727 exports.TraceFormat = connection_1.TraceFormat;
728 exports.SetTraceNotification = connection_1.SetTraceNotification;
729 exports.LogTraceNotification = connection_1.LogTraceNotification;
730 exports.ConnectionErrors = connection_1.ConnectionErrors;
731 exports.ConnectionError = connection_1.ConnectionError;
732 exports.CancellationReceiverStrategy = connection_1.CancellationReceiverStrategy;
733 exports.CancellationSenderStrategy = connection_1.CancellationSenderStrategy;
734 exports.CancellationStrategy = connection_1.CancellationStrategy;
735 const ral_1 = __webpack_require__(8);
736 exports.RAL = ral_1.default;
737 //# sourceMappingURL=api.js.map
741 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
744 /* --------------------------------------------------------------------------------------------
745 * Copyright (c) Microsoft Corporation. All rights reserved.
746 * Licensed under the MIT License. See License.txt in the project root for license information.
747 * ------------------------------------------------------------------------------------------ */
748 Object.defineProperty(exports, "__esModule", ({ value: true }));
749 const is = __webpack_require__(13);
751 * Predefined error codes.
754 (function (ErrorCodes) {
755 // Defined by JSON RPC
756 ErrorCodes.ParseError = -32700;
757 ErrorCodes.InvalidRequest = -32600;
758 ErrorCodes.MethodNotFound = -32601;
759 ErrorCodes.InvalidParams = -32602;
760 ErrorCodes.InternalError = -32603;
761 ErrorCodes.serverErrorStart = -32099;
762 ErrorCodes.serverErrorEnd = -32000;
763 ErrorCodes.ServerNotInitialized = -32002;
764 ErrorCodes.UnknownErrorCode = -32001;
765 // Defined by the protocol.
766 ErrorCodes.RequestCancelled = -32800;
767 ErrorCodes.ContentModified = -32801;
768 // Defined by VSCode library.
769 ErrorCodes.MessageWriteError = 1;
770 ErrorCodes.MessageReadError = 2;
771 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
773 * An error object return in a response in case a request
776 class ResponseError extends Error {
777 constructor(code, message, data) {
779 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
781 Object.setPrototypeOf(this, ResponseError.prototype);
786 message: this.message,
791 exports.ResponseError = ResponseError;
793 * An abstract implementation of a MessageType.
795 class AbstractMessageSignature {
796 constructor(_method, _numberOfParams) {
797 this._method = _method;
798 this._numberOfParams = _numberOfParams;
803 get numberOfParams() {
804 return this._numberOfParams;
807 exports.AbstractMessageSignature = AbstractMessageSignature;
809 * Classes to type request response pairs
811 * The type parameter RO will be removed in the next major version
812 * of the JSON RPC library since it is a LSP concept and doesn't
813 * belong here. For now it is tagged as default never.
815 class RequestType0 extends AbstractMessageSignature {
816 constructor(method) {
820 exports.RequestType0 = RequestType0;
821 class RequestType extends AbstractMessageSignature {
822 constructor(method) {
826 exports.RequestType = RequestType;
827 class RequestType1 extends AbstractMessageSignature {
828 constructor(method) {
832 exports.RequestType1 = RequestType1;
833 class RequestType2 extends AbstractMessageSignature {
834 constructor(method) {
838 exports.RequestType2 = RequestType2;
839 class RequestType3 extends AbstractMessageSignature {
840 constructor(method) {
844 exports.RequestType3 = RequestType3;
845 class RequestType4 extends AbstractMessageSignature {
846 constructor(method) {
850 exports.RequestType4 = RequestType4;
851 class RequestType5 extends AbstractMessageSignature {
852 constructor(method) {
856 exports.RequestType5 = RequestType5;
857 class RequestType6 extends AbstractMessageSignature {
858 constructor(method) {
862 exports.RequestType6 = RequestType6;
863 class RequestType7 extends AbstractMessageSignature {
864 constructor(method) {
868 exports.RequestType7 = RequestType7;
869 class RequestType8 extends AbstractMessageSignature {
870 constructor(method) {
874 exports.RequestType8 = RequestType8;
875 class RequestType9 extends AbstractMessageSignature {
876 constructor(method) {
880 exports.RequestType9 = RequestType9;
882 * The type parameter RO will be removed in the next major version
883 * of the JSON RPC library since it is a LSP concept and doesn't
884 * belong here. For now it is tagged as default never.
886 class NotificationType extends AbstractMessageSignature {
887 constructor(method) {
892 exports.NotificationType = NotificationType;
893 class NotificationType0 extends AbstractMessageSignature {
894 constructor(method) {
898 exports.NotificationType0 = NotificationType0;
899 class NotificationType1 extends AbstractMessageSignature {
900 constructor(method) {
904 exports.NotificationType1 = NotificationType1;
905 class NotificationType2 extends AbstractMessageSignature {
906 constructor(method) {
910 exports.NotificationType2 = NotificationType2;
911 class NotificationType3 extends AbstractMessageSignature {
912 constructor(method) {
916 exports.NotificationType3 = NotificationType3;
917 class NotificationType4 extends AbstractMessageSignature {
918 constructor(method) {
922 exports.NotificationType4 = NotificationType4;
923 class NotificationType5 extends AbstractMessageSignature {
924 constructor(method) {
928 exports.NotificationType5 = NotificationType5;
929 class NotificationType6 extends AbstractMessageSignature {
930 constructor(method) {
934 exports.NotificationType6 = NotificationType6;
935 class NotificationType7 extends AbstractMessageSignature {
936 constructor(method) {
940 exports.NotificationType7 = NotificationType7;
941 class NotificationType8 extends AbstractMessageSignature {
942 constructor(method) {
946 exports.NotificationType8 = NotificationType8;
947 class NotificationType9 extends AbstractMessageSignature {
948 constructor(method) {
952 exports.NotificationType9 = NotificationType9;
954 * Tests if the given message is a request message
956 function isRequestMessage(message) {
957 const candidate = message;
958 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
960 exports.isRequestMessage = isRequestMessage;
962 * Tests if the given message is a notification message
964 function isNotificationMessage(message) {
965 const candidate = message;
966 return candidate && is.string(candidate.method) && message.id === void 0;
968 exports.isNotificationMessage = isNotificationMessage;
970 * Tests if the given message is a response message
972 function isResponseMessage(message) {
973 const candidate = message;
974 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
976 exports.isResponseMessage = isResponseMessage;
977 //# sourceMappingURL=messages.js.map
981 /***/ ((__unused_webpack_module, exports) => {
984 /* --------------------------------------------------------------------------------------------
985 * Copyright (c) Microsoft Corporation. All rights reserved.
986 * Licensed under the MIT License. See License.txt in the project root for license information.
987 * ------------------------------------------------------------------------------------------ */
988 Object.defineProperty(exports, "__esModule", ({ value: true }));
989 function boolean(value) {
990 return value === true || value === false;
992 exports.boolean = boolean;
993 function string(value) {
994 return typeof value === 'string' || value instanceof String;
996 exports.string = string;
997 function number(value) {
998 return typeof value === 'number' || value instanceof Number;
1000 exports.number = number;
1001 function error(value) {
1002 return value instanceof Error;
1004 exports.error = error;
1005 function func(value) {
1006 return typeof value === 'function';
1008 exports.func = func;
1009 function array(value) {
1010 return Array.isArray(value);
1012 exports.array = array;
1013 function stringArray(value) {
1014 return array(value) && value.every(elem => string(elem));
1016 exports.stringArray = stringArray;
1017 //# sourceMappingURL=is.js.map
1021 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1024 /* --------------------------------------------------------------------------------------------
1025 * Copyright (c) Microsoft Corporation. All rights reserved.
1026 * Licensed under the MIT License. See License.txt in the project root for license information.
1027 * ------------------------------------------------------------------------------------------ */
1028 Object.defineProperty(exports, "__esModule", ({ value: true }));
1029 const ral_1 = __webpack_require__(8);
1032 const _disposable = { dispose() { } };
1033 Event.None = function () { return _disposable; };
1034 })(Event = exports.Event || (exports.Event = {}));
1035 class CallbackList {
1036 add(callback, context = null, bucket) {
1037 if (!this._callbacks) {
1038 this._callbacks = [];
1039 this._contexts = [];
1041 this._callbacks.push(callback);
1042 this._contexts.push(context);
1043 if (Array.isArray(bucket)) {
1044 bucket.push({ dispose: () => this.remove(callback, context) });
1047 remove(callback, context = null) {
1048 if (!this._callbacks) {
1051 let foundCallbackWithDifferentContext = false;
1052 for (let i = 0, len = this._callbacks.length; i < len; i++) {
1053 if (this._callbacks[i] === callback) {
1054 if (this._contexts[i] === context) {
1055 // callback & context match => remove it
1056 this._callbacks.splice(i, 1);
1057 this._contexts.splice(i, 1);
1061 foundCallbackWithDifferentContext = true;
1065 if (foundCallbackWithDifferentContext) {
1066 throw new Error('When adding a listener with a context, you should remove it with the same context');
1070 if (!this._callbacks) {
1073 const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
1074 for (let i = 0, len = callbacks.length; i < len; i++) {
1076 ret.push(callbacks[i].apply(contexts[i], args));
1079 // eslint-disable-next-line no-console
1080 ral_1.default().console.error(e);
1086 return !this._callbacks || this._callbacks.length === 0;
1089 this._callbacks = undefined;
1090 this._contexts = undefined;
1094 constructor(_options) {
1095 this._options = _options;
1098 * For the public to allow to subscribe
1099 * to events from this Emitter
1103 this._event = (listener, thisArgs, disposables) => {
1104 if (!this._callbacks) {
1105 this._callbacks = new CallbackList();
1107 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
1108 this._options.onFirstListenerAdd(this);
1110 this._callbacks.add(listener, thisArgs);
1113 if (!this._callbacks) {
1114 // disposable is disposed after emitter is disposed.
1117 this._callbacks.remove(listener, thisArgs);
1118 result.dispose = Emitter._noop;
1119 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
1120 this._options.onLastListenerRemove(this);
1124 if (Array.isArray(disposables)) {
1125 disposables.push(result);
1133 * To be kept private to fire an event to
1137 if (this._callbacks) {
1138 this._callbacks.invoke.call(this._callbacks, event);
1142 if (this._callbacks) {
1143 this._callbacks.dispose();
1144 this._callbacks = undefined;
1148 exports.Emitter = Emitter;
1149 Emitter._noop = function () { };
1150 //# sourceMappingURL=events.js.map
1154 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1157 /*---------------------------------------------------------------------------------------------
1158 * Copyright (c) Microsoft Corporation. All rights reserved.
1159 * Licensed under the MIT License. See License.txt in the project root for license information.
1160 *--------------------------------------------------------------------------------------------*/
1161 Object.defineProperty(exports, "__esModule", ({ value: true }));
1162 const ral_1 = __webpack_require__(8);
1163 const Is = __webpack_require__(13);
1164 const events_1 = __webpack_require__(14);
1165 var CancellationToken;
1166 (function (CancellationToken) {
1167 CancellationToken.None = Object.freeze({
1168 isCancellationRequested: false,
1169 onCancellationRequested: events_1.Event.None
1171 CancellationToken.Cancelled = Object.freeze({
1172 isCancellationRequested: true,
1173 onCancellationRequested: events_1.Event.None
1175 function is(value) {
1176 const candidate = value;
1177 return candidate && (candidate === CancellationToken.None
1178 || candidate === CancellationToken.Cancelled
1179 || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
1181 CancellationToken.is = is;
1182 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
1183 const shortcutEvent = Object.freeze(function (callback, context) {
1184 const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
1185 return { dispose() { ral_1.default().timer.clearTimeout(handle); } };
1187 class MutableToken {
1189 this._isCancelled = false;
1192 if (!this._isCancelled) {
1193 this._isCancelled = true;
1194 if (this._emitter) {
1195 this._emitter.fire(undefined);
1200 get isCancellationRequested() {
1201 return this._isCancelled;
1203 get onCancellationRequested() {
1204 if (this._isCancelled) {
1205 return shortcutEvent;
1207 if (!this._emitter) {
1208 this._emitter = new events_1.Emitter();
1210 return this._emitter.event;
1213 if (this._emitter) {
1214 this._emitter.dispose();
1215 this._emitter = undefined;
1219 class CancellationTokenSource {
1222 // be lazy and create the token only when
1224 this._token = new MutableToken();
1230 // save an object by returning the default
1231 // cancelled token when cancellation happens
1232 // before someone asks for the token
1233 this._token = CancellationToken.Cancelled;
1236 this._token.cancel();
1241 // ensure to initialize with an empty token if we had none
1242 this._token = CancellationToken.None;
1244 else if (this._token instanceof MutableToken) {
1246 this._token.dispose();
1250 exports.CancellationTokenSource = CancellationTokenSource;
1251 //# sourceMappingURL=cancellation.js.map
1255 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1258 /* --------------------------------------------------------------------------------------------
1259 * Copyright (c) Microsoft Corporation. All rights reserved.
1260 * Licensed under the MIT License. See License.txt in the project root for license information.
1261 * ------------------------------------------------------------------------------------------ */
1262 Object.defineProperty(exports, "__esModule", ({ value: true }));
1263 const ral_1 = __webpack_require__(8);
1264 const Is = __webpack_require__(13);
1265 const events_1 = __webpack_require__(14);
1267 (function (MessageReader) {
1268 function is(value) {
1269 let candidate = value;
1270 return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
1271 Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
1273 MessageReader.is = is;
1274 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
1275 class AbstractMessageReader {
1277 this.errorEmitter = new events_1.Emitter();
1278 this.closeEmitter = new events_1.Emitter();
1279 this.partialMessageEmitter = new events_1.Emitter();
1282 this.errorEmitter.dispose();
1283 this.closeEmitter.dispose();
1286 return this.errorEmitter.event;
1289 this.errorEmitter.fire(this.asError(error));
1292 return this.closeEmitter.event;
1295 this.closeEmitter.fire(undefined);
1297 get onPartialMessage() {
1298 return this.partialMessageEmitter.event;
1300 firePartialMessage(info) {
1301 this.partialMessageEmitter.fire(info);
1304 if (error instanceof Error) {
1308 return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
1312 exports.AbstractMessageReader = AbstractMessageReader;
1313 var ResolvedMessageReaderOptions;
1314 (function (ResolvedMessageReaderOptions) {
1315 function fromOptions(options) {
1320 const contentDecoders = new Map();
1321 let contentTypeDecoder;
1322 const contentTypeDecoders = new Map();
1323 if (options === undefined || typeof options === 'string') {
1324 charset = options !== null && options !== void 0 ? options : 'utf-8';
1327 charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8';
1328 if (options.contentDecoder !== undefined) {
1329 contentDecoder = options.contentDecoder;
1330 contentDecoders.set(contentDecoder.name, contentDecoder);
1332 if (options.contentDecoders !== undefined) {
1333 for (const decoder of options.contentDecoders) {
1334 contentDecoders.set(decoder.name, decoder);
1337 if (options.contentTypeDecoder !== undefined) {
1338 contentTypeDecoder = options.contentTypeDecoder;
1339 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
1341 if (options.contentTypeDecoders !== undefined) {
1342 for (const decoder of options.contentTypeDecoders) {
1343 contentTypeDecoders.set(decoder.name, decoder);
1347 if (contentTypeDecoder === undefined) {
1348 contentTypeDecoder = ral_1.default().applicationJson.decoder;
1349 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
1351 return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
1353 ResolvedMessageReaderOptions.fromOptions = fromOptions;
1354 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
1355 class ReadableStreamMessageReader extends AbstractMessageReader {
1356 constructor(readable, options) {
1358 this.readable = readable;
1359 this.options = ResolvedMessageReaderOptions.fromOptions(options);
1360 this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
1361 this._partialMessageTimeout = 10000;
1362 this.nextMessageLength = -1;
1363 this.messageToken = 0;
1365 set partialMessageTimeout(timeout) {
1366 this._partialMessageTimeout = timeout;
1368 get partialMessageTimeout() {
1369 return this._partialMessageTimeout;
1372 this.nextMessageLength = -1;
1373 this.messageToken = 0;
1374 this.partialMessageTimer = undefined;
1375 this.callback = callback;
1376 const result = this.readable.onData((data) => {
1379 this.readable.onError((error) => this.fireError(error));
1380 this.readable.onClose(() => this.fireClose());
1384 this.buffer.append(data);
1386 if (this.nextMessageLength === -1) {
1387 const headers = this.buffer.tryReadHeaders();
1391 const contentLength = headers.get('Content-Length');
1392 if (!contentLength) {
1393 throw new Error('Header must provide a Content-Length property.');
1395 const length = parseInt(contentLength);
1396 if (isNaN(length)) {
1397 throw new Error('Content-Length value must be a number.');
1399 this.nextMessageLength = length;
1401 const body = this.buffer.tryReadBody(this.nextMessageLength);
1402 if (body === undefined) {
1403 /** We haven't received the full message yet. */
1404 this.setPartialMessageTimer();
1407 this.clearPartialMessageTimer();
1408 this.nextMessageLength = -1;
1410 if (this.options.contentDecoder !== undefined) {
1411 p = this.options.contentDecoder.decode(body);
1414 p = Promise.resolve(body);
1417 this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
1420 this.fireError(error);
1423 this.fireError(error);
1427 clearPartialMessageTimer() {
1428 if (this.partialMessageTimer) {
1429 ral_1.default().timer.clearTimeout(this.partialMessageTimer);
1430 this.partialMessageTimer = undefined;
1433 setPartialMessageTimer() {
1434 this.clearPartialMessageTimer();
1435 if (this._partialMessageTimeout <= 0) {
1438 this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
1439 this.partialMessageTimer = undefined;
1440 if (token === this.messageToken) {
1441 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
1442 this.setPartialMessageTimer();
1444 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
1447 exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
1448 //# sourceMappingURL=messageReader.js.map
1452 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1455 /* --------------------------------------------------------------------------------------------
1456 * Copyright (c) Microsoft Corporation. All rights reserved.
1457 * Licensed under the MIT License. See License.txt in the project root for license information.
1458 * ------------------------------------------------------------------------------------------ */
1459 Object.defineProperty(exports, "__esModule", ({ value: true }));
1460 const ral_1 = __webpack_require__(8);
1461 const Is = __webpack_require__(13);
1462 const semaphore_1 = __webpack_require__(18);
1463 const events_1 = __webpack_require__(14);
1464 const ContentLength = 'Content-Length: ';
1465 const CRLF = '\r\n';
1467 (function (MessageWriter) {
1468 function is(value) {
1469 let candidate = value;
1470 return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
1471 Is.func(candidate.onError) && Is.func(candidate.write);
1473 MessageWriter.is = is;
1474 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
1475 class AbstractMessageWriter {
1477 this.errorEmitter = new events_1.Emitter();
1478 this.closeEmitter = new events_1.Emitter();
1481 this.errorEmitter.dispose();
1482 this.closeEmitter.dispose();
1485 return this.errorEmitter.event;
1487 fireError(error, message, count) {
1488 this.errorEmitter.fire([this.asError(error), message, count]);
1491 return this.closeEmitter.event;
1494 this.closeEmitter.fire(undefined);
1497 if (error instanceof Error) {
1501 return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
1505 exports.AbstractMessageWriter = AbstractMessageWriter;
1506 var ResolvedMessageWriterOptions;
1507 (function (ResolvedMessageWriterOptions) {
1508 function fromOptions(options) {
1510 if (options === undefined || typeof options === 'string') {
1511 return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder };
1514 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 };
1517 ResolvedMessageWriterOptions.fromOptions = fromOptions;
1518 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
1519 class WriteableStreamMessageWriter extends AbstractMessageWriter {
1520 constructor(writable, options) {
1522 this.writable = writable;
1523 this.options = ResolvedMessageWriterOptions.fromOptions(options);
1524 this.errorCount = 0;
1525 this.writeSemaphore = new semaphore_1.Semaphore(1);
1526 this.writable.onError((error) => this.fireError(error));
1527 this.writable.onClose(() => this.fireClose());
1530 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
1531 if (this.options.contentEncoder !== undefined) {
1532 return this.options.contentEncoder.encode(buffer);
1538 return payload.then((buffer) => {
1540 headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
1542 return this.doWrite(msg, headers, buffer);
1544 this.fireError(error);
1548 doWrite(msg, headers, data) {
1549 return this.writeSemaphore.lock(async () => {
1551 await this.writable.write(headers.join(''), 'ascii');
1552 return this.writable.write(data);
1555 this.handleError(error, msg);
1559 handleError(error, msg) {
1561 this.fireError(error, msg, this.errorCount);
1564 exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
1565 //# sourceMappingURL=messageWriter.js.map
1569 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1572 /* --------------------------------------------------------------------------------------------
1573 * Copyright (c) Microsoft Corporation. All rights reserved.
1574 * Licensed under the MIT License. See License.txt in the project root for license information.
1575 * ------------------------------------------------------------------------------------------ */
1576 Object.defineProperty(exports, "__esModule", ({ value: true }));
1577 const ral_1 = __webpack_require__(8);
1579 constructor(capacity = 1) {
1580 if (capacity <= 0) {
1581 throw new Error('Capacity must be greater than 0');
1583 this._capacity = capacity;
1588 return new Promise((resolve, reject) => {
1589 this._waiting.push({ thunk, resolve, reject });
1594 return this._active;
1597 if (this._waiting.length === 0 || this._active === this._capacity) {
1600 ral_1.default().timer.setImmediate(() => this.doRunNext());
1603 if (this._waiting.length === 0 || this._active === this._capacity) {
1606 const next = this._waiting.shift();
1608 if (this._active > this._capacity) {
1609 throw new Error(`To many thunks active`);
1612 const result = next.thunk();
1613 if (result instanceof Promise) {
1614 result.then((value) => {
1616 next.resolve(value);
1626 next.resolve(result);
1637 exports.Semaphore = Semaphore;
1638 //# sourceMappingURL=semaphore.js.map
1642 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1645 /* --------------------------------------------------------------------------------------------
1646 * Copyright (c) Microsoft Corporation. All rights reserved.
1647 * Licensed under the MIT License. See License.txt in the project root for license information.
1648 * ------------------------------------------------------------------------------------------ */
1649 Object.defineProperty(exports, "__esModule", ({ value: true }));
1650 const ral_1 = __webpack_require__(8);
1651 const Is = __webpack_require__(13);
1652 const messages_1 = __webpack_require__(12);
1653 const linkedMap_1 = __webpack_require__(20);
1654 const events_1 = __webpack_require__(14);
1655 const cancellation_1 = __webpack_require__(15);
1656 var CancelNotification;
1657 (function (CancelNotification) {
1658 CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
1659 })(CancelNotification || (CancelNotification = {}));
1660 var ProgressNotification;
1661 (function (ProgressNotification) {
1662 ProgressNotification.type = new messages_1.NotificationType('$/progress');
1663 })(ProgressNotification || (ProgressNotification = {}));
1664 class ProgressType {
1668 exports.ProgressType = ProgressType;
1669 exports.NullLogger = Object.freeze({
1677 Trace[Trace["Off"] = 0] = "Off";
1678 Trace[Trace["Messages"] = 1] = "Messages";
1679 Trace[Trace["Verbose"] = 2] = "Verbose";
1680 })(Trace = exports.Trace || (exports.Trace = {}));
1682 function fromString(value) {
1683 if (!Is.string(value)) {
1686 value = value.toLowerCase();
1691 return Trace.Messages;
1693 return Trace.Verbose;
1698 Trace.fromString = fromString;
1699 function toString(value) {
1703 case Trace.Messages:
1711 Trace.toString = toString;
1712 })(Trace = exports.Trace || (exports.Trace = {}));
1714 (function (TraceFormat) {
1715 TraceFormat["Text"] = "text";
1716 TraceFormat["JSON"] = "json";
1717 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
1718 (function (TraceFormat) {
1719 function fromString(value) {
1720 value = value.toLowerCase();
1721 if (value === 'json') {
1722 return TraceFormat.JSON;
1725 return TraceFormat.Text;
1728 TraceFormat.fromString = fromString;
1729 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
1730 var SetTraceNotification;
1731 (function (SetTraceNotification) {
1732 SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');
1733 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
1734 var LogTraceNotification;
1735 (function (LogTraceNotification) {
1736 LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');
1737 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
1738 var ConnectionErrors;
1739 (function (ConnectionErrors) {
1741 * The connection is closed.
1743 ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
1745 * The connection got disposed.
1747 ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
1749 * The connection is already in listening mode.
1751 ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
1752 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
1753 class ConnectionError extends Error {
1754 constructor(code, message) {
1757 Object.setPrototypeOf(this, ConnectionError.prototype);
1760 exports.ConnectionError = ConnectionError;
1761 var ConnectionStrategy;
1762 (function (ConnectionStrategy) {
1763 function is(value) {
1764 const candidate = value;
1765 return candidate && Is.func(candidate.cancelUndispatched);
1767 ConnectionStrategy.is = is;
1768 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
1769 var CancellationReceiverStrategy;
1770 (function (CancellationReceiverStrategy) {
1771 CancellationReceiverStrategy.Message = Object.freeze({
1772 createCancellationTokenSource(_) {
1773 return new cancellation_1.CancellationTokenSource();
1776 function is(value) {
1777 const candidate = value;
1778 return candidate && Is.func(candidate.createCancellationTokenSource);
1780 CancellationReceiverStrategy.is = is;
1781 })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {}));
1782 var CancellationSenderStrategy;
1783 (function (CancellationSenderStrategy) {
1784 CancellationSenderStrategy.Message = Object.freeze({
1785 sendCancellation(conn, id) {
1786 conn.sendNotification(CancelNotification.type, { id });
1790 function is(value) {
1791 const candidate = value;
1792 return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
1794 CancellationSenderStrategy.is = is;
1795 })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {}));
1796 var CancellationStrategy;
1797 (function (CancellationStrategy) {
1798 CancellationStrategy.Message = Object.freeze({
1799 receiver: CancellationReceiverStrategy.Message,
1800 sender: CancellationSenderStrategy.Message
1802 function is(value) {
1803 const candidate = value;
1804 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
1806 CancellationStrategy.is = is;
1807 })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {}));
1808 var ConnectionOptions;
1809 (function (ConnectionOptions) {
1810 function is(value) {
1811 const candidate = value;
1812 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
1814 ConnectionOptions.is = is;
1815 })(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {}));
1816 var ConnectionState;
1817 (function (ConnectionState) {
1818 ConnectionState[ConnectionState["New"] = 1] = "New";
1819 ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
1820 ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
1821 ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
1822 })(ConnectionState || (ConnectionState = {}));
1823 function createMessageConnection(messageReader, messageWriter, _logger, options) {
1824 const logger = _logger !== undefined ? _logger : exports.NullLogger;
1825 let sequenceNumber = 0;
1826 let notificationSquenceNumber = 0;
1827 let unknownResponseSquenceNumber = 0;
1828 const version = '2.0';
1829 let starRequestHandler = undefined;
1830 const requestHandlers = Object.create(null);
1831 let starNotificationHandler = undefined;
1832 const notificationHandlers = Object.create(null);
1833 const progressHandlers = new Map();
1835 let messageQueue = new linkedMap_1.LinkedMap();
1836 let responsePromises = Object.create(null);
1837 let requestTokens = Object.create(null);
1838 let trace = Trace.Off;
1839 let traceFormat = TraceFormat.Text;
1841 let state = ConnectionState.New;
1842 const errorEmitter = new events_1.Emitter();
1843 const closeEmitter = new events_1.Emitter();
1844 const unhandledNotificationEmitter = new events_1.Emitter();
1845 const unhandledProgressEmitter = new events_1.Emitter();
1846 const disposeEmitter = new events_1.Emitter();
1847 const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message;
1848 function createRequestQueueKey(id) {
1849 return 'req-' + id.toString();
1851 function createResponseQueueKey(id) {
1853 return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
1856 return 'res-' + id.toString();
1859 function createNotificationQueueKey() {
1860 return 'not-' + (++notificationSquenceNumber).toString();
1862 function addMessageToQueue(queue, message) {
1863 if (messages_1.isRequestMessage(message)) {
1864 queue.set(createRequestQueueKey(message.id), message);
1866 else if (messages_1.isResponseMessage(message)) {
1867 queue.set(createResponseQueueKey(message.id), message);
1870 queue.set(createNotificationQueueKey(), message);
1873 function cancelUndispatched(_message) {
1876 function isListening() {
1877 return state === ConnectionState.Listening;
1879 function isClosed() {
1880 return state === ConnectionState.Closed;
1882 function isDisposed() {
1883 return state === ConnectionState.Disposed;
1885 function closeHandler() {
1886 if (state === ConnectionState.New || state === ConnectionState.Listening) {
1887 state = ConnectionState.Closed;
1888 closeEmitter.fire(undefined);
1890 // If the connection is disposed don't sent close events.
1892 function readErrorHandler(error) {
1893 errorEmitter.fire([error, undefined, undefined]);
1895 function writeErrorHandler(data) {
1896 errorEmitter.fire(data);
1898 messageReader.onClose(closeHandler);
1899 messageReader.onError(readErrorHandler);
1900 messageWriter.onClose(closeHandler);
1901 messageWriter.onError(writeErrorHandler);
1902 function triggerMessageQueue() {
1903 if (timer || messageQueue.size === 0) {
1906 timer = ral_1.default().timer.setImmediate(() => {
1908 processMessageQueue();
1911 function processMessageQueue() {
1912 if (messageQueue.size === 0) {
1915 const message = messageQueue.shift();
1917 if (messages_1.isRequestMessage(message)) {
1918 handleRequest(message);
1920 else if (messages_1.isNotificationMessage(message)) {
1921 handleNotification(message);
1923 else if (messages_1.isResponseMessage(message)) {
1924 handleResponse(message);
1927 handleInvalidMessage(message);
1931 triggerMessageQueue();
1934 const callback = (message) => {
1936 // We have received a cancellation message. Check if the message is still in the queue
1937 // and cancel it if allowed to do so.
1938 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
1939 const key = createRequestQueueKey(message.params.id);
1940 const toCancel = messageQueue.get(key);
1941 if (messages_1.isRequestMessage(toCancel)) {
1942 const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
1943 const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
1944 if (response && (response.error !== undefined || response.result !== undefined)) {
1945 messageQueue.delete(key);
1946 response.id = toCancel.id;
1947 traceSendingResponse(response, message.method, Date.now());
1948 messageWriter.write(response);
1953 addMessageToQueue(messageQueue, message);
1956 triggerMessageQueue();
1959 function handleRequest(requestMessage) {
1961 // we return here silently since we fired an event when the
1962 // connection got disposed.
1965 function reply(resultOrError, method, startTime) {
1968 id: requestMessage.id
1970 if (resultOrError instanceof messages_1.ResponseError) {
1971 message.error = resultOrError.toJson();
1974 message.result = resultOrError === undefined ? null : resultOrError;
1976 traceSendingResponse(message, method, startTime);
1977 messageWriter.write(message);
1979 function replyError(error, method, startTime) {
1982 id: requestMessage.id,
1983 error: error.toJson()
1985 traceSendingResponse(message, method, startTime);
1986 messageWriter.write(message);
1988 function replySuccess(result, method, startTime) {
1989 // The JSON RPC defines that a response must either have a result or an error
1990 // So we can't treat undefined as a valid response result.
1991 if (result === undefined) {
1996 id: requestMessage.id,
1999 traceSendingResponse(message, method, startTime);
2000 messageWriter.write(message);
2002 traceReceivedRequest(requestMessage);
2003 const element = requestHandlers[requestMessage.method];
2007 type = element.type;
2008 requestHandler = element.handler;
2010 const startTime = Date.now();
2011 if (requestHandler || starRequestHandler) {
2012 const tokenKey = String(requestMessage.id);
2013 const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
2014 requestTokens[tokenKey] = cancellationSource;
2017 if (requestMessage.params === undefined || (type !== undefined && type.numberOfParams === 0)) {
2018 handlerResult = requestHandler
2019 ? requestHandler(cancellationSource.token)
2020 : starRequestHandler(requestMessage.method, cancellationSource.token);
2022 else if (Is.array(requestMessage.params) && (type === undefined || type.numberOfParams > 1)) {
2023 handlerResult = requestHandler
2024 ? requestHandler(...requestMessage.params, cancellationSource.token)
2025 : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);
2028 handlerResult = requestHandler
2029 ? requestHandler(requestMessage.params, cancellationSource.token)
2030 : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
2032 const promise = handlerResult;
2033 if (!handlerResult) {
2034 delete requestTokens[tokenKey];
2035 replySuccess(handlerResult, requestMessage.method, startTime);
2037 else if (promise.then) {
2038 promise.then((resultOrError) => {
2039 delete requestTokens[tokenKey];
2040 reply(resultOrError, requestMessage.method, startTime);
2042 delete requestTokens[tokenKey];
2043 if (error instanceof messages_1.ResponseError) {
2044 replyError(error, requestMessage.method, startTime);
2046 else if (error && Is.string(error.message)) {
2047 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2050 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2055 delete requestTokens[tokenKey];
2056 reply(handlerResult, requestMessage.method, startTime);
2060 delete requestTokens[tokenKey];
2061 if (error instanceof messages_1.ResponseError) {
2062 reply(error, requestMessage.method, startTime);
2064 else if (error && Is.string(error.message)) {
2065 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2068 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2073 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
2076 function handleResponse(responseMessage) {
2078 // See handle request.
2081 if (responseMessage.id === null) {
2082 if (responseMessage.error) {
2083 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
2086 logger.error(`Received response message without id. No further error information provided.`);
2090 const key = String(responseMessage.id);
2091 const responsePromise = responsePromises[key];
2092 traceReceivedResponse(responseMessage, responsePromise);
2093 if (responsePromise) {
2094 delete responsePromises[key];
2096 if (responseMessage.error) {
2097 const error = responseMessage.error;
2098 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
2100 else if (responseMessage.result !== undefined) {
2101 responsePromise.resolve(responseMessage.result);
2104 throw new Error('Should never happen.');
2108 if (error.message) {
2109 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
2112 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
2118 function handleNotification(message) {
2120 // See handle request.
2123 let type = undefined;
2124 let notificationHandler;
2125 if (message.method === CancelNotification.type.method) {
2126 notificationHandler = (params) => {
2127 const id = params.id;
2128 const source = requestTokens[String(id)];
2135 const element = notificationHandlers[message.method];
2137 notificationHandler = element.handler;
2138 type = element.type;
2141 if (notificationHandler || starNotificationHandler) {
2143 traceReceivedNotification(message);
2144 if (message.params === undefined || (type !== undefined && type.numberOfParams === 0)) {
2145 notificationHandler ? notificationHandler() : starNotificationHandler(message.method);
2147 else if (Is.array(message.params) && (type === undefined || type.numberOfParams > 1)) {
2148 notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);
2151 notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);
2155 if (error.message) {
2156 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
2159 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
2164 unhandledNotificationEmitter.fire(message);
2167 function handleInvalidMessage(message) {
2169 logger.error('Received empty message.');
2172 logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
2173 // Test whether we find an id to reject the promise
2174 const responseMessage = message;
2175 if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
2176 const key = String(responseMessage.id);
2177 const responseHandler = responsePromises[key];
2178 if (responseHandler) {
2179 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
2183 function traceSendingRequest(message) {
2184 if (trace === Trace.Off || !tracer) {
2187 if (traceFormat === TraceFormat.Text) {
2188 let data = undefined;
2189 if (trace === Trace.Verbose && message.params) {
2190 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2192 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
2195 logLSPMessage('send-request', message);
2198 function traceSendingNotification(message) {
2199 if (trace === Trace.Off || !tracer) {
2202 if (traceFormat === TraceFormat.Text) {
2203 let data = undefined;
2204 if (trace === Trace.Verbose) {
2205 if (message.params) {
2206 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2209 data = 'No parameters provided.\n\n';
2212 tracer.log(`Sending notification '${message.method}'.`, data);
2215 logLSPMessage('send-notification', message);
2218 function traceSendingResponse(message, method, startTime) {
2219 if (trace === Trace.Off || !tracer) {
2222 if (traceFormat === TraceFormat.Text) {
2223 let data = undefined;
2224 if (trace === Trace.Verbose) {
2225 if (message.error && message.error.data) {
2226 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
2229 if (message.result) {
2230 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
2232 else if (message.error === undefined) {
2233 data = 'No result returned.\n\n';
2237 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
2240 logLSPMessage('send-response', message);
2243 function traceReceivedRequest(message) {
2244 if (trace === Trace.Off || !tracer) {
2247 if (traceFormat === TraceFormat.Text) {
2248 let data = undefined;
2249 if (trace === Trace.Verbose && message.params) {
2250 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2252 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
2255 logLSPMessage('receive-request', message);
2258 function traceReceivedNotification(message) {
2259 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
2262 if (traceFormat === TraceFormat.Text) {
2263 let data = undefined;
2264 if (trace === Trace.Verbose) {
2265 if (message.params) {
2266 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
2269 data = 'No parameters provided.\n\n';
2272 tracer.log(`Received notification '${message.method}'.`, data);
2275 logLSPMessage('receive-notification', message);
2278 function traceReceivedResponse(message, responsePromise) {
2279 if (trace === Trace.Off || !tracer) {
2282 if (traceFormat === TraceFormat.Text) {
2283 let data = undefined;
2284 if (trace === Trace.Verbose) {
2285 if (message.error && message.error.data) {
2286 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
2289 if (message.result) {
2290 data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
2292 else if (message.error === undefined) {
2293 data = 'No result returned.\n\n';
2297 if (responsePromise) {
2298 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
2299 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
2302 tracer.log(`Received response ${message.id} without active response promise.`, data);
2306 logLSPMessage('receive-response', message);
2309 function logLSPMessage(type, message) {
2310 if (!tracer || trace === Trace.Off) {
2313 const lspMessage = {
2317 timestamp: Date.now()
2319 tracer.log(lspMessage);
2321 function throwIfClosedOrDisposed() {
2323 throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
2326 throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
2329 function throwIfListening() {
2330 if (isListening()) {
2331 throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
2334 function throwIfNotListening() {
2335 if (!isListening()) {
2336 throw new Error('Call listen() first.');
2339 function undefinedToNull(param) {
2340 if (param === undefined) {
2347 function computeMessageParams(type, params) {
2349 const numberOfParams = type.numberOfParams;
2350 switch (numberOfParams) {
2355 result = undefinedToNull(params[0]);
2359 for (let i = 0; i < params.length && i < numberOfParams; i++) {
2360 result.push(undefinedToNull(params[i]));
2362 if (params.length < numberOfParams) {
2363 for (let i = params.length; i < numberOfParams; i++) {
2371 const connection = {
2372 sendNotification: (type, ...params) => {
2373 throwIfClosedOrDisposed();
2376 if (Is.string(type)) {
2378 switch (params.length) {
2380 messageParams = null;
2383 messageParams = params[0];
2386 messageParams = params;
2391 method = type.method;
2392 messageParams = computeMessageParams(type, params);
2394 const notificationMessage = {
2397 params: messageParams
2399 traceSendingNotification(notificationMessage);
2400 messageWriter.write(notificationMessage);
2402 onNotification: (type, handler) => {
2403 throwIfClosedOrDisposed();
2404 if (Is.func(type)) {
2405 starNotificationHandler = type;
2408 if (Is.string(type)) {
2409 notificationHandlers[type] = { type: undefined, handler };
2412 notificationHandlers[type.method] = { type, handler };
2416 onProgress: (_type, token, handler) => {
2417 if (progressHandlers.has(token)) {
2418 throw new Error(`Progress handler for token ${token} already registered`);
2420 progressHandlers.set(token, handler);
2423 progressHandlers.delete(token);
2427 sendProgress: (_type, token, value) => {
2428 connection.sendNotification(ProgressNotification.type, { token, value });
2430 onUnhandledProgress: unhandledProgressEmitter.event,
2431 sendRequest: (type, ...params) => {
2432 throwIfClosedOrDisposed();
2433 throwIfNotListening();
2436 let token = undefined;
2437 if (Is.string(type)) {
2439 switch (params.length) {
2441 messageParams = null;
2444 // The cancellation token is optional so it can also be undefined.
2445 if (cancellation_1.CancellationToken.is(params[0])) {
2446 messageParams = null;
2450 messageParams = undefinedToNull(params[0]);
2454 const last = params.length - 1;
2455 if (cancellation_1.CancellationToken.is(params[last])) {
2456 token = params[last];
2457 if (params.length === 2) {
2458 messageParams = undefinedToNull(params[0]);
2461 messageParams = params.slice(0, last).map(value => undefinedToNull(value));
2465 messageParams = params.map(value => undefinedToNull(value));
2471 method = type.method;
2472 messageParams = computeMessageParams(type, params);
2473 const numberOfParams = type.numberOfParams;
2474 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
2476 const id = sequenceNumber++;
2479 disposable = token.onCancellationRequested(() => {
2480 cancellationStrategy.sender.sendCancellation(connection, id);
2483 const result = new Promise((resolve, reject) => {
2484 const requestMessage = {
2488 params: messageParams
2490 const resolveWithCleanup = (r) => {
2492 cancellationStrategy.sender.cleanup(id);
2493 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2495 const rejectWithCleanup = (r) => {
2497 cancellationStrategy.sender.cleanup(id);
2498 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2500 let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
2501 traceSendingRequest(requestMessage);
2503 messageWriter.write(requestMessage);
2506 // Writing the message failed. So we need to reject the promise.
2507 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
2508 responsePromise = null;
2510 if (responsePromise) {
2511 responsePromises[String(id)] = responsePromise;
2516 onRequest: (type, handler) => {
2517 throwIfClosedOrDisposed();
2518 if (Is.func(type)) {
2519 starRequestHandler = type;
2522 if (Is.string(type)) {
2523 requestHandlers[type] = { type: undefined, handler };
2526 requestHandlers[type.method] = { type, handler };
2530 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
2531 let _sendNotification = false;
2532 let _traceFormat = TraceFormat.Text;
2533 if (sendNotificationOrTraceOptions !== undefined) {
2534 if (Is.boolean(sendNotificationOrTraceOptions)) {
2535 _sendNotification = sendNotificationOrTraceOptions;
2538 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2539 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2543 traceFormat = _traceFormat;
2544 if (trace === Trace.Off) {
2550 if (_sendNotification && !isClosed() && !isDisposed()) {
2551 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
2554 onError: errorEmitter.event,
2555 onClose: closeEmitter.event,
2556 onUnhandledNotification: unhandledNotificationEmitter.event,
2557 onDispose: disposeEmitter.event,
2562 state = ConnectionState.Disposed;
2563 disposeEmitter.fire(undefined);
2564 const error = new Error('Connection got disposed.');
2565 Object.keys(responsePromises).forEach((key) => {
2566 responsePromises[key].reject(error);
2568 responsePromises = Object.create(null);
2569 requestTokens = Object.create(null);
2570 messageQueue = new linkedMap_1.LinkedMap();
2571 // Test for backwards compatibility
2572 if (Is.func(messageWriter.dispose)) {
2573 messageWriter.dispose();
2575 if (Is.func(messageReader.dispose)) {
2576 messageReader.dispose();
2580 throwIfClosedOrDisposed();
2582 state = ConnectionState.Listening;
2583 messageReader.listen(callback);
2586 // eslint-disable-next-line no-console
2587 ral_1.default().console.log('inspect');
2590 connection.onNotification(LogTraceNotification.type, (params) => {
2591 if (trace === Trace.Off || !tracer) {
2594 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
2596 connection.onNotification(ProgressNotification.type, (params) => {
2597 const handler = progressHandlers.get(params.token);
2599 handler(params.value);
2602 unhandledProgressEmitter.fire(params);
2607 exports.createMessageConnection = createMessageConnection;
2608 //# sourceMappingURL=connection.js.map
2612 /***/ ((__unused_webpack_module, exports) => {
2615 /*---------------------------------------------------------------------------------------------
2616 * Copyright (c) Microsoft Corporation. All rights reserved.
2617 * Licensed under the MIT License. See License.txt in the project root for license information.
2618 *--------------------------------------------------------------------------------------------*/
2619 Object.defineProperty(exports, "__esModule", ({ value: true }));
2624 Touch.AsOld = Touch.First;
2626 Touch.AsNew = Touch.Last;
2627 })(Touch = exports.Touch || (exports.Touch = {}));
2630 this[Symbol.toStringTag] = 'LinkedMap';
2631 this._map = new Map();
2632 this._head = undefined;
2633 this._tail = undefined;
2639 this._head = undefined;
2640 this._tail = undefined;
2645 return !this._head && !this._tail;
2652 return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
2656 return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
2659 return this._map.has(key);
2661 get(key, touch = Touch.None) {
2662 const item = this._map.get(key);
2666 if (touch !== Touch.None) {
2667 this.touch(item, touch);
2671 set(key, value, touch = Touch.None) {
2672 let item = this._map.get(key);
2675 if (touch !== Touch.None) {
2676 this.touch(item, touch);
2680 item = { key, value, next: undefined, previous: undefined };
2683 this.addItemLast(item);
2686 this.addItemFirst(item);
2689 this.addItemLast(item);
2692 this.addItemLast(item);
2695 this._map.set(key, item);
2701 return !!this.remove(key);
2704 const item = this._map.get(key);
2708 this._map.delete(key);
2709 this.removeItem(item);
2714 if (!this._head && !this._tail) {
2717 if (!this._head || !this._tail) {
2718 throw new Error('Invalid list');
2720 const item = this._head;
2721 this._map.delete(item.key);
2722 this.removeItem(item);
2726 forEach(callbackfn, thisArg) {
2727 const state = this._state;
2728 let current = this._head;
2731 callbackfn.bind(thisArg)(current.value, current.key, this);
2734 callbackfn(current.value, current.key, this);
2736 if (this._state !== state) {
2737 throw new Error(`LinkedMap got modified during iteration.`);
2739 current = current.next;
2744 const state = this._state;
2745 let current = this._head;
2747 [Symbol.iterator]() {
2751 if (map._state !== state) {
2752 throw new Error(`LinkedMap got modified during iteration.`);
2755 const result = { value: current.key, done: false };
2756 current = current.next;
2760 return { value: undefined, done: true };
2768 const state = this._state;
2769 let current = this._head;
2771 [Symbol.iterator]() {
2775 if (map._state !== state) {
2776 throw new Error(`LinkedMap got modified during iteration.`);
2779 const result = { value: current.value, done: false };
2780 current = current.next;
2784 return { value: undefined, done: true };
2792 const state = this._state;
2793 let current = this._head;
2795 [Symbol.iterator]() {
2799 if (map._state !== state) {
2800 throw new Error(`LinkedMap got modified during iteration.`);
2803 const result = { value: [current.key, current.value], done: false };
2804 current = current.next;
2808 return { value: undefined, done: true };
2814 [Symbol.iterator]() {
2815 return this.entries();
2818 if (newSize >= this.size) {
2821 if (newSize === 0) {
2825 let current = this._head;
2826 let currentSize = this.size;
2827 while (current && currentSize > newSize) {
2828 this._map.delete(current.key);
2829 current = current.next;
2832 this._head = current;
2833 this._size = currentSize;
2835 current.previous = undefined;
2839 addItemFirst(item) {
2840 // First time Insert
2841 if (!this._head && !this._tail) {
2844 else if (!this._head) {
2845 throw new Error('Invalid list');
2848 item.next = this._head;
2849 this._head.previous = item;
2855 // First time Insert
2856 if (!this._head && !this._tail) {
2859 else if (!this._tail) {
2860 throw new Error('Invalid list');
2863 item.previous = this._tail;
2864 this._tail.next = item;
2870 if (item === this._head && item === this._tail) {
2871 this._head = undefined;
2872 this._tail = undefined;
2874 else if (item === this._head) {
2875 // This can only happend if size === 1 which is handle
2876 // by the case above.
2878 throw new Error('Invalid list');
2880 item.next.previous = undefined;
2881 this._head = item.next;
2883 else if (item === this._tail) {
2884 // This can only happend if size === 1 which is handle
2885 // by the case above.
2886 if (!item.previous) {
2887 throw new Error('Invalid list');
2889 item.previous.next = undefined;
2890 this._tail = item.previous;
2893 const next = item.next;
2894 const previous = item.previous;
2895 if (!next || !previous) {
2896 throw new Error('Invalid list');
2898 next.previous = previous;
2899 previous.next = next;
2901 item.next = undefined;
2902 item.previous = undefined;
2905 touch(item, touch) {
2906 if (!this._head || !this._tail) {
2907 throw new Error('Invalid list');
2909 if ((touch !== Touch.First && touch !== Touch.Last)) {
2912 if (touch === Touch.First) {
2913 if (item === this._head) {
2916 const next = item.next;
2917 const previous = item.previous;
2919 if (item === this._tail) {
2920 // previous must be defined since item was not head but is tail
2921 // So there are more than on item in the map
2922 previous.next = undefined;
2923 this._tail = previous;
2926 // Both next and previous are not undefined since item was neither head nor tail.
2927 next.previous = previous;
2928 previous.next = next;
2930 // Insert the node at head
2931 item.previous = undefined;
2932 item.next = this._head;
2933 this._head.previous = item;
2937 else if (touch === Touch.Last) {
2938 if (item === this._tail) {
2941 const next = item.next;
2942 const previous = item.previous;
2944 if (item === this._head) {
2945 // next must be defined since item was not tail but is head
2946 // So there are more than on item in the map
2947 next.previous = undefined;
2951 // Both next and previous are not undefined since item was neither head nor tail.
2952 next.previous = previous;
2953 previous.next = next;
2955 item.next = undefined;
2956 item.previous = this._tail;
2957 this._tail.next = item;
2964 this.forEach((value, key) => {
2965 data.push([key, value]);
2971 for (const [key, value] of data) {
2972 this.set(key, value);
2976 exports.LinkedMap = LinkedMap;
2977 class LRUCache extends LinkedMap {
2978 constructor(limit, ratio = 1) {
2980 this._limit = limit;
2981 this._ratio = Math.min(Math.max(0, ratio), 1);
2987 this._limit = limit;
2994 this._ratio = Math.min(Math.max(0, ratio), 1);
2997 get(key, touch = Touch.AsNew) {
2998 return super.get(key, touch);
3001 return super.get(key, Touch.None);
3004 super.set(key, value, Touch.Last);
3009 if (this.size > this._limit) {
3010 this.trimOld(Math.round(this._limit * this._ratio));
3014 exports.LRUCache = LRUCache;
3015 //# sourceMappingURL=linkedMap.js.map
3019 /***/ ((module) => {
3021 module.exports = require("os");;
3025 /***/ ((module) => {
3027 module.exports = require("crypto");;
3031 /***/ ((module) => {
3033 module.exports = require("net");;
3037 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3040 /* --------------------------------------------------------------------------------------------
3041 * Copyright (c) Microsoft Corporation. All rights reserved.
3042 * Licensed under the MIT License. See License.txt in the project root for license information.
3043 * ------------------------------------------------------------------------------------------ */
3044 function __export(m) {
3045 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
3047 Object.defineProperty(exports, "__esModule", ({ value: true }));
3048 __export(__webpack_require__(6));
3049 __export(__webpack_require__(25));
3050 __export(__webpack_require__(26));
3051 __export(__webpack_require__(27));
3052 var connection_1 = __webpack_require__(39);
3053 exports.createProtocolConnection = connection_1.createProtocolConnection;
3054 const st = __webpack_require__(40);
3056 (function (Proposed) {
3057 Proposed.SemanticTokenTypes = st.SemanticTokenTypes;
3058 Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;
3059 Proposed.SemanticTokens = st.SemanticTokens;
3060 let SemanticTokensRequest;
3061 (function (SemanticTokensRequest) {
3062 SemanticTokensRequest.method = st.SemanticTokensRequest.method;
3063 SemanticTokensRequest.type = st.SemanticTokensRequest.type;
3064 })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));
3065 let SemanticTokensEditsRequest;
3066 (function (SemanticTokensEditsRequest) {
3067 SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;
3068 SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;
3069 })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));
3070 let SemanticTokensRangeRequest;
3071 (function (SemanticTokensRangeRequest) {
3072 SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;
3073 SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;
3074 })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));
3075 })(Proposed = exports.Proposed || (exports.Proposed = {}));
3076 //# sourceMappingURL=api.js.map
3080 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3082 __webpack_require__.r(__webpack_exports__);
3083 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3084 /* harmony export */ "Position": () => /* binding */ Position,
3085 /* harmony export */ "Range": () => /* binding */ Range,
3086 /* harmony export */ "Location": () => /* binding */ Location,
3087 /* harmony export */ "LocationLink": () => /* binding */ LocationLink,
3088 /* harmony export */ "Color": () => /* binding */ Color,
3089 /* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
3090 /* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
3091 /* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
3092 /* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
3093 /* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
3094 /* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
3095 /* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
3096 /* harmony export */ "DiagnosticCode": () => /* binding */ DiagnosticCode,
3097 /* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
3098 /* harmony export */ "Command": () => /* binding */ Command,
3099 /* harmony export */ "TextEdit": () => /* binding */ TextEdit,
3100 /* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
3101 /* harmony export */ "CreateFile": () => /* binding */ CreateFile,
3102 /* harmony export */ "RenameFile": () => /* binding */ RenameFile,
3103 /* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
3104 /* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
3105 /* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
3106 /* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
3107 /* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
3108 /* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
3109 /* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
3110 /* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
3111 /* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
3112 /* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
3113 /* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
3114 /* harmony export */ "InsertReplaceEdit": () => /* binding */ InsertReplaceEdit,
3115 /* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
3116 /* harmony export */ "CompletionList": () => /* binding */ CompletionList,
3117 /* harmony export */ "MarkedString": () => /* binding */ MarkedString,
3118 /* harmony export */ "Hover": () => /* binding */ Hover,
3119 /* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
3120 /* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
3121 /* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
3122 /* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
3123 /* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
3124 /* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
3125 /* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
3126 /* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
3127 /* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
3128 /* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
3129 /* harmony export */ "CodeAction": () => /* binding */ CodeAction,
3130 /* harmony export */ "CodeLens": () => /* binding */ CodeLens,
3131 /* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
3132 /* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
3133 /* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
3134 /* harmony export */ "EOL": () => /* binding */ EOL,
3135 /* harmony export */ "TextDocument": () => /* binding */ TextDocument
3136 /* harmony export */ });
3137 /* --------------------------------------------------------------------------------------------
3138 * Copyright (c) Microsoft Corporation. All rights reserved.
3139 * Licensed under the MIT License. See License.txt in the project root for license information.
3140 * ------------------------------------------------------------------------------------------ */
3143 * The Position namespace provides helper functions to work with
3144 * [Position](#Position) literals.
3147 (function (Position) {
3149 * Creates a new Position literal from the given line and character.
3150 * @param line The position's line.
3151 * @param character The position's character.
3153 function create(line, character) {
3154 return { line: line, character: character };
3156 Position.create = create;
3158 * Checks whether the given liternal conforms to the [Position](#Position) interface.
3160 function is(value) {
3161 var candidate = value;
3162 return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);
3165 })(Position || (Position = {}));
3167 * The Range namespace provides helper functions to work with
3168 * [Range](#Range) literals.
3172 function create(one, two, three, four) {
3173 if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {
3174 return { start: Position.create(one, two), end: Position.create(three, four) };
3176 else if (Position.is(one) && Position.is(two)) {
3177 return { start: one, end: two };
3180 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
3183 Range.create = create;
3185 * Checks whether the given literal conforms to the [Range](#Range) interface.
3187 function is(value) {
3188 var candidate = value;
3189 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
3192 })(Range || (Range = {}));
3194 * The Location namespace provides helper functions to work with
3195 * [Location](#Location) literals.
3198 (function (Location) {
3200 * Creates a Location literal.
3201 * @param uri The location's uri.
3202 * @param range The location's range.
3204 function create(uri, range) {
3205 return { uri: uri, range: range };
3207 Location.create = create;
3209 * Checks whether the given literal conforms to the [Location](#Location) interface.
3211 function is(value) {
3212 var candidate = value;
3213 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3216 })(Location || (Location = {}));
3218 * The LocationLink namespace provides helper functions to work with
3219 * [LocationLink](#LocationLink) literals.
3222 (function (LocationLink) {
3224 * Creates a LocationLink literal.
3225 * @param targetUri The definition's uri.
3226 * @param targetRange The full range of the definition.
3227 * @param targetSelectionRange The span of the symbol definition at the target.
3228 * @param originSelectionRange The span of the symbol being defined in the originating source file.
3230 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
3231 return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
3233 LocationLink.create = create;
3235 * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
3237 function is(value) {
3238 var candidate = value;
3239 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
3240 && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
3241 && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3243 LocationLink.is = is;
3244 })(LocationLink || (LocationLink = {}));
3246 * The Color namespace provides helper functions to work with
3247 * [Color](#Color) literals.
3252 * Creates a new Color literal.
3254 function create(red, green, blue, alpha) {
3262 Color.create = create;
3264 * Checks whether the given literal conforms to the [Color](#Color) interface.
3266 function is(value) {
3267 var candidate = value;
3268 return Is.number(candidate.red)
3269 && Is.number(candidate.green)
3270 && Is.number(candidate.blue)
3271 && Is.number(candidate.alpha);
3274 })(Color || (Color = {}));
3276 * The ColorInformation namespace provides helper functions to work with
3277 * [ColorInformation](#ColorInformation) literals.
3279 var ColorInformation;
3280 (function (ColorInformation) {
3282 * Creates a new ColorInformation literal.
3284 function create(range, color) {
3290 ColorInformation.create = create;
3292 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
3294 function is(value) {
3295 var candidate = value;
3296 return Range.is(candidate.range) && Color.is(candidate.color);
3298 ColorInformation.is = is;
3299 })(ColorInformation || (ColorInformation = {}));
3301 * The Color namespace provides helper functions to work with
3302 * [ColorPresentation](#ColorPresentation) literals.
3304 var ColorPresentation;
3305 (function (ColorPresentation) {
3307 * Creates a new ColorInformation literal.
3309 function create(label, textEdit, additionalTextEdits) {
3313 additionalTextEdits: additionalTextEdits,
3316 ColorPresentation.create = create;
3318 * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
3320 function is(value) {
3321 var candidate = value;
3322 return Is.string(candidate.label)
3323 && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
3324 && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
3326 ColorPresentation.is = is;
3327 })(ColorPresentation || (ColorPresentation = {}));
3329 * Enum of known range kinds
3331 var FoldingRangeKind;
3332 (function (FoldingRangeKind) {
3334 * Folding range for a comment
3336 FoldingRangeKind["Comment"] = "comment";
3338 * Folding range for a imports or includes
3340 FoldingRangeKind["Imports"] = "imports";
3342 * Folding range for a region (e.g. `#region`)
3344 FoldingRangeKind["Region"] = "region";
3345 })(FoldingRangeKind || (FoldingRangeKind = {}));
3347 * The folding range namespace provides helper functions to work with
3348 * [FoldingRange](#FoldingRange) literals.
3351 (function (FoldingRange) {
3353 * Creates a new FoldingRange literal.
3355 function create(startLine, endLine, startCharacter, endCharacter, kind) {
3357 startLine: startLine,
3360 if (Is.defined(startCharacter)) {
3361 result.startCharacter = startCharacter;
3363 if (Is.defined(endCharacter)) {
3364 result.endCharacter = endCharacter;
3366 if (Is.defined(kind)) {
3371 FoldingRange.create = create;
3373 * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
3375 function is(value) {
3376 var candidate = value;
3377 return Is.number(candidate.startLine) && Is.number(candidate.startLine)
3378 && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))
3379 && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))
3380 && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
3382 FoldingRange.is = is;
3383 })(FoldingRange || (FoldingRange = {}));
3385 * The DiagnosticRelatedInformation namespace provides helper functions to work with
3386 * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
3388 var DiagnosticRelatedInformation;
3389 (function (DiagnosticRelatedInformation) {
3391 * Creates a new DiagnosticRelatedInformation literal.
3393 function create(location, message) {
3399 DiagnosticRelatedInformation.create = create;
3401 * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
3403 function is(value) {
3404 var candidate = value;
3405 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
3407 DiagnosticRelatedInformation.is = is;
3408 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
3410 * The diagnostic's severity.
3412 var DiagnosticSeverity;
3413 (function (DiagnosticSeverity) {
3417 DiagnosticSeverity.Error = 1;
3419 * Reports a warning.
3421 DiagnosticSeverity.Warning = 2;
3423 * Reports an information.
3425 DiagnosticSeverity.Information = 3;
3429 DiagnosticSeverity.Hint = 4;
3430 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
3432 * The diagnostic tags.
3437 (function (DiagnosticTag) {
3439 * Unused or unnecessary code.
3441 * Clients are allowed to render diagnostics with this tag faded out instead of having
3442 * an error squiggle.
3444 DiagnosticTag.Unnecessary = 1;
3446 * Deprecated or obsolete code.
3448 * Clients are allowed to rendered diagnostics with this tag strike through.
3450 DiagnosticTag.Deprecated = 2;
3451 })(DiagnosticTag || (DiagnosticTag = {}));
3453 * The DiagnosticCode namespace provides functions to deal with complex diagnostic codes.
3455 * @since 3.16.0 - Proposed state
3458 (function (DiagnosticCode) {
3460 * Checks whether the given liternal conforms to the [DiagnosticCode](#DiagnosticCode) interface.
3462 function is(value) {
3463 var candidate = value;
3464 return candidate !== undefined && candidate !== null && (Is.number(candidate.value) || Is.string(candidate.value)) && Is.string(candidate.target);
3466 DiagnosticCode.is = is;
3467 })(DiagnosticCode || (DiagnosticCode = {}));
3469 * The Diagnostic namespace provides helper functions to work with
3470 * [Diagnostic](#Diagnostic) literals.
3473 (function (Diagnostic) {
3475 * Creates a new Diagnostic literal.
3477 function create(range, message, severity, code, source, relatedInformation) {
3478 var result = { range: range, message: message };
3479 if (Is.defined(severity)) {
3480 result.severity = severity;
3482 if (Is.defined(code)) {
3485 if (Is.defined(source)) {
3486 result.source = source;
3488 if (Is.defined(relatedInformation)) {
3489 result.relatedInformation = relatedInformation;
3493 Diagnostic.create = create;
3495 * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
3497 function is(value) {
3498 var candidate = value;
3499 return Is.defined(candidate)
3500 && Range.is(candidate.range)
3501 && Is.string(candidate.message)
3502 && (Is.number(candidate.severity) || Is.undefined(candidate.severity))
3503 && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
3504 && (Is.string(candidate.source) || Is.undefined(candidate.source))
3505 && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
3508 })(Diagnostic || (Diagnostic = {}));
3510 * The Command namespace provides helper functions to work with
3511 * [Command](#Command) literals.
3514 (function (Command) {
3516 * Creates a new Command literal.
3518 function create(title, command) {
3520 for (var _i = 2; _i < arguments.length; _i++) {
3521 args[_i - 2] = arguments[_i];
3523 var result = { title: title, command: command };
3524 if (Is.defined(args) && args.length > 0) {
3525 result.arguments = args;
3529 Command.create = create;
3531 * Checks whether the given literal conforms to the [Command](#Command) interface.
3533 function is(value) {
3534 var candidate = value;
3535 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
3538 })(Command || (Command = {}));
3540 * The TextEdit namespace provides helper function to create replace,
3541 * insert and delete edits more easily.
3544 (function (TextEdit) {
3546 * Creates a replace text edit.
3547 * @param range The range of text to be replaced.
3548 * @param newText The new text.
3550 function replace(range, newText) {
3551 return { range: range, newText: newText };
3553 TextEdit.replace = replace;
3555 * Creates a insert text edit.
3556 * @param position The position to insert the text at.
3557 * @param newText The text to be inserted.
3559 function insert(position, newText) {
3560 return { range: { start: position, end: position }, newText: newText };
3562 TextEdit.insert = insert;
3564 * Creates a delete text edit.
3565 * @param range The range of text to be deleted.
3567 function del(range) {
3568 return { range: range, newText: '' };
3571 function is(value) {
3572 var candidate = value;
3573 return Is.objectLiteral(candidate)
3574 && Is.string(candidate.newText)
3575 && Range.is(candidate.range);
3578 })(TextEdit || (TextEdit = {}));
3580 * The TextDocumentEdit namespace provides helper function to create
3581 * an edit that manipulates a text document.
3583 var TextDocumentEdit;
3584 (function (TextDocumentEdit) {
3586 * Creates a new `TextDocumentEdit`
3588 function create(textDocument, edits) {
3589 return { textDocument: textDocument, edits: edits };
3591 TextDocumentEdit.create = create;
3592 function is(value) {
3593 var candidate = value;
3594 return Is.defined(candidate)
3595 && VersionedTextDocumentIdentifier.is(candidate.textDocument)
3596 && Array.isArray(candidate.edits);
3598 TextDocumentEdit.is = is;
3599 })(TextDocumentEdit || (TextDocumentEdit = {}));
3601 (function (CreateFile) {
3602 function create(uri, options) {
3607 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3608 result.options = options;
3612 CreateFile.create = create;
3613 function is(value) {
3614 var candidate = value;
3615 return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&
3616 (candidate.options === void 0 ||
3617 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
3620 })(CreateFile || (CreateFile = {}));
3622 (function (RenameFile) {
3623 function create(oldUri, newUri, options) {
3629 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3630 result.options = options;
3634 RenameFile.create = create;
3635 function is(value) {
3636 var candidate = value;
3637 return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&
3638 (candidate.options === void 0 ||
3639 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));
3642 })(RenameFile || (RenameFile = {}));
3644 (function (DeleteFile) {
3645 function create(uri, options) {
3650 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
3651 result.options = options;
3655 DeleteFile.create = create;
3656 function is(value) {
3657 var candidate = value;
3658 return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&
3659 (candidate.options === void 0 ||
3660 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));
3663 })(DeleteFile || (DeleteFile = {}));
3665 (function (WorkspaceEdit) {
3666 function is(value) {
3667 var candidate = value;
3669 (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&
3670 (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {
3671 if (Is.string(change.kind)) {
3672 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
3675 return TextDocumentEdit.is(change);
3679 WorkspaceEdit.is = is;
3680 })(WorkspaceEdit || (WorkspaceEdit = {}));
3681 var TextEditChangeImpl = /** @class */ (function () {
3682 function TextEditChangeImpl(edits) {
3685 TextEditChangeImpl.prototype.insert = function (position, newText) {
3686 this.edits.push(TextEdit.insert(position, newText));
3688 TextEditChangeImpl.prototype.replace = function (range, newText) {
3689 this.edits.push(TextEdit.replace(range, newText));
3691 TextEditChangeImpl.prototype.delete = function (range) {
3692 this.edits.push(TextEdit.del(range));
3694 TextEditChangeImpl.prototype.add = function (edit) {
3695 this.edits.push(edit);
3697 TextEditChangeImpl.prototype.all = function () {
3700 TextEditChangeImpl.prototype.clear = function () {
3701 this.edits.splice(0, this.edits.length);
3703 return TextEditChangeImpl;
3706 * A workspace change helps constructing changes to a workspace.
3708 var WorkspaceChange = /** @class */ (function () {
3709 function WorkspaceChange(workspaceEdit) {
3711 this._textEditChanges = Object.create(null);
3712 if (workspaceEdit) {
3713 this._workspaceEdit = workspaceEdit;
3714 if (workspaceEdit.documentChanges) {
3715 workspaceEdit.documentChanges.forEach(function (change) {
3716 if (TextDocumentEdit.is(change)) {
3717 var textEditChange = new TextEditChangeImpl(change.edits);
3718 _this._textEditChanges[change.textDocument.uri] = textEditChange;
3722 else if (workspaceEdit.changes) {
3723 Object.keys(workspaceEdit.changes).forEach(function (key) {
3724 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
3725 _this._textEditChanges[key] = textEditChange;
3730 Object.defineProperty(WorkspaceChange.prototype, "edit", {
3732 * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
3733 * use to be returned from a workspace edit operation like rename.
3736 if (this._workspaceEdit === undefined) {
3737 return { documentChanges: [] };
3739 return this._workspaceEdit;
3744 WorkspaceChange.prototype.getTextEditChange = function (key) {
3745 if (VersionedTextDocumentIdentifier.is(key)) {
3746 if (!this._workspaceEdit) {
3747 this._workspaceEdit = {
3751 if (!this._workspaceEdit.documentChanges) {
3752 throw new Error('Workspace edit is not configured for document changes.');
3754 var textDocument = key;
3755 var result = this._textEditChanges[textDocument.uri];
3758 var textDocumentEdit = {
3759 textDocument: textDocument,
3762 this._workspaceEdit.documentChanges.push(textDocumentEdit);
3763 result = new TextEditChangeImpl(edits);
3764 this._textEditChanges[textDocument.uri] = result;
3769 if (!this._workspaceEdit) {
3770 this._workspaceEdit = {
3771 changes: Object.create(null)
3774 if (!this._workspaceEdit.changes) {
3775 throw new Error('Workspace edit is not configured for normal text edit changes.');
3777 var result = this._textEditChanges[key];
3780 this._workspaceEdit.changes[key] = edits;
3781 result = new TextEditChangeImpl(edits);
3782 this._textEditChanges[key] = result;
3787 WorkspaceChange.prototype.createFile = function (uri, options) {
3788 this.checkDocumentChanges();
3789 this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));
3791 WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {
3792 this.checkDocumentChanges();
3793 this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));
3795 WorkspaceChange.prototype.deleteFile = function (uri, options) {
3796 this.checkDocumentChanges();
3797 this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));
3799 WorkspaceChange.prototype.checkDocumentChanges = function () {
3800 if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {
3801 throw new Error('Workspace edit is not configured for document changes.');
3804 return WorkspaceChange;
3808 * The TextDocumentIdentifier namespace provides helper functions to work with
3809 * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
3811 var TextDocumentIdentifier;
3812 (function (TextDocumentIdentifier) {
3814 * Creates a new TextDocumentIdentifier literal.
3815 * @param uri The document's uri.
3817 function create(uri) {
3818 return { uri: uri };
3820 TextDocumentIdentifier.create = create;
3822 * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
3824 function is(value) {
3825 var candidate = value;
3826 return Is.defined(candidate) && Is.string(candidate.uri);
3828 TextDocumentIdentifier.is = is;
3829 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
3831 * The VersionedTextDocumentIdentifier namespace provides helper functions to work with
3832 * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
3834 var VersionedTextDocumentIdentifier;
3835 (function (VersionedTextDocumentIdentifier) {
3837 * Creates a new VersionedTextDocumentIdentifier literal.
3838 * @param uri The document's uri.
3839 * @param uri The document's text.
3841 function create(uri, version) {
3842 return { uri: uri, version: version };
3844 VersionedTextDocumentIdentifier.create = create;
3846 * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
3848 function is(value) {
3849 var candidate = value;
3850 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));
3852 VersionedTextDocumentIdentifier.is = is;
3853 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
3855 * The TextDocumentItem namespace provides helper functions to work with
3856 * [TextDocumentItem](#TextDocumentItem) literals.
3858 var TextDocumentItem;
3859 (function (TextDocumentItem) {
3861 * Creates a new TextDocumentItem literal.
3862 * @param uri The document's uri.
3863 * @param languageId The document's language identifier.
3864 * @param version The document's version number.
3865 * @param text The document's text.
3867 function create(uri, languageId, version, text) {
3868 return { uri: uri, languageId: languageId, version: version, text: text };
3870 TextDocumentItem.create = create;
3872 * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
3874 function is(value) {
3875 var candidate = value;
3876 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);
3878 TextDocumentItem.is = is;
3879 })(TextDocumentItem || (TextDocumentItem = {}));
3881 * Describes the content type that a client supports in various
3882 * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
3884 * Please note that `MarkupKinds` must not start with a `$`. This kinds
3885 * are reserved for internal usage.
3888 (function (MarkupKind) {
3890 * Plain text is supported as a content format
3892 MarkupKind.PlainText = 'plaintext';
3894 * Markdown is supported as a content format
3896 MarkupKind.Markdown = 'markdown';
3897 })(MarkupKind || (MarkupKind = {}));
3898 (function (MarkupKind) {
3900 * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
3902 function is(value) {
3903 var candidate = value;
3904 return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
3907 })(MarkupKind || (MarkupKind = {}));
3909 (function (MarkupContent) {
3911 * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
3913 function is(value) {
3914 var candidate = value;
3915 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
3917 MarkupContent.is = is;
3918 })(MarkupContent || (MarkupContent = {}));
3920 * The kind of a completion entry.
3922 var CompletionItemKind;
3923 (function (CompletionItemKind) {
3924 CompletionItemKind.Text = 1;
3925 CompletionItemKind.Method = 2;
3926 CompletionItemKind.Function = 3;
3927 CompletionItemKind.Constructor = 4;
3928 CompletionItemKind.Field = 5;
3929 CompletionItemKind.Variable = 6;
3930 CompletionItemKind.Class = 7;
3931 CompletionItemKind.Interface = 8;
3932 CompletionItemKind.Module = 9;
3933 CompletionItemKind.Property = 10;
3934 CompletionItemKind.Unit = 11;
3935 CompletionItemKind.Value = 12;
3936 CompletionItemKind.Enum = 13;
3937 CompletionItemKind.Keyword = 14;
3938 CompletionItemKind.Snippet = 15;
3939 CompletionItemKind.Color = 16;
3940 CompletionItemKind.File = 17;
3941 CompletionItemKind.Reference = 18;
3942 CompletionItemKind.Folder = 19;
3943 CompletionItemKind.EnumMember = 20;
3944 CompletionItemKind.Constant = 21;
3945 CompletionItemKind.Struct = 22;
3946 CompletionItemKind.Event = 23;
3947 CompletionItemKind.Operator = 24;
3948 CompletionItemKind.TypeParameter = 25;
3949 })(CompletionItemKind || (CompletionItemKind = {}));
3951 * Defines whether the insert text in a completion item should be interpreted as
3952 * plain text or a snippet.
3954 var InsertTextFormat;
3955 (function (InsertTextFormat) {
3957 * The primary text to be inserted is treated as a plain string.
3959 InsertTextFormat.PlainText = 1;
3961 * The primary text to be inserted is treated as a snippet.
3963 * A snippet can define tab stops and placeholders with `$1`, `$2`
3964 * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
3965 * the end of the snippet. Placeholders with equal identifiers are linked,
3966 * that is typing in one will update others too.
3968 * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
3970 InsertTextFormat.Snippet = 2;
3971 })(InsertTextFormat || (InsertTextFormat = {}));
3973 * Completion item tags are extra annotations that tweak the rendering of a completion
3978 var CompletionItemTag;
3979 (function (CompletionItemTag) {
3981 * Render a completion as obsolete, usually using a strike-out.
3983 CompletionItemTag.Deprecated = 1;
3984 })(CompletionItemTag || (CompletionItemTag = {}));
3986 * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
3988 * @since 3.16.0 - Proposed state
3990 var InsertReplaceEdit;
3991 (function (InsertReplaceEdit) {
3993 * Creates a new insert / replace edit
3995 function create(newText, insert, replace) {
3996 return { newText: newText, insert: insert, replace: replace };
3998 InsertReplaceEdit.create = create;
4000 * Checks whether the given liternal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
4002 function is(value) {
4003 var candidate = value;
4004 return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
4006 InsertReplaceEdit.is = is;
4007 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
4009 * The CompletionItem namespace provides functions to deal with
4013 (function (CompletionItem) {
4015 * Create a completion item and seed it with a label.
4016 * @param label The completion item's label
4018 function create(label) {
4019 return { label: label };
4021 CompletionItem.create = create;
4022 })(CompletionItem || (CompletionItem = {}));
4024 * The CompletionList namespace provides functions to deal with
4028 (function (CompletionList) {
4030 * Creates a new completion list.
4032 * @param items The completion items.
4033 * @param isIncomplete The list is not complete.
4035 function create(items, isIncomplete) {
4036 return { items: items ? items : [], isIncomplete: !!isIncomplete };
4038 CompletionList.create = create;
4039 })(CompletionList || (CompletionList = {}));
4041 (function (MarkedString) {
4043 * Creates a marked string from plain text.
4045 * @param plainText The plain text.
4047 function fromPlainText(plainText) {
4048 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
4050 MarkedString.fromPlainText = fromPlainText;
4052 * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
4054 function is(value) {
4055 var candidate = value;
4056 return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
4058 MarkedString.is = is;
4059 })(MarkedString || (MarkedString = {}));
4063 * Checks whether the given value conforms to the [Hover](#Hover) interface.
4065 function is(value) {
4066 var candidate = value;
4067 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
4068 MarkedString.is(candidate.contents) ||
4069 Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
4072 })(Hover || (Hover = {}));
4074 * The ParameterInformation namespace provides helper functions to work with
4075 * [ParameterInformation](#ParameterInformation) literals.
4077 var ParameterInformation;
4078 (function (ParameterInformation) {
4080 * Creates a new parameter information literal.
4082 * @param label A label string.
4083 * @param documentation A doc string.
4085 function create(label, documentation) {
4086 return documentation ? { label: label, documentation: documentation } : { label: label };
4088 ParameterInformation.create = create;
4089 })(ParameterInformation || (ParameterInformation = {}));
4091 * The SignatureInformation namespace provides helper functions to work with
4092 * [SignatureInformation](#SignatureInformation) literals.
4094 var SignatureInformation;
4095 (function (SignatureInformation) {
4096 function create(label, documentation) {
4097 var parameters = [];
4098 for (var _i = 2; _i < arguments.length; _i++) {
4099 parameters[_i - 2] = arguments[_i];
4101 var result = { label: label };
4102 if (Is.defined(documentation)) {
4103 result.documentation = documentation;
4105 if (Is.defined(parameters)) {
4106 result.parameters = parameters;
4109 result.parameters = [];
4113 SignatureInformation.create = create;
4114 })(SignatureInformation || (SignatureInformation = {}));
4116 * A document highlight kind.
4118 var DocumentHighlightKind;
4119 (function (DocumentHighlightKind) {
4121 * A textual occurrence.
4123 DocumentHighlightKind.Text = 1;
4125 * Read-access of a symbol, like reading a variable.
4127 DocumentHighlightKind.Read = 2;
4129 * Write-access of a symbol, like writing to a variable.
4131 DocumentHighlightKind.Write = 3;
4132 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
4134 * DocumentHighlight namespace to provide helper functions to work with
4135 * [DocumentHighlight](#DocumentHighlight) literals.
4137 var DocumentHighlight;
4138 (function (DocumentHighlight) {
4140 * Create a DocumentHighlight object.
4141 * @param range The range the highlight applies to.
4143 function create(range, kind) {
4144 var result = { range: range };
4145 if (Is.number(kind)) {
4150 DocumentHighlight.create = create;
4151 })(DocumentHighlight || (DocumentHighlight = {}));
4156 (function (SymbolKind) {
4157 SymbolKind.File = 1;
4158 SymbolKind.Module = 2;
4159 SymbolKind.Namespace = 3;
4160 SymbolKind.Package = 4;
4161 SymbolKind.Class = 5;
4162 SymbolKind.Method = 6;
4163 SymbolKind.Property = 7;
4164 SymbolKind.Field = 8;
4165 SymbolKind.Constructor = 9;
4166 SymbolKind.Enum = 10;
4167 SymbolKind.Interface = 11;
4168 SymbolKind.Function = 12;
4169 SymbolKind.Variable = 13;
4170 SymbolKind.Constant = 14;
4171 SymbolKind.String = 15;
4172 SymbolKind.Number = 16;
4173 SymbolKind.Boolean = 17;
4174 SymbolKind.Array = 18;
4175 SymbolKind.Object = 19;
4176 SymbolKind.Key = 20;
4177 SymbolKind.Null = 21;
4178 SymbolKind.EnumMember = 22;
4179 SymbolKind.Struct = 23;
4180 SymbolKind.Event = 24;
4181 SymbolKind.Operator = 25;
4182 SymbolKind.TypeParameter = 26;
4183 })(SymbolKind || (SymbolKind = {}));
4185 * Symbol tags are extra annotations that tweak the rendering of a symbol.
4189 (function (SymbolTag) {
4191 * Render a symbol as obsolete, usually using a strike-out.
4193 SymbolTag.Deprecated = 1;
4194 })(SymbolTag || (SymbolTag = {}));
4195 var SymbolInformation;
4196 (function (SymbolInformation) {
4198 * Creates a new symbol information literal.
4200 * @param name The name of the symbol.
4201 * @param kind The kind of the symbol.
4202 * @param range The range of the location of the symbol.
4203 * @param uri The resource of the location of symbol, defaults to the current document.
4204 * @param containerName The name of the symbol containing the symbol.
4206 function create(name, kind, range, uri, containerName) {
4210 location: { uri: uri, range: range }
4212 if (containerName) {
4213 result.containerName = containerName;
4217 SymbolInformation.create = create;
4218 })(SymbolInformation || (SymbolInformation = {}));
4220 (function (DocumentSymbol) {
4222 * Creates a new symbol information literal.
4224 * @param name The name of the symbol.
4225 * @param detail The detail of the symbol.
4226 * @param kind The kind of the symbol.
4227 * @param range The range of the symbol.
4228 * @param selectionRange The selectionRange of the symbol.
4229 * @param children Children of the symbol.
4231 function create(name, detail, kind, range, selectionRange, children) {
4237 selectionRange: selectionRange
4239 if (children !== void 0) {
4240 result.children = children;
4244 DocumentSymbol.create = create;
4246 * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
4248 function is(value) {
4249 var candidate = value;
4251 Is.string(candidate.name) && Is.number(candidate.kind) &&
4252 Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
4253 (candidate.detail === void 0 || Is.string(candidate.detail)) &&
4254 (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&
4255 (candidate.children === void 0 || Array.isArray(candidate.children)) &&
4256 (candidate.tags === void 0 || Array.isArray(candidate.tags));
4258 DocumentSymbol.is = is;
4259 })(DocumentSymbol || (DocumentSymbol = {}));
4261 * A set of predefined code action kinds
4264 (function (CodeActionKind) {
4268 CodeActionKind.Empty = '';
4270 * Base kind for quickfix actions: 'quickfix'
4272 CodeActionKind.QuickFix = 'quickfix';
4274 * Base kind for refactoring actions: 'refactor'
4276 CodeActionKind.Refactor = 'refactor';
4278 * Base kind for refactoring extraction actions: 'refactor.extract'
4280 * Example extract actions:
4283 * - Extract function
4284 * - Extract variable
4285 * - Extract interface from class
4288 CodeActionKind.RefactorExtract = 'refactor.extract';
4290 * Base kind for refactoring inline actions: 'refactor.inline'
4292 * Example inline actions:
4299 CodeActionKind.RefactorInline = 'refactor.inline';
4301 * Base kind for refactoring rewrite actions: 'refactor.rewrite'
4303 * Example rewrite actions:
4305 * - Convert JavaScript function to class
4306 * - Add or remove parameter
4307 * - Encapsulate field
4308 * - Make method static
4309 * - Move method to base class
4312 CodeActionKind.RefactorRewrite = 'refactor.rewrite';
4314 * Base kind for source actions: `source`
4316 * Source code actions apply to the entire file.
4318 CodeActionKind.Source = 'source';
4320 * Base kind for an organize imports source action: `source.organizeImports`
4322 CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
4324 * Base kind for auto-fix source actions: `source.fixAll`.
4326 * Fix all actions automatically fix errors that have a clear fix that do not require user input.
4327 * They should not suppress errors or perform unsafe fixes such as generating new types or classes.
4331 CodeActionKind.SourceFixAll = 'source.fixAll';
4332 })(CodeActionKind || (CodeActionKind = {}));
4334 * The CodeActionContext namespace provides helper functions to work with
4335 * [CodeActionContext](#CodeActionContext) literals.
4337 var CodeActionContext;
4338 (function (CodeActionContext) {
4340 * Creates a new CodeActionContext literal.
4342 function create(diagnostics, only) {
4343 var result = { diagnostics: diagnostics };
4344 if (only !== void 0 && only !== null) {
4349 CodeActionContext.create = create;
4351 * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
4353 function is(value) {
4354 var candidate = value;
4355 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
4357 CodeActionContext.is = is;
4358 })(CodeActionContext || (CodeActionContext = {}));
4360 (function (CodeAction) {
4361 function create(title, commandOrEdit, kind) {
4362 var result = { title: title };
4363 if (Command.is(commandOrEdit)) {
4364 result.command = commandOrEdit;
4367 result.edit = commandOrEdit;
4369 if (kind !== void 0) {
4374 CodeAction.create = create;
4375 function is(value) {
4376 var candidate = value;
4377 return candidate && Is.string(candidate.title) &&
4378 (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
4379 (candidate.kind === void 0 || Is.string(candidate.kind)) &&
4380 (candidate.edit !== void 0 || candidate.command !== void 0) &&
4381 (candidate.command === void 0 || Command.is(candidate.command)) &&
4382 (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
4383 (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4386 })(CodeAction || (CodeAction = {}));
4388 * The CodeLens namespace provides helper functions to work with
4389 * [CodeLens](#CodeLens) literals.
4392 (function (CodeLens) {
4394 * Creates a new CodeLens literal.
4396 function create(range, data) {
4397 var result = { range: range };
4398 if (Is.defined(data)) {
4403 CodeLens.create = create;
4405 * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
4407 function is(value) {
4408 var candidate = value;
4409 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4412 })(CodeLens || (CodeLens = {}));
4414 * The FormattingOptions namespace provides helper functions to work with
4415 * [FormattingOptions](#FormattingOptions) literals.
4417 var FormattingOptions;
4418 (function (FormattingOptions) {
4420 * Creates a new FormattingOptions literal.
4422 function create(tabSize, insertSpaces) {
4423 return { tabSize: tabSize, insertSpaces: insertSpaces };
4425 FormattingOptions.create = create;
4427 * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
4429 function is(value) {
4430 var candidate = value;
4431 return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
4433 FormattingOptions.is = is;
4434 })(FormattingOptions || (FormattingOptions = {}));
4436 * The DocumentLink namespace provides helper functions to work with
4437 * [DocumentLink](#DocumentLink) literals.
4440 (function (DocumentLink) {
4442 * Creates a new DocumentLink literal.
4444 function create(range, target, data) {
4445 return { range: range, target: target, data: data };
4447 DocumentLink.create = create;
4449 * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
4451 function is(value) {
4452 var candidate = value;
4453 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
4455 DocumentLink.is = is;
4456 })(DocumentLink || (DocumentLink = {}));
4458 * The SelectionRange namespace provides helper function to work with
4459 * SelectionRange literals.
4462 (function (SelectionRange) {
4464 * Creates a new SelectionRange
4465 * @param range the range.
4466 * @param parent an optional parent.
4468 function create(range, parent) {
4469 return { range: range, parent: parent };
4471 SelectionRange.create = create;
4472 function is(value) {
4473 var candidate = value;
4474 return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
4476 SelectionRange.is = is;
4477 })(SelectionRange || (SelectionRange = {}));
4478 var EOL = ['\n', '\r\n', '\r'];
4480 * @deprecated Use the text document from the new vscode-languageserver-textdocument package.
4483 (function (TextDocument) {
4485 * Creates a new ITextDocument literal from the given uri and content.
4486 * @param uri The document's uri.
4487 * @param languageId The document's language Id.
4488 * @param content The document's content.
4490 function create(uri, languageId, version, content) {
4491 return new FullTextDocument(uri, languageId, version, content);
4493 TextDocument.create = create;
4495 * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
4497 function is(value) {
4498 var candidate = value;
4499 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)
4500 && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
4502 TextDocument.is = is;
4503 function applyEdits(document, edits) {
4504 var text = document.getText();
4505 var sortedEdits = mergeSort(edits, function (a, b) {
4506 var diff = a.range.start.line - b.range.start.line;
4508 return a.range.start.character - b.range.start.character;
4512 var lastModifiedOffset = text.length;
4513 for (var i = sortedEdits.length - 1; i >= 0; i--) {
4514 var e = sortedEdits[i];
4515 var startOffset = document.offsetAt(e.range.start);
4516 var endOffset = document.offsetAt(e.range.end);
4517 if (endOffset <= lastModifiedOffset) {
4518 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
4521 throw new Error('Overlapping edit');
4523 lastModifiedOffset = startOffset;
4527 TextDocument.applyEdits = applyEdits;
4528 function mergeSort(data, compare) {
4529 if (data.length <= 1) {
4533 var p = (data.length / 2) | 0;
4534 var left = data.slice(0, p);
4535 var right = data.slice(p);
4536 mergeSort(left, compare);
4537 mergeSort(right, compare);
4541 while (leftIdx < left.length && rightIdx < right.length) {
4542 var ret = compare(left[leftIdx], right[rightIdx]);
4544 // smaller_equal -> take left to preserve order
4545 data[i++] = left[leftIdx++];
4548 // greater -> take right
4549 data[i++] = right[rightIdx++];
4552 while (leftIdx < left.length) {
4553 data[i++] = left[leftIdx++];
4555 while (rightIdx < right.length) {
4556 data[i++] = right[rightIdx++];
4560 })(TextDocument || (TextDocument = {}));
4561 var FullTextDocument = /** @class */ (function () {
4562 function FullTextDocument(uri, languageId, version, content) {
4564 this._languageId = languageId;
4565 this._version = version;
4566 this._content = content;
4567 this._lineOffsets = undefined;
4569 Object.defineProperty(FullTextDocument.prototype, "uri", {
4576 Object.defineProperty(FullTextDocument.prototype, "languageId", {
4578 return this._languageId;
4583 Object.defineProperty(FullTextDocument.prototype, "version", {
4585 return this._version;
4590 FullTextDocument.prototype.getText = function (range) {
4592 var start = this.offsetAt(range.start);
4593 var end = this.offsetAt(range.end);
4594 return this._content.substring(start, end);
4596 return this._content;
4598 FullTextDocument.prototype.update = function (event, version) {
4599 this._content = event.text;
4600 this._version = version;
4601 this._lineOffsets = undefined;
4603 FullTextDocument.prototype.getLineOffsets = function () {
4604 if (this._lineOffsets === undefined) {
4605 var lineOffsets = [];
4606 var text = this._content;
4607 var isLineStart = true;
4608 for (var i = 0; i < text.length; i++) {
4610 lineOffsets.push(i);
4611 isLineStart = false;
4613 var ch = text.charAt(i);
4614 isLineStart = (ch === '\r' || ch === '\n');
4615 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
4619 if (isLineStart && text.length > 0) {
4620 lineOffsets.push(text.length);
4622 this._lineOffsets = lineOffsets;
4624 return this._lineOffsets;
4626 FullTextDocument.prototype.positionAt = function (offset) {
4627 offset = Math.max(Math.min(offset, this._content.length), 0);
4628 var lineOffsets = this.getLineOffsets();
4629 var low = 0, high = lineOffsets.length;
4631 return Position.create(0, offset);
4633 while (low < high) {
4634 var mid = Math.floor((low + high) / 2);
4635 if (lineOffsets[mid] > offset) {
4642 // low is the least x for which the line offset is larger than the current offset
4643 // or array.length if no line offset is larger than the current offset
4645 return Position.create(line, offset - lineOffsets[line]);
4647 FullTextDocument.prototype.offsetAt = function (position) {
4648 var lineOffsets = this.getLineOffsets();
4649 if (position.line >= lineOffsets.length) {
4650 return this._content.length;
4652 else if (position.line < 0) {
4655 var lineOffset = lineOffsets[position.line];
4656 var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
4657 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
4659 Object.defineProperty(FullTextDocument.prototype, "lineCount", {
4661 return this.getLineOffsets().length;
4666 return FullTextDocument;
4670 var toString = Object.prototype.toString;
4671 function defined(value) {
4672 return typeof value !== 'undefined';
4674 Is.defined = defined;
4675 function undefined(value) {
4676 return typeof value === 'undefined';
4678 Is.undefined = undefined;
4679 function boolean(value) {
4680 return value === true || value === false;
4682 Is.boolean = boolean;
4683 function string(value) {
4684 return toString.call(value) === '[object String]';
4687 function number(value) {
4688 return toString.call(value) === '[object Number]';
4691 function func(value) {
4692 return toString.call(value) === '[object Function]';
4695 function objectLiteral(value) {
4696 // Strictly speaking class instances pass this check as well. Since the LSP
4697 // doesn't use classes we ignore this for now. If we do we need to add something
4698 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
4699 return value !== null && typeof value === 'object';
4701 Is.objectLiteral = objectLiteral;
4702 function typedArray(value, check) {
4703 return Array.isArray(value) && value.every(check);
4705 Is.typedArray = typedArray;
4706 })(Is || (Is = {}));
4711 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4714 /* --------------------------------------------------------------------------------------------
4715 * Copyright (c) Microsoft Corporation. All rights reserved.
4716 * Licensed under the MIT License. See License.txt in the project root for license information.
4717 * ------------------------------------------------------------------------------------------ */
4718 Object.defineProperty(exports, "__esModule", ({ value: true }));
4719 const vscode_jsonrpc_1 = __webpack_require__(6);
4720 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
4721 constructor(method) {
4725 exports.ProtocolRequestType0 = ProtocolRequestType0;
4726 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
4727 constructor(method) {
4731 exports.ProtocolRequestType = ProtocolRequestType;
4732 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
4733 constructor(method) {
4737 exports.ProtocolNotificationType = ProtocolNotificationType;
4738 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
4739 constructor(method) {
4743 exports.ProtocolNotificationType0 = ProtocolNotificationType0;
4744 //# sourceMappingURL=messages.js.map
4748 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4751 /* --------------------------------------------------------------------------------------------
4752 * Copyright (c) Microsoft Corporation. All rights reserved.
4753 * Licensed under the MIT License. See License.txt in the project root for license information.
4754 * ------------------------------------------------------------------------------------------ */
4755 Object.defineProperty(exports, "__esModule", ({ value: true }));
4756 const Is = __webpack_require__(28);
4757 const vscode_jsonrpc_1 = __webpack_require__(6);
4758 const messages_1 = __webpack_require__(26);
4759 const protocol_implementation_1 = __webpack_require__(29);
4760 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;
4761 const protocol_typeDefinition_1 = __webpack_require__(30);
4762 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;
4763 const protocol_workspaceFolders_1 = __webpack_require__(31);
4764 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;
4765 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
4766 const protocol_configuration_1 = __webpack_require__(32);
4767 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;
4768 const protocol_colorProvider_1 = __webpack_require__(33);
4769 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;
4770 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;
4771 const protocol_foldingRange_1 = __webpack_require__(34);
4772 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;
4773 const protocol_declaration_1 = __webpack_require__(35);
4774 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;
4775 const protocol_selectionRange_1 = __webpack_require__(36);
4776 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;
4777 const protocol_progress_1 = __webpack_require__(37);
4778 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;
4779 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;
4780 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;
4781 const protocol_callHierarchy_1 = __webpack_require__(38);
4782 exports.CallHierarchyIncomingCallsRequest = protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
4783 exports.CallHierarchyOutgoingCallsRequest = protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
4784 exports.CallHierarchyPrepareRequest = protocol_callHierarchy_1.CallHierarchyPrepareRequest;
4785 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
4786 let __noDynamicImport;
4788 * The DocumentFilter namespace provides helper functions to work with
4789 * [DocumentFilter](#DocumentFilter) literals.
4792 (function (DocumentFilter) {
4793 function is(value) {
4794 const candidate = value;
4795 return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
4797 DocumentFilter.is = is;
4798 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
4800 * The DocumentSelector namespace provides helper functions to work with
4801 * [DocumentSelector](#DocumentSelector)s.
4803 var DocumentSelector;
4804 (function (DocumentSelector) {
4805 function is(value) {
4806 if (!Array.isArray(value)) {
4809 for (let elem of value) {
4810 if (!Is.string(elem) && !DocumentFilter.is(elem)) {
4816 DocumentSelector.is = is;
4817 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
4819 * The `client/registerCapability` request is sent from the server to the client to register a new capability
4820 * handler on the client side.
4822 var RegistrationRequest;
4823 (function (RegistrationRequest) {
4824 RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
4825 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
4827 * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
4828 * handler on the client side.
4830 var UnregistrationRequest;
4831 (function (UnregistrationRequest) {
4832 UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
4833 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
4834 var ResourceOperationKind;
4835 (function (ResourceOperationKind) {
4837 * Supports creating new files and folders.
4839 ResourceOperationKind.Create = 'create';
4841 * Supports renaming existing files and folders.
4843 ResourceOperationKind.Rename = 'rename';
4845 * Supports deleting existing files and folders.
4847 ResourceOperationKind.Delete = 'delete';
4848 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
4849 var FailureHandlingKind;
4850 (function (FailureHandlingKind) {
4852 * Applying the workspace change is simply aborted if one of the changes provided
4853 * fails. All operations executed before the failing operation stay executed.
4855 FailureHandlingKind.Abort = 'abort';
4857 * All operations are executed transactional. That means they either all
4858 * succeed or no changes at all are applied to the workspace.
4860 FailureHandlingKind.Transactional = 'transactional';
4862 * If the workspace edit contains only textual file changes they are executed transactional.
4863 * If resource changes (create, rename or delete file) are part of the change the failure
4864 * handling startegy is abort.
4866 FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
4868 * The client tries to undo the operations already executed. But there is no
4869 * guarantee that this is succeeding.
4871 FailureHandlingKind.Undo = 'undo';
4872 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
4874 * The StaticRegistrationOptions namespace provides helper functions to work with
4875 * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
4877 var StaticRegistrationOptions;
4878 (function (StaticRegistrationOptions) {
4879 function hasId(value) {
4880 const candidate = value;
4881 return candidate && Is.string(candidate.id) && candidate.id.length > 0;
4883 StaticRegistrationOptions.hasId = hasId;
4884 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
4886 * The TextDocumentRegistrationOptions namespace provides helper functions to work with
4887 * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
4889 var TextDocumentRegistrationOptions;
4890 (function (TextDocumentRegistrationOptions) {
4891 function is(value) {
4892 const candidate = value;
4893 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
4895 TextDocumentRegistrationOptions.is = is;
4896 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
4898 * The WorkDoneProgressOptions namespace provides helper functions to work with
4899 * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
4901 var WorkDoneProgressOptions;
4902 (function (WorkDoneProgressOptions) {
4903 function is(value) {
4904 const candidate = value;
4905 return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
4907 WorkDoneProgressOptions.is = is;
4908 function hasWorkDoneProgress(value) {
4909 const candidate = value;
4910 return candidate && Is.boolean(candidate.workDoneProgress);
4912 WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
4913 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
4915 * The initialize request is sent from the client to the server.
4916 * It is sent once as the request after starting up the server.
4917 * The requests parameter is of type [InitializeParams](#InitializeParams)
4918 * the response if of type [InitializeResult](#InitializeResult) of a Thenable that
4921 var InitializeRequest;
4922 (function (InitializeRequest) {
4923 InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
4924 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
4926 * Known error codes for an `InitializeError`;
4928 var InitializeError;
4929 (function (InitializeError) {
4931 * If the protocol version provided by the client can't be handled by the server.
4932 * @deprecated This initialize error got replaced by client capabilities. There is
4933 * no version handshake in version 3.0x
4935 InitializeError.unknownProtocolVersion = 1;
4936 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
4938 * The intialized notification is sent from the client to the
4939 * server after the client is fully initialized and the server
4940 * is allowed to send requests from the server to the client.
4942 var InitializedNotification;
4943 (function (InitializedNotification) {
4944 InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
4945 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
4946 //---- Shutdown Method ----
4948 * A shutdown request is sent from the client to the server.
4949 * It is sent once when the client decides to shutdown the
4950 * server. The only notification that is sent after a shutdown request
4951 * is the exit event.
4953 var ShutdownRequest;
4954 (function (ShutdownRequest) {
4955 ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
4956 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
4957 //---- Exit Notification ----
4959 * The exit event is sent from the client to the server to
4960 * ask the server to exit its process.
4962 var ExitNotification;
4963 (function (ExitNotification) {
4964 ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
4965 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
4967 * The configuration change notification is sent from the client to the server
4968 * when the client's configuration has changed. The notification contains
4969 * the changed configuration as defined by the language client.
4971 var DidChangeConfigurationNotification;
4972 (function (DidChangeConfigurationNotification) {
4973 DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
4974 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
4975 //---- Message show and log notifications ----
4980 (function (MessageType) {
4984 MessageType.Error = 1;
4986 * A warning message.
4988 MessageType.Warning = 2;
4990 * An information message.
4992 MessageType.Info = 3;
4996 MessageType.Log = 4;
4997 })(MessageType = exports.MessageType || (exports.MessageType = {}));
4999 * The show message notification is sent from a server to a client to ask
5000 * the client to display a particular message in the user interface.
5002 var ShowMessageNotification;
5003 (function (ShowMessageNotification) {
5004 ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
5005 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
5007 * The show message request is sent from the server to the client to show a message
5008 * and a set of options actions to the user.
5010 var ShowMessageRequest;
5011 (function (ShowMessageRequest) {
5012 ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
5013 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
5015 * The log message notification is sent from the server to the client to ask
5016 * the client to log a particular message.
5018 var LogMessageNotification;
5019 (function (LogMessageNotification) {
5020 LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
5021 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
5022 //---- Telemetry notification
5024 * The telemetry event notification is sent from the server to the client to ask
5025 * the client to log telemetry data.
5027 var TelemetryEventNotification;
5028 (function (TelemetryEventNotification) {
5029 TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
5030 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
5032 * Defines how the host (editor) should sync
5033 * document changes to the language server.
5035 var TextDocumentSyncKind;
5036 (function (TextDocumentSyncKind) {
5038 * Documents should not be synced at all.
5040 TextDocumentSyncKind.None = 0;
5042 * Documents are synced by always sending the full content
5045 TextDocumentSyncKind.Full = 1;
5047 * Documents are synced by sending the full content on open.
5048 * After that only incremental updates to the document are
5051 TextDocumentSyncKind.Incremental = 2;
5052 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
5054 * The document open notification is sent from the client to the server to signal
5055 * newly opened text documents. The document's truth is now managed by the client
5056 * and the server must not try to read the document's truth using the document's
5057 * uri. Open in this sense means it is managed by the client. It doesn't necessarily
5058 * mean that its content is presented in an editor. An open notification must not
5059 * be sent more than once without a corresponding close notification send before.
5060 * This means open and close notification must be balanced and the max open count
5063 var DidOpenTextDocumentNotification;
5064 (function (DidOpenTextDocumentNotification) {
5065 DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
5066 DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
5067 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
5069 * The document change notification is sent from the client to the server to signal
5070 * changes to a text document.
5072 var DidChangeTextDocumentNotification;
5073 (function (DidChangeTextDocumentNotification) {
5074 DidChangeTextDocumentNotification.method = 'textDocument/didChange';
5075 DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
5076 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
5078 * The document close notification is sent from the client to the server when
5079 * the document got closed in the client. The document's truth now exists where
5080 * the document's uri points to (e.g. if the document's uri is a file uri the
5081 * truth now exists on disk). As with the open notification the close notification
5082 * is about managing the document's content. Receiving a close notification
5083 * doesn't mean that the document was open in an editor before. A close
5084 * notification requires a previous open notification to be sent.
5086 var DidCloseTextDocumentNotification;
5087 (function (DidCloseTextDocumentNotification) {
5088 DidCloseTextDocumentNotification.method = 'textDocument/didClose';
5089 DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
5090 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
5092 * The document save notification is sent from the client to the server when
5093 * the document got saved in the client.
5095 var DidSaveTextDocumentNotification;
5096 (function (DidSaveTextDocumentNotification) {
5097 DidSaveTextDocumentNotification.method = 'textDocument/didSave';
5098 DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
5099 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
5101 * Represents reasons why a text document is saved.
5103 var TextDocumentSaveReason;
5104 (function (TextDocumentSaveReason) {
5106 * Manually triggered, e.g. by the user pressing save, by starting debugging,
5107 * or by an API call.
5109 TextDocumentSaveReason.Manual = 1;
5111 * Automatic after a delay.
5113 TextDocumentSaveReason.AfterDelay = 2;
5115 * When the editor lost focus.
5117 TextDocumentSaveReason.FocusOut = 3;
5118 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
5120 * A document will save notification is sent from the client to the server before
5121 * the document is actually saved.
5123 var WillSaveTextDocumentNotification;
5124 (function (WillSaveTextDocumentNotification) {
5125 WillSaveTextDocumentNotification.method = 'textDocument/willSave';
5126 WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
5127 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
5129 * A document will save request is sent from the client to the server before
5130 * the document is actually saved. The request can return an array of TextEdits
5131 * which will be applied to the text document before it is saved. Please note that
5132 * clients might drop results if computing the text edits took too long or if a
5133 * server constantly fails on this request. This is done to keep the save fast and
5136 var WillSaveTextDocumentWaitUntilRequest;
5137 (function (WillSaveTextDocumentWaitUntilRequest) {
5138 WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
5139 WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
5140 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
5142 * The watched files notification is sent from the client to the server when
5143 * the client detects changes to file watched by the language client.
5145 var DidChangeWatchedFilesNotification;
5146 (function (DidChangeWatchedFilesNotification) {
5147 DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
5148 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
5150 * The file event type
5153 (function (FileChangeType) {
5155 * The file got created.
5157 FileChangeType.Created = 1;
5159 * The file got changed.
5161 FileChangeType.Changed = 2;
5163 * The file got deleted.
5165 FileChangeType.Deleted = 3;
5166 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
5168 (function (WatchKind) {
5170 * Interested in create events.
5172 WatchKind.Create = 1;
5174 * Interested in change events
5176 WatchKind.Change = 2;
5178 * Interested in delete events
5180 WatchKind.Delete = 4;
5181 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
5183 * Diagnostics notification are sent from the server to the client to signal
5184 * results of validation runs.
5186 var PublishDiagnosticsNotification;
5187 (function (PublishDiagnosticsNotification) {
5188 PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
5189 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
5191 * How a completion was triggered
5193 var CompletionTriggerKind;
5194 (function (CompletionTriggerKind) {
5196 * Completion was triggered by typing an identifier (24x7 code
5197 * complete), manual invocation (e.g Ctrl+Space) or via API.
5199 CompletionTriggerKind.Invoked = 1;
5201 * Completion was triggered by a trigger character specified by
5202 * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
5204 CompletionTriggerKind.TriggerCharacter = 2;
5206 * Completion was re-triggered as current completion list is incomplete
5208 CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
5209 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
5211 * Request to request completion at a given text document position. The request's
5212 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
5213 * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
5214 * or a Thenable that resolves to such.
5216 * The request can delay the computation of the [`detail`](#CompletionItem.detail)
5217 * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
5218 * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
5219 * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
5221 var CompletionRequest;
5222 (function (CompletionRequest) {
5223 CompletionRequest.method = 'textDocument/completion';
5224 CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
5225 /** @deprecated Use CompletionRequest.type */
5226 CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5227 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
5229 * Request to resolve additional information for a given completion item.The request's
5230 * parameter is of type [CompletionItem](#CompletionItem) the response
5231 * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
5233 var CompletionResolveRequest;
5234 (function (CompletionResolveRequest) {
5235 CompletionResolveRequest.method = 'completionItem/resolve';
5236 CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
5237 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
5239 * Request to request hover information at a given text document position. The request's
5240 * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
5241 * type [Hover](#Hover) or a Thenable that resolves to such.
5244 (function (HoverRequest) {
5245 HoverRequest.method = 'textDocument/hover';
5246 HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
5247 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
5249 * How a signature help was triggered.
5253 var SignatureHelpTriggerKind;
5254 (function (SignatureHelpTriggerKind) {
5256 * Signature help was invoked manually by the user or by a command.
5258 SignatureHelpTriggerKind.Invoked = 1;
5260 * Signature help was triggered by a trigger character.
5262 SignatureHelpTriggerKind.TriggerCharacter = 2;
5264 * Signature help was triggered by the cursor moving or by the document content changing.
5266 SignatureHelpTriggerKind.ContentChange = 3;
5267 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
5268 var SignatureHelpRequest;
5269 (function (SignatureHelpRequest) {
5270 SignatureHelpRequest.method = 'textDocument/signatureHelp';
5271 SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
5272 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
5274 * A request to resolve the definition location of a symbol at a given text
5275 * document position. The request's parameter is of type [TextDocumentPosition]
5276 * (#TextDocumentPosition) the response is of either type [Definition](#Definition)
5277 * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
5280 var DefinitionRequest;
5281 (function (DefinitionRequest) {
5282 DefinitionRequest.method = 'textDocument/definition';
5283 DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
5284 /** @deprecated Use DefinitionRequest.type */
5285 DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5286 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
5288 * A request to resolve project-wide references for the symbol denoted
5289 * by the given text document position. The request's parameter is of
5290 * type [ReferenceParams](#ReferenceParams) the response is of type
5291 * [Location[]](#Location) or a Thenable that resolves to such.
5293 var ReferencesRequest;
5294 (function (ReferencesRequest) {
5295 ReferencesRequest.method = 'textDocument/references';
5296 ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
5297 /** @deprecated Use ReferencesRequest.type */
5298 ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5299 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
5301 * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
5302 * text document position. The request's parameter is of type [TextDocumentPosition]
5303 * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
5304 * (#DocumentHighlight) or a Thenable that resolves to such.
5306 var DocumentHighlightRequest;
5307 (function (DocumentHighlightRequest) {
5308 DocumentHighlightRequest.method = 'textDocument/documentHighlight';
5309 DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
5310 /** @deprecated Use DocumentHighlightRequest.type */
5311 DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5312 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
5314 * A request to list all symbols found in a given text document. The request's
5315 * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
5316 * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
5317 * that resolves to such.
5319 var DocumentSymbolRequest;
5320 (function (DocumentSymbolRequest) {
5321 DocumentSymbolRequest.method = 'textDocument/documentSymbol';
5322 DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
5323 /** @deprecated Use DocumentSymbolRequest.type */
5324 DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5325 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
5327 * A request to provide commands for the given text document and range.
5329 var CodeActionRequest;
5330 (function (CodeActionRequest) {
5331 CodeActionRequest.method = 'textDocument/codeAction';
5332 CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
5333 /** @deprecated Use CodeActionRequest.type */
5334 CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5335 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
5337 * A request to list project-wide symbols matching the query string given
5338 * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
5339 * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
5342 var WorkspaceSymbolRequest;
5343 (function (WorkspaceSymbolRequest) {
5344 WorkspaceSymbolRequest.method = 'workspace/symbol';
5345 WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
5346 /** @deprecated Use WorkspaceSymbolRequest.type */
5347 WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5348 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
5350 * A request to provide code lens for the given text document.
5352 var CodeLensRequest;
5353 (function (CodeLensRequest) {
5354 CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');
5355 /** @deprecated Use CodeLensRequest.type */
5356 CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5357 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
5359 * A request to resolve a command for a given code lens.
5361 var CodeLensResolveRequest;
5362 (function (CodeLensResolveRequest) {
5363 CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');
5364 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
5366 * A request to provide document links
5368 var DocumentLinkRequest;
5369 (function (DocumentLinkRequest) {
5370 DocumentLinkRequest.method = 'textDocument/documentLink';
5371 DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
5372 /** @deprecated Use DocumentLinkRequest.type */
5373 DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5374 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
5376 * Request to resolve additional information for a given document link. The request's
5377 * parameter is of type [DocumentLink](#DocumentLink) the response
5378 * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
5380 var DocumentLinkResolveRequest;
5381 (function (DocumentLinkResolveRequest) {
5382 DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');
5383 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
5385 * A request to to format a whole document.
5387 var DocumentFormattingRequest;
5388 (function (DocumentFormattingRequest) {
5389 DocumentFormattingRequest.method = 'textDocument/formatting';
5390 DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
5391 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
5393 * A request to to format a range in a document.
5395 var DocumentRangeFormattingRequest;
5396 (function (DocumentRangeFormattingRequest) {
5397 DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
5398 DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
5399 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
5401 * A request to format a document on type.
5403 var DocumentOnTypeFormattingRequest;
5404 (function (DocumentOnTypeFormattingRequest) {
5405 DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
5406 DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
5407 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
5409 * A request to rename a symbol.
5412 (function (RenameRequest) {
5413 RenameRequest.method = 'textDocument/rename';
5414 RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
5415 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
5417 * A request to test and perform the setup necessary for a rename.
5419 var PrepareRenameRequest;
5420 (function (PrepareRenameRequest) {
5421 PrepareRenameRequest.method = 'textDocument/prepareRename';
5422 PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
5423 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
5425 * A request send from the client to the server to execute a command. The request might return
5426 * a workspace edit which the client will apply to the workspace.
5428 var ExecuteCommandRequest;
5429 (function (ExecuteCommandRequest) {
5430 ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
5431 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
5433 * A request sent from the server to the client to modified certain resources.
5435 var ApplyWorkspaceEditRequest;
5436 (function (ApplyWorkspaceEditRequest) {
5437 ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
5438 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
5439 //# sourceMappingURL=protocol.js.map
5443 /***/ ((__unused_webpack_module, exports) => {
5445 /* --------------------------------------------------------------------------------------------
5446 * Copyright (c) Microsoft Corporation. All rights reserved.
5447 * Licensed under the MIT License. See License.txt in the project root for license information.
5448 * ------------------------------------------------------------------------------------------ */
5450 Object.defineProperty(exports, "__esModule", ({ value: true }));
5451 function boolean(value) {
5452 return value === true || value === false;
5454 exports.boolean = boolean;
5455 function string(value) {
5456 return typeof value === 'string' || value instanceof String;
5458 exports.string = string;
5459 function number(value) {
5460 return typeof value === 'number' || value instanceof Number;
5462 exports.number = number;
5463 function error(value) {
5464 return value instanceof Error;
5466 exports.error = error;
5467 function func(value) {
5468 return typeof value === 'function';
5470 exports.func = func;
5471 function array(value) {
5472 return Array.isArray(value);
5474 exports.array = array;
5475 function stringArray(value) {
5476 return array(value) && value.every(elem => string(elem));
5478 exports.stringArray = stringArray;
5479 function typedArray(value, check) {
5480 return Array.isArray(value) && value.every(check);
5482 exports.typedArray = typedArray;
5483 function objectLiteral(value) {
5484 // Strictly speaking class instances pass this check as well. Since the LSP
5485 // doesn't use classes we ignore this for now. If we do we need to add something
5486 // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
5487 return value !== null && typeof value === 'object';
5489 exports.objectLiteral = objectLiteral;
5490 //# sourceMappingURL=is.js.map
5494 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5497 /* --------------------------------------------------------------------------------------------
5498 * Copyright (c) Microsoft Corporation. All rights reserved.
5499 * Licensed under the MIT License. See License.txt in the project root for license information.
5500 * ------------------------------------------------------------------------------------------ */
5501 Object.defineProperty(exports, "__esModule", ({ value: true }));
5502 const vscode_jsonrpc_1 = __webpack_require__(6);
5503 const messages_1 = __webpack_require__(26);
5504 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
5505 let __noDynamicImport;
5507 * A request to resolve the implementation locations of a symbol at a given text
5508 * document position. The request's parameter is of type [TextDocumentPositioParams]
5509 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
5510 * Thenable that resolves to such.
5512 var ImplementationRequest;
5513 (function (ImplementationRequest) {
5514 ImplementationRequest.method = 'textDocument/implementation';
5515 ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
5516 /** @deprecated Use ImplementationRequest.type */
5517 ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5518 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
5519 //# sourceMappingURL=protocol.implementation.js.map
5523 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5526 /* --------------------------------------------------------------------------------------------
5527 * Copyright (c) Microsoft Corporation. All rights reserved.
5528 * Licensed under the MIT License. See License.txt in the project root for license information.
5529 * ------------------------------------------------------------------------------------------ */
5530 Object.defineProperty(exports, "__esModule", ({ value: true }));
5531 const vscode_jsonrpc_1 = __webpack_require__(6);
5532 const messages_1 = __webpack_require__(26);
5533 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
5534 let __noDynamicImport;
5536 * A request to resolve the type definition locations of a symbol at a given text
5537 * document position. The request's parameter is of type [TextDocumentPositioParams]
5538 * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
5539 * Thenable that resolves to such.
5541 var TypeDefinitionRequest;
5542 (function (TypeDefinitionRequest) {
5543 TypeDefinitionRequest.method = 'textDocument/typeDefinition';
5544 TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
5545 /** @deprecated Use TypeDefinitionRequest.type */
5546 TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5547 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
5548 //# sourceMappingURL=protocol.typeDefinition.js.map
5552 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5555 /* --------------------------------------------------------------------------------------------
5556 * Copyright (c) Microsoft Corporation. All rights reserved.
5557 * Licensed under the MIT License. See License.txt in the project root for license information.
5558 * ------------------------------------------------------------------------------------------ */
5559 Object.defineProperty(exports, "__esModule", ({ value: true }));
5560 const messages_1 = __webpack_require__(26);
5562 * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
5564 var WorkspaceFoldersRequest;
5565 (function (WorkspaceFoldersRequest) {
5566 WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
5567 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
5569 * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
5570 * folder configuration changes.
5572 var DidChangeWorkspaceFoldersNotification;
5573 (function (DidChangeWorkspaceFoldersNotification) {
5574 DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
5575 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
5576 //# sourceMappingURL=protocol.workspaceFolders.js.map
5580 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5583 /* --------------------------------------------------------------------------------------------
5584 * Copyright (c) Microsoft Corporation. All rights reserved.
5585 * Licensed under the MIT License. See License.txt in the project root for license information.
5586 * ------------------------------------------------------------------------------------------ */
5587 Object.defineProperty(exports, "__esModule", ({ value: true }));
5588 const messages_1 = __webpack_require__(26);
5590 * The 'workspace/configuration' request is sent from the server to the client to fetch a certain
5591 * configuration setting.
5593 * This pull model replaces the old push model were the client signaled configuration change via an
5594 * event. If the server still needs to react to configuration changes (since the server caches the
5595 * result of `workspace/configuration` requests) the server should register for an empty configuration
5596 * change event and empty the cache if such an event is received.
5598 var ConfigurationRequest;
5599 (function (ConfigurationRequest) {
5600 ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
5601 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
5602 //# sourceMappingURL=protocol.configuration.js.map
5606 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5609 /* --------------------------------------------------------------------------------------------
5610 * Copyright (c) Microsoft Corporation. All rights reserved.
5611 * Licensed under the MIT License. See License.txt in the project root for license information.
5612 * ------------------------------------------------------------------------------------------ */
5613 Object.defineProperty(exports, "__esModule", ({ value: true }));
5614 const vscode_jsonrpc_1 = __webpack_require__(6);
5615 const messages_1 = __webpack_require__(26);
5617 * A request to list all color symbols found in a given text document. The request's
5618 * parameter is of type [DocumentColorParams](#DocumentColorParams) the
5619 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
5620 * that resolves to such.
5622 var DocumentColorRequest;
5623 (function (DocumentColorRequest) {
5624 DocumentColorRequest.method = 'textDocument/documentColor';
5625 DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
5626 /** @deprecated Use DocumentColorRequest.type */
5627 DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5628 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
5630 * A request to list all presentation for a color. The request's
5631 * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
5632 * response is of type [ColorInformation[]](#ColorInformation) or a Thenable
5633 * that resolves to such.
5635 var ColorPresentationRequest;
5636 (function (ColorPresentationRequest) {
5637 ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
5638 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
5639 //# sourceMappingURL=protocol.colorProvider.js.map
5643 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5646 /*---------------------------------------------------------------------------------------------
5647 * Copyright (c) Microsoft Corporation. All rights reserved.
5648 * Licensed under the MIT License. See License.txt in the project root for license information.
5649 *--------------------------------------------------------------------------------------------*/
5650 Object.defineProperty(exports, "__esModule", ({ value: true }));
5651 const vscode_jsonrpc_1 = __webpack_require__(6);
5652 const messages_1 = __webpack_require__(26);
5654 * Enum of known range kinds
5656 var FoldingRangeKind;
5657 (function (FoldingRangeKind) {
5659 * Folding range for a comment
5661 FoldingRangeKind["Comment"] = "comment";
5663 * Folding range for a imports or includes
5665 FoldingRangeKind["Imports"] = "imports";
5667 * Folding range for a region (e.g. `#region`)
5669 FoldingRangeKind["Region"] = "region";
5670 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
5672 * A request to provide folding ranges in a document. The request's
5673 * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
5674 * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
5675 * that resolves to such.
5677 var FoldingRangeRequest;
5678 (function (FoldingRangeRequest) {
5679 FoldingRangeRequest.method = 'textDocument/foldingRange';
5680 FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
5681 /** @deprecated Use FoldingRangeRequest.type */
5682 FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5683 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
5684 //# sourceMappingURL=protocol.foldingRange.js.map
5688 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5691 /* --------------------------------------------------------------------------------------------
5692 * Copyright (c) Microsoft Corporation. All rights reserved.
5693 * Licensed under the MIT License. See License.txt in the project root for license information.
5694 * ------------------------------------------------------------------------------------------ */
5695 Object.defineProperty(exports, "__esModule", ({ value: true }));
5696 const vscode_jsonrpc_1 = __webpack_require__(6);
5697 const messages_1 = __webpack_require__(26);
5698 // @ts-ignore: to avoid inlining LocatioLink as dynamic import
5699 let __noDynamicImport;
5701 * A request to resolve the type definition locations of a symbol at a given text
5702 * document position. The request's parameter is of type [TextDocumentPositioParams]
5703 * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
5704 * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
5707 var DeclarationRequest;
5708 (function (DeclarationRequest) {
5709 DeclarationRequest.method = 'textDocument/declaration';
5710 DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
5711 /** @deprecated Use DeclarationRequest.type */
5712 DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5713 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
5714 //# sourceMappingURL=protocol.declaration.js.map
5718 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5721 /*---------------------------------------------------------------------------------------------
5722 * Copyright (c) Microsoft Corporation. All rights reserved.
5723 * Licensed under the MIT License. See License.txt in the project root for license information.
5724 *--------------------------------------------------------------------------------------------*/
5725 Object.defineProperty(exports, "__esModule", ({ value: true }));
5726 const vscode_jsonrpc_1 = __webpack_require__(6);
5727 const messages_1 = __webpack_require__(26);
5729 * A request to provide selection ranges in a document. The request's
5730 * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
5731 * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
5732 * that resolves to such.
5734 var SelectionRangeRequest;
5735 (function (SelectionRangeRequest) {
5736 SelectionRangeRequest.method = 'textDocument/selectionRange';
5737 SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
5738 /** @deprecated Use SelectionRangeRequest.type */
5739 SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();
5740 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
5741 //# sourceMappingURL=protocol.selectionRange.js.map
5745 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5748 /* --------------------------------------------------------------------------------------------
5749 * Copyright (c) Microsoft Corporation. All rights reserved.
5750 * Licensed under the MIT License. See License.txt in the project root for license information.
5751 * ------------------------------------------------------------------------------------------ */
5752 Object.defineProperty(exports, "__esModule", ({ value: true }));
5753 const vscode_jsonrpc_1 = __webpack_require__(6);
5754 const messages_1 = __webpack_require__(26);
5755 var WorkDoneProgress;
5756 (function (WorkDoneProgress) {
5757 WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
5758 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
5760 * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
5761 * reporting from the server.
5763 var WorkDoneProgressCreateRequest;
5764 (function (WorkDoneProgressCreateRequest) {
5765 WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
5766 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
5768 * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
5769 * initiated on the server side.
5771 var WorkDoneProgressCancelNotification;
5772 (function (WorkDoneProgressCancelNotification) {
5773 WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
5774 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
5775 //# sourceMappingURL=protocol.progress.js.map
5779 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5782 /* --------------------------------------------------------------------------------------------
5783 * Copyright (c) TypeFox and others. All rights reserved.
5784 * Licensed under the MIT License. See License.txt in the project root for license information.
5785 * ------------------------------------------------------------------------------------------ */
5786 Object.defineProperty(exports, "__esModule", ({ value: true }));
5787 const messages_1 = __webpack_require__(26);
5789 * A request to result a `CallHierarchyItem` in a document at a given position.
5790 * Can be used as an input to a incoming or outgoing call hierarchy.
5794 var CallHierarchyPrepareRequest;
5795 (function (CallHierarchyPrepareRequest) {
5796 CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
5797 CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
5798 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
5800 * A request to resolve the incoming calls for a given `CallHierarchyItem`.
5804 var CallHierarchyIncomingCallsRequest;
5805 (function (CallHierarchyIncomingCallsRequest) {
5806 CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
5807 CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
5808 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
5810 * A request to resolve the outgoing calls for a given `CallHierarchyItem`.
5814 var CallHierarchyOutgoingCallsRequest;
5815 (function (CallHierarchyOutgoingCallsRequest) {
5816 CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
5817 CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
5818 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
5819 //# sourceMappingURL=protocol.callHierarchy.js.map
5823 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5826 /* --------------------------------------------------------------------------------------------
5827 * Copyright (c) Microsoft Corporation. All rights reserved.
5828 * Licensed under the MIT License. See License.txt in the project root for license information.
5829 * ------------------------------------------------------------------------------------------ */
5830 Object.defineProperty(exports, "__esModule", ({ value: true }));
5831 const vscode_jsonrpc_1 = __webpack_require__(6);
5832 function createProtocolConnection(input, output, logger, options) {
5833 if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
5834 options = { connectionStrategy: options };
5836 return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
5838 exports.createProtocolConnection = createProtocolConnection;
5839 //# sourceMappingURL=connection.js.map
5843 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5846 /* --------------------------------------------------------------------------------------------
5847 * Copyright (c) Microsoft Corporation. All rights reserved.
5848 * Licensed under the MIT License. See License.txt in the project root for license information.
5849 * ------------------------------------------------------------------------------------------ */
5850 Object.defineProperty(exports, "__esModule", ({ value: true }));
5851 const messages_1 = __webpack_require__(26);
5853 * A set of predefined token types. This set is not fixed
5854 * an clients can specify additional token types via the
5855 * corresponding client capabilities.
5857 * @since 3.16.0 - Proposed state
5859 var SemanticTokenTypes;
5860 (function (SemanticTokenTypes) {
5861 SemanticTokenTypes["namespace"] = "namespace";
5862 SemanticTokenTypes["type"] = "type";
5863 SemanticTokenTypes["class"] = "class";
5864 SemanticTokenTypes["enum"] = "enum";
5865 SemanticTokenTypes["interface"] = "interface";
5866 SemanticTokenTypes["struct"] = "struct";
5867 SemanticTokenTypes["typeParameter"] = "typeParameter";
5868 SemanticTokenTypes["parameter"] = "parameter";
5869 SemanticTokenTypes["variable"] = "variable";
5870 SemanticTokenTypes["property"] = "property";
5871 SemanticTokenTypes["enumMember"] = "enumMember";
5872 SemanticTokenTypes["event"] = "event";
5873 SemanticTokenTypes["function"] = "function";
5874 SemanticTokenTypes["member"] = "member";
5875 SemanticTokenTypes["macro"] = "macro";
5876 SemanticTokenTypes["keyword"] = "keyword";
5877 SemanticTokenTypes["modifier"] = "modifier";
5878 SemanticTokenTypes["comment"] = "comment";
5879 SemanticTokenTypes["string"] = "string";
5880 SemanticTokenTypes["number"] = "number";
5881 SemanticTokenTypes["regexp"] = "regexp";
5882 SemanticTokenTypes["operator"] = "operator";
5883 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
5885 * A set of predefined token modifiers. This set is not fixed
5886 * an clients can specify additional token types via the
5887 * corresponding client capabilities.
5889 * @since 3.16.0 - Proposed state
5891 var SemanticTokenModifiers;
5892 (function (SemanticTokenModifiers) {
5893 SemanticTokenModifiers["declaration"] = "declaration";
5894 SemanticTokenModifiers["definition"] = "definition";
5895 SemanticTokenModifiers["readonly"] = "readonly";
5896 SemanticTokenModifiers["static"] = "static";
5897 SemanticTokenModifiers["deprecated"] = "deprecated";
5898 SemanticTokenModifiers["abstract"] = "abstract";
5899 SemanticTokenModifiers["async"] = "async";
5900 SemanticTokenModifiers["modification"] = "modification";
5901 SemanticTokenModifiers["documentation"] = "documentation";
5902 SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
5903 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
5905 * @since 3.16.0 - Proposed state
5908 (function (SemanticTokens) {
5909 function is(value) {
5910 const candidate = value;
5911 return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
5912 Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
5914 SemanticTokens.is = is;
5915 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
5917 * @since 3.16.0 - Proposed state
5919 var SemanticTokensRequest;
5920 (function (SemanticTokensRequest) {
5921 SemanticTokensRequest.method = 'textDocument/semanticTokens';
5922 SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
5923 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
5925 * @since 3.16.0 - Proposed state
5927 var SemanticTokensEditsRequest;
5928 (function (SemanticTokensEditsRequest) {
5929 SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';
5930 SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);
5931 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));
5933 * @since 3.16.0 - Proposed state
5935 var SemanticTokensRangeRequest;
5936 (function (SemanticTokensRangeRequest) {
5937 SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
5938 SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
5939 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
5940 //# sourceMappingURL=protocol.semanticTokens.proposed.js.map
5944 /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5947 /*---------------------------------------------------------------------------------------------
5948 * Copyright (c) Microsoft Corporation. All rights reserved.
5949 * Licensed under the MIT License. See License.txt in the project root for license information.
5950 *--------------------------------------------------------------------------------------------*/
5951 var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5952 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5953 return new (P || (P = Promise))(function (resolve, reject) {
5954 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5955 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5956 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
5957 step((generator = generator.apply(thisArg, _arguments || [])).next());
5960 Object.defineProperty(exports, "__esModule", ({ value: true }));
5961 exports.activateTagClosing = void 0;
5962 const coc_nvim_1 = __webpack_require__(1);
5963 const vscode_languageserver_protocol_1 = __webpack_require__(4);
5964 function activateTagClosing(tagProvider, supportedLanguages, configName) {
5965 let disposables = [];
5966 coc_nvim_1.workspace.onDidChangeTextDocument(event => {
5967 const document = coc_nvim_1.workspace.getDocument(event.textDocument.uri);
5971 onDidChangeTextDocument(document.textDocument, event.contentChanges)
5975 }, null, disposables);
5976 let isEnabled = false;
5977 updateEnabledState().catch(() => {
5980 disposables.push(coc_nvim_1.workspace.registerAutocmd({
5981 event: ['BufEnter'],
5983 callback: updateEnabledState,
5986 function updateEnabledState() {
5987 return __awaiter(this, void 0, void 0, function* () {
5989 const doc = yield coc_nvim_1.workspace.document;
5993 const document = doc.textDocument;
5994 if (supportedLanguages.indexOf(document.languageId) === -1) {
5997 if (!coc_nvim_1.workspace.getConfiguration(undefined, document.uri).get(configName)) {
6003 function onDidChangeTextDocument(document, changes) {
6004 return __awaiter(this, void 0, void 0, function* () {
6008 const doc = yield coc_nvim_1.workspace.document;
6012 let activeDocument = doc.textDocument;
6013 if (document !== activeDocument || changes.length === 0) {
6016 if (typeof timeout !== 'undefined') {
6017 clearTimeout(timeout);
6019 let lastChange = changes[changes.length - 1];
6020 if (!vscode_languageserver_protocol_1.Range.is(lastChange['range']) || !emptyRange(lastChange['range'])) {
6023 let lastCharacter = lastChange.text[lastChange.text.length - 1];
6024 if (lastCharacter !== '>' && lastCharacter !== '/') {
6027 let rangeStart = lastChange['range'].start;
6028 let version = document.version;
6029 timeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
6030 let position = vscode_languageserver_protocol_1.Position.create(rangeStart.line, rangeStart.character + lastChange.text.length);
6031 tagProvider(document, position).then((text) => __awaiter(this, void 0, void 0, function* () {
6032 if (text && isEnabled) {
6033 const doc = yield coc_nvim_1.workspace.document;
6037 let activeDocument = doc.textDocument;
6038 if (document === activeDocument && activeDocument.version === version) {
6039 coc_nvim_1.snippetManager.insertSnippet(text, false, vscode_languageserver_protocol_1.Range.create(position, position))
6046 timeout = undefined;
6050 return coc_nvim_1.Disposable.create(() => {
6051 disposables.forEach(disposable => {
6052 disposable.dispose();
6057 exports.activateTagClosing = activateTagClosing;
6058 function emptyRange(range) {
6059 return range.start.line == range.end.line && range.start.character == range.end.character;
6065 /************************************************************************/
6066 /******/ // The module cache
6067 /******/ var __webpack_module_cache__ = {};
6069 /******/ // The require function
6070 /******/ function __webpack_require__(moduleId) {
6071 /******/ // Check if module is in cache
6072 /******/ if(__webpack_module_cache__[moduleId]) {
6073 /******/ return __webpack_module_cache__[moduleId].exports;
6075 /******/ // Create a new module (and put it into the cache)
6076 /******/ var module = __webpack_module_cache__[moduleId] = {
6077 /******/ // no module.id needed
6078 /******/ // no module.loaded needed
6079 /******/ exports: {}
6082 /******/ // Execute the module function
6083 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
6085 /******/ // Return the exports of the module
6086 /******/ return module.exports;
6089 /************************************************************************/
6090 /******/ /* webpack/runtime/define property getters */
6092 /******/ // define getter functions for harmony exports
6093 /******/ __webpack_require__.d = (exports, definition) => {
6094 /******/ for(var key in definition) {
6095 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
6096 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
6102 /******/ /* webpack/runtime/hasOwnProperty shorthand */
6104 /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
6107 /******/ /* webpack/runtime/make namespace object */
6109 /******/ // define __esModule on exports
6110 /******/ __webpack_require__.r = (exports) => {
6111 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
6112 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6114 /******/ Object.defineProperty(exports, '__esModule', { value: true });
6118 /************************************************************************/
6119 /******/ // module exports must be returned from runtime so entry inlining is disabled
6121 /******/ // Load entry module and return exports
6122 /******/ return __webpack_require__(0);