(function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports,
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */,
/* 2 */,
/* 3 */
/***/ ((module) => {
module.exports = require("path");;
/***/ }),
/* 4 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createProtocolConnection = void 0;
const node_1 = __webpack_require__(5);
__exportStar(__webpack_require__(5), exports);
__exportStar(__webpack_require__(25), exports);
function createProtocolConnection(input, output, logger, options) {
return node_1.createMessageConnection(input, output, logger, options);
}
exports.createProtocolConnection = createProtocolConnection;
//# sourceMappingURL=main.js.map
/***/ }),
/* 5 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ----------------------------------------------------------------------------------------- */
module.exports = __webpack_require__(6);
/***/ }),
/* 6 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0;
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ----------------------------------------------------------------------------------------- */
const ril_1 = __webpack_require__(7);
// Install the node runtime abstract.
ril_1.default.install();
const api_1 = __webpack_require__(12);
const path = __webpack_require__(3);
const os = __webpack_require__(22);
const crypto_1 = __webpack_require__(23);
const net_1 = __webpack_require__(24);
__exportStar(__webpack_require__(12), exports);
class IPCMessageReader extends api_1.AbstractMessageReader {
constructor(process) {
super();
this.process = process;
let eventEmitter = this.process;
eventEmitter.on('error', (error) => this.fireError(error));
eventEmitter.on('close', () => this.fireClose());
}
listen(callback) {
this.process.on('message', callback);
return api_1.Disposable.create(() => this.process.off('message', callback));
}
}
exports.IPCMessageReader = IPCMessageReader;
class IPCMessageWriter extends api_1.AbstractMessageWriter {
constructor(process) {
super();
this.process = process;
this.errorCount = 0;
let eventEmitter = this.process;
eventEmitter.on('error', (error) => this.fireError(error));
eventEmitter.on('close', () => this.fireClose);
}
write(msg) {
try {
if (typeof this.process.send === 'function') {
this.process.send(msg, undefined, undefined, (error) => {
if (error) {
this.errorCount++;
this.handleError(error, msg);
}
else {
this.errorCount = 0;
}
});
}
return Promise.resolve();
}
catch (error) {
this.handleError(error, msg);
return Promise.reject(error);
}
}
handleError(error, msg) {
this.errorCount++;
this.fireError(error, msg, this.errorCount);
}
end() {
}
}
exports.IPCMessageWriter = IPCMessageWriter;
class SocketMessageReader extends api_1.ReadableStreamMessageReader {
constructor(socket, encoding = 'utf-8') {
super(ril_1.default().stream.asReadableStream(socket), encoding);
}
}
exports.SocketMessageReader = SocketMessageReader;
class SocketMessageWriter extends api_1.WriteableStreamMessageWriter {
constructor(socket, options) {
super(ril_1.default().stream.asWritableStream(socket), options);
this.socket = socket;
}
dispose() {
super.dispose();
this.socket.destroy();
}
}
exports.SocketMessageWriter = SocketMessageWriter;
class StreamMessageReader extends api_1.ReadableStreamMessageReader {
constructor(readble, encoding) {
super(ril_1.default().stream.asReadableStream(readble), encoding);
}
}
exports.StreamMessageReader = StreamMessageReader;
class StreamMessageWriter extends api_1.WriteableStreamMessageWriter {
constructor(writable, options) {
super(ril_1.default().stream.asWritableStream(writable), options);
}
}
exports.StreamMessageWriter = StreamMessageWriter;
const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR'];
const safeIpcPathLengths = new Map([
['linux', 107],
['darwin', 103]
]);
function generateRandomPipeName() {
const randomSuffix = crypto_1.randomBytes(21).toString('hex');
if (process.platform === 'win32') {
return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
}
let result;
if (XDG_RUNTIME_DIR) {
result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
}
else {
result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
}
const limit = safeIpcPathLengths.get(process.platform);
if (limit !== undefined && result.length >= limit) {
ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
}
return result;
}
exports.generateRandomPipeName = generateRandomPipeName;
function createClientPipeTransport(pipeName, encoding = 'utf-8') {
let connectResolve;
const connected = new Promise((resolve, _reject) => {
connectResolve = resolve;
});
return new Promise((resolve, reject) => {
let server = net_1.createServer((socket) => {
server.close();
connectResolve([
new SocketMessageReader(socket, encoding),
new SocketMessageWriter(socket, encoding)
]);
});
server.on('error', reject);
server.listen(pipeName, () => {
server.removeListener('error', reject);
resolve({
onConnected: () => { return connected; }
});
});
});
}
exports.createClientPipeTransport = createClientPipeTransport;
function createServerPipeTransport(pipeName, encoding = 'utf-8') {
const socket = net_1.createConnection(pipeName);
return [
new SocketMessageReader(socket, encoding),
new SocketMessageWriter(socket, encoding)
];
}
exports.createServerPipeTransport = createServerPipeTransport;
function createClientSocketTransport(port, encoding = 'utf-8') {
let connectResolve;
const connected = new Promise((resolve, _reject) => {
connectResolve = resolve;
});
return new Promise((resolve, reject) => {
const server = net_1.createServer((socket) => {
server.close();
connectResolve([
new SocketMessageReader(socket, encoding),
new SocketMessageWriter(socket, encoding)
]);
});
server.on('error', reject);
server.listen(port, '127.0.0.1', () => {
server.removeListener('error', reject);
resolve({
onConnected: () => { return connected; }
});
});
});
}
exports.createClientSocketTransport = createClientSocketTransport;
function createServerSocketTransport(port, encoding = 'utf-8') {
const socket = net_1.createConnection(port, '127.0.0.1');
return [
new SocketMessageReader(socket, encoding),
new SocketMessageWriter(socket, encoding)
];
}
exports.createServerSocketTransport = createServerSocketTransport;
function isReadableStream(value) {
const candidate = value;
return candidate.read !== undefined && candidate.addListener !== undefined;
}
function isWritableStream(value) {
const candidate = value;
return candidate.write !== undefined && candidate.addListener !== undefined;
}
function createMessageConnection(input, output, logger, options) {
if (!logger) {
logger = api_1.NullLogger;
}
const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
if (api_1.ConnectionStrategy.is(options)) {
options = { connectionStrategy: options };
}
return api_1.createMessageConnection(reader, writer, logger, options);
}
exports.createMessageConnection = createMessageConnection;
//# sourceMappingURL=main.js.map
/***/ }),
/* 7 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
const ral_1 = __webpack_require__(8);
const util_1 = __webpack_require__(9);
const disposable_1 = __webpack_require__(10);
const messageBuffer_1 = __webpack_require__(11);
class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer {
constructor(encoding = 'utf-8') {
super(encoding);
}
emptyBuffer() {
return MessageBuffer.emptyBuffer;
}
fromString(value, encoding) {
return Buffer.from(value, encoding);
}
toString(value, encoding) {
if (value instanceof Buffer) {
return value.toString(encoding);
}
else {
return new util_1.TextDecoder(encoding).decode(value);
}
}
asNative(buffer, length) {
if (length === undefined) {
return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
}
else {
return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
}
}
allocNative(length) {
return Buffer.allocUnsafe(length);
}
}
MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
class ReadableStreamWrapper {
constructor(stream) {
this.stream = stream;
}
onClose(listener) {
this.stream.on('close', listener);
return disposable_1.Disposable.create(() => this.stream.off('close', listener));
}
onError(listener) {
this.stream.on('error', listener);
return disposable_1.Disposable.create(() => this.stream.off('error', listener));
}
onEnd(listener) {
this.stream.on('end', listener);
return disposable_1.Disposable.create(() => this.stream.off('end', listener));
}
onData(listener) {
this.stream.on('data', listener);
return disposable_1.Disposable.create(() => this.stream.off('data', listener));
}
}
class WritableStreamWrapper {
constructor(stream) {
this.stream = stream;
}
onClose(listener) {
this.stream.on('close', listener);
return disposable_1.Disposable.create(() => this.stream.off('close', listener));
}
onError(listener) {
this.stream.on('error', listener);
return disposable_1.Disposable.create(() => this.stream.off('error', listener));
}
onEnd(listener) {
this.stream.on('end', listener);
return disposable_1.Disposable.create(() => this.stream.off('end', listener));
}
write(data, encoding) {
return new Promise((resolve, reject) => {
const callback = (error) => {
if (error === undefined || error === null) {
resolve();
}
else {
reject(error);
}
};
if (typeof data === 'string') {
this.stream.write(data, encoding, callback);
}
else {
this.stream.write(data, callback);
}
});
}
end() {
this.stream.end();
}
}
const _ril = Object.freeze({
messageBuffer: Object.freeze({
create: (encoding) => new MessageBuffer(encoding)
}),
applicationJson: Object.freeze({
encoder: Object.freeze({
name: 'application/json',
encode: (msg, options) => {
try {
return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset));
}
catch (err) {
return Promise.reject(err);
}
}
}),
decoder: Object.freeze({
name: 'application/json',
decode: (buffer, options) => {
try {
if (buffer instanceof Buffer) {
return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
}
else {
return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
}
}
catch (err) {
return Promise.reject(err);
}
}
})
}),
stream: Object.freeze({
asReadableStream: (stream) => new ReadableStreamWrapper(stream),
asWritableStream: (stream) => new WritableStreamWrapper(stream)
}),
console: console,
timer: Object.freeze({
setTimeout(callback, ms, ...args) {
return setTimeout(callback, ms, ...args);
},
clearTimeout(handle) {
clearTimeout(handle);
},
setImmediate(callback, ...args) {
return setImmediate(callback, ...args);
},
clearImmediate(handle) {
clearImmediate(handle);
}
})
});
function RIL() {
return _ril;
}
(function (RIL) {
function install() {
ral_1.default.install(_ril);
}
RIL.install = install;
})(RIL || (RIL = {}));
exports.default = RIL;
//# sourceMappingURL=ril.js.map
/***/ }),
/* 8 */
/***/ ((__unused_webpack_module, exports) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
let _ral;
function RAL() {
if (_ral === undefined) {
throw new Error(`No runtime abstraction layer installed`);
}
return _ral;
}
(function (RAL) {
function install(ral) {
if (ral === undefined) {
throw new Error(`No runtime abstraction layer provided`);
}
_ral = ral;
}
RAL.install = install;
})(RAL || (RAL = {}));
exports.default = RAL;
//# sourceMappingURL=ral.js.map
/***/ }),
/* 9 */
/***/ ((module) => {
module.exports = require("util");;
/***/ }),
/* 10 */
/***/ ((__unused_webpack_module, exports) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Disposable = void 0;
var Disposable;
(function (Disposable) {
function create(func) {
return {
dispose: func
};
}
Disposable.create = create;
})(Disposable = exports.Disposable || (exports.Disposable = {}));
//# sourceMappingURL=disposable.js.map
/***/ }),
/* 11 */
/***/ ((__unused_webpack_module, exports) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AbstractMessageBuffer = void 0;
const CR = 13;
const LF = 10;
const CRLF = '\r\n';
class AbstractMessageBuffer {
constructor(encoding = 'utf-8') {
this._encoding = encoding;
this._chunks = [];
this._totalLength = 0;
}
get encoding() {
return this._encoding;
}
append(chunk) {
const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk;
this._chunks.push(toAppend);
this._totalLength += toAppend.byteLength;
}
tryReadHeaders() {
if (this._chunks.length === 0) {
return undefined;
}
let state = 0;
let chunkIndex = 0;
let offset = 0;
let chunkBytesRead = 0;
row: while (chunkIndex < this._chunks.length) {
const chunk = this._chunks[chunkIndex];
offset = 0;
column: while (offset < chunk.length) {
const value = chunk[offset];
switch (value) {
case CR:
switch (state) {
case 0:
state = 1;
break;
case 2:
state = 3;
break;
default:
state = 0;
}
break;
case LF:
switch (state) {
case 1:
state = 2;
break;
case 3:
state = 4;
offset++;
break row;
default:
state = 0;
}
break;
default:
state = 0;
}
offset++;
}
chunkBytesRead += chunk.byteLength;
chunkIndex++;
}
if (state !== 4) {
return undefined;
}
// The buffer contains the two CRLF at the end. So we will
// have two empty lines after the split at the end as well.
const buffer = this._read(chunkBytesRead + offset);
const result = new Map();
const headers = this.toString(buffer, 'ascii').split(CRLF);
if (headers.length < 2) {
return result;
}
for (let i = 0; i < headers.length - 2; i++) {
const header = headers[i];
const index = header.indexOf(':');
if (index === -1) {
throw new Error('Message header must separate key and value using :');
}
const key = header.substr(0, index);
const value = header.substr(index + 1).trim();
result.set(key, value);
}
return result;
}
tryReadBody(length) {
if (this._totalLength < length) {
return undefined;
}
return this._read(length);
}
get numberOfBytes() {
return this._totalLength;
}
_read(byteCount) {
if (byteCount === 0) {
return this.emptyBuffer();
}
if (byteCount > this._totalLength) {
throw new Error(`Cannot read so many bytes!`);
}
if (this._chunks[0].byteLength === byteCount) {
// super fast path, precisely first chunk must be returned
const chunk = this._chunks[0];
this._chunks.shift();
this._totalLength -= byteCount;
return this.asNative(chunk);
}
if (this._chunks[0].byteLength > byteCount) {
// fast path, the reading is entirely within the first chunk
const chunk = this._chunks[0];
const result = this.asNative(chunk, byteCount);
this._chunks[0] = chunk.slice(byteCount);
this._totalLength -= byteCount;
return result;
}
const result = this.allocNative(byteCount);
let resultOffset = 0;
let chunkIndex = 0;
while (byteCount > 0) {
const chunk = this._chunks[chunkIndex];
if (chunk.byteLength > byteCount) {
// this chunk will survive
const chunkPart = chunk.slice(0, byteCount);
result.set(chunkPart, resultOffset);
resultOffset += byteCount;
this._chunks[chunkIndex] = chunk.slice(byteCount);
this._totalLength -= byteCount;
byteCount -= byteCount;
}
else {
// this chunk will be entirely read
result.set(chunk, resultOffset);
resultOffset += chunk.byteLength;
this._chunks.shift();
this._totalLength -= chunk.byteLength;
byteCount -= chunk.byteLength;
}
}
return result;
}
}
exports.AbstractMessageBuffer = AbstractMessageBuffer;
//# sourceMappingURL=messageBuffer.js.map
/***/ }),
/* 12 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
///
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0;
exports.CancellationStrategy = void 0;
const messages_1 = __webpack_require__(13);
Object.defineProperty(exports, "RequestType", ({ enumerable: true, get: function () { return messages_1.RequestType; } }));
Object.defineProperty(exports, "RequestType0", ({ enumerable: true, get: function () { return messages_1.RequestType0; } }));
Object.defineProperty(exports, "RequestType1", ({ enumerable: true, get: function () { return messages_1.RequestType1; } }));
Object.defineProperty(exports, "RequestType2", ({ enumerable: true, get: function () { return messages_1.RequestType2; } }));
Object.defineProperty(exports, "RequestType3", ({ enumerable: true, get: function () { return messages_1.RequestType3; } }));
Object.defineProperty(exports, "RequestType4", ({ enumerable: true, get: function () { return messages_1.RequestType4; } }));
Object.defineProperty(exports, "RequestType5", ({ enumerable: true, get: function () { return messages_1.RequestType5; } }));
Object.defineProperty(exports, "RequestType6", ({ enumerable: true, get: function () { return messages_1.RequestType6; } }));
Object.defineProperty(exports, "RequestType7", ({ enumerable: true, get: function () { return messages_1.RequestType7; } }));
Object.defineProperty(exports, "RequestType8", ({ enumerable: true, get: function () { return messages_1.RequestType8; } }));
Object.defineProperty(exports, "RequestType9", ({ enumerable: true, get: function () { return messages_1.RequestType9; } }));
Object.defineProperty(exports, "ResponseError", ({ enumerable: true, get: function () { return messages_1.ResponseError; } }));
Object.defineProperty(exports, "ErrorCodes", ({ enumerable: true, get: function () { return messages_1.ErrorCodes; } }));
Object.defineProperty(exports, "NotificationType", ({ enumerable: true, get: function () { return messages_1.NotificationType; } }));
Object.defineProperty(exports, "NotificationType0", ({ enumerable: true, get: function () { return messages_1.NotificationType0; } }));
Object.defineProperty(exports, "NotificationType1", ({ enumerable: true, get: function () { return messages_1.NotificationType1; } }));
Object.defineProperty(exports, "NotificationType2", ({ enumerable: true, get: function () { return messages_1.NotificationType2; } }));
Object.defineProperty(exports, "NotificationType3", ({ enumerable: true, get: function () { return messages_1.NotificationType3; } }));
Object.defineProperty(exports, "NotificationType4", ({ enumerable: true, get: function () { return messages_1.NotificationType4; } }));
Object.defineProperty(exports, "NotificationType5", ({ enumerable: true, get: function () { return messages_1.NotificationType5; } }));
Object.defineProperty(exports, "NotificationType6", ({ enumerable: true, get: function () { return messages_1.NotificationType6; } }));
Object.defineProperty(exports, "NotificationType7", ({ enumerable: true, get: function () { return messages_1.NotificationType7; } }));
Object.defineProperty(exports, "NotificationType8", ({ enumerable: true, get: function () { return messages_1.NotificationType8; } }));
Object.defineProperty(exports, "NotificationType9", ({ enumerable: true, get: function () { return messages_1.NotificationType9; } }));
Object.defineProperty(exports, "ParameterStructures", ({ enumerable: true, get: function () { return messages_1.ParameterStructures; } }));
const disposable_1 = __webpack_require__(10);
Object.defineProperty(exports, "Disposable", ({ enumerable: true, get: function () { return disposable_1.Disposable; } }));
const events_1 = __webpack_require__(15);
Object.defineProperty(exports, "Event", ({ enumerable: true, get: function () { return events_1.Event; } }));
Object.defineProperty(exports, "Emitter", ({ enumerable: true, get: function () { return events_1.Emitter; } }));
const cancellation_1 = __webpack_require__(16);
Object.defineProperty(exports, "CancellationTokenSource", ({ enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } }));
Object.defineProperty(exports, "CancellationToken", ({ enumerable: true, get: function () { return cancellation_1.CancellationToken; } }));
const messageReader_1 = __webpack_require__(17);
Object.defineProperty(exports, "MessageReader", ({ enumerable: true, get: function () { return messageReader_1.MessageReader; } }));
Object.defineProperty(exports, "AbstractMessageReader", ({ enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } }));
Object.defineProperty(exports, "ReadableStreamMessageReader", ({ enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } }));
const messageWriter_1 = __webpack_require__(18);
Object.defineProperty(exports, "MessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.MessageWriter; } }));
Object.defineProperty(exports, "AbstractMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } }));
Object.defineProperty(exports, "WriteableStreamMessageWriter", ({ enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } }));
const connection_1 = __webpack_require__(20);
Object.defineProperty(exports, "ConnectionStrategy", ({ enumerable: true, get: function () { return connection_1.ConnectionStrategy; } }));
Object.defineProperty(exports, "ConnectionOptions", ({ enumerable: true, get: function () { return connection_1.ConnectionOptions; } }));
Object.defineProperty(exports, "NullLogger", ({ enumerable: true, get: function () { return connection_1.NullLogger; } }));
Object.defineProperty(exports, "createMessageConnection", ({ enumerable: true, get: function () { return connection_1.createMessageConnection; } }));
Object.defineProperty(exports, "ProgressType", ({ enumerable: true, get: function () { return connection_1.ProgressType; } }));
Object.defineProperty(exports, "Trace", ({ enumerable: true, get: function () { return connection_1.Trace; } }));
Object.defineProperty(exports, "TraceFormat", ({ enumerable: true, get: function () { return connection_1.TraceFormat; } }));
Object.defineProperty(exports, "SetTraceNotification", ({ enumerable: true, get: function () { return connection_1.SetTraceNotification; } }));
Object.defineProperty(exports, "LogTraceNotification", ({ enumerable: true, get: function () { return connection_1.LogTraceNotification; } }));
Object.defineProperty(exports, "ConnectionErrors", ({ enumerable: true, get: function () { return connection_1.ConnectionErrors; } }));
Object.defineProperty(exports, "ConnectionError", ({ enumerable: true, get: function () { return connection_1.ConnectionError; } }));
Object.defineProperty(exports, "CancellationReceiverStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } }));
Object.defineProperty(exports, "CancellationSenderStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } }));
Object.defineProperty(exports, "CancellationStrategy", ({ enumerable: true, get: function () { return connection_1.CancellationStrategy; } }));
const ral_1 = __webpack_require__(8);
exports.RAL = ral_1.default;
//# sourceMappingURL=api.js.map
/***/ }),
/* 13 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0;
const is = __webpack_require__(14);
/**
* Predefined error codes.
*/
var ErrorCodes;
(function (ErrorCodes) {
// Defined by JSON RPC
ErrorCodes.ParseError = -32700;
ErrorCodes.InvalidRequest = -32600;
ErrorCodes.MethodNotFound = -32601;
ErrorCodes.InvalidParams = -32602;
ErrorCodes.InternalError = -32603;
/**
* This is the start range of JSON RPC reserved error codes.
* It doesn't denote a real error code. No application error codes should
* be defined between the start and end range. For backwards
* compatibility the `ServerNotInitialized` and the `UnknownErrorCode`
* are left in the range.
*
* @since 3.16.0
*/
ErrorCodes.jsonrpcReservedErrorRangeStart = -32099;
/** @deprecated use jsonrpcReservedErrorRangeStart */
ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart;
ErrorCodes.MessageWriteError = -32099;
ErrorCodes.MessageReadError = -32098;
ErrorCodes.ServerNotInitialized = -32002;
ErrorCodes.UnknownErrorCode = -32001;
/**
* This is the end range of JSON RPC reserved error codes.
* It doesn't denote a real error code.
*
* @since 3.16.0
*/
ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000;
/** @deprecated use jsonrpcReservedErrorRangeEnd */
ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd;
})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));
/**
* An error object return in a response in case a request
* has failed.
*/
class ResponseError extends Error {
constructor(code, message, data) {
super(message);
this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
this.data = data;
Object.setPrototypeOf(this, ResponseError.prototype);
}
toJson() {
return {
code: this.code,
message: this.message,
data: this.data,
};
}
}
exports.ResponseError = ResponseError;
class ParameterStructures {
constructor(kind) {
this.kind = kind;
}
static is(value) {
return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
}
toString() {
return this.kind;
}
}
exports.ParameterStructures = ParameterStructures;
/**
* The parameter structure is automatically inferred on the number of parameters
* and the parameter type in case of a single param.
*/
ParameterStructures.auto = new ParameterStructures('auto');
/**
* Forces `byPosition` parameter structure. This is useful if you have a single
* parameter which has a literal type.
*/
ParameterStructures.byPosition = new ParameterStructures('byPosition');
/**
* Forces `byName` parameter structure. This is only useful when having a single
* parameter. The library will report errors if used with a different number of
* parameters.
*/
ParameterStructures.byName = new ParameterStructures('byName');
/**
* An abstract implementation of a MessageType.
*/
class AbstractMessageSignature {
constructor(method, numberOfParams) {
this.method = method;
this.numberOfParams = numberOfParams;
}
get parameterStructures() {
return ParameterStructures.auto;
}
}
exports.AbstractMessageSignature = AbstractMessageSignature;
/**
* Classes to type request response pairs
*/
class RequestType0 extends AbstractMessageSignature {
constructor(method) {
super(method, 0);
}
}
exports.RequestType0 = RequestType0;
class RequestType extends AbstractMessageSignature {
constructor(method, _parameterStructures = ParameterStructures.auto) {
super(method, 1);
this._parameterStructures = _parameterStructures;
}
get parameterStructures() {
return this._parameterStructures;
}
}
exports.RequestType = RequestType;
class RequestType1 extends AbstractMessageSignature {
constructor(method, _parameterStructures = ParameterStructures.auto) {
super(method, 1);
this._parameterStructures = _parameterStructures;
}
get parameterStructures() {
return this._parameterStructures;
}
}
exports.RequestType1 = RequestType1;
class RequestType2 extends AbstractMessageSignature {
constructor(method) {
super(method, 2);
}
}
exports.RequestType2 = RequestType2;
class RequestType3 extends AbstractMessageSignature {
constructor(method) {
super(method, 3);
}
}
exports.RequestType3 = RequestType3;
class RequestType4 extends AbstractMessageSignature {
constructor(method) {
super(method, 4);
}
}
exports.RequestType4 = RequestType4;
class RequestType5 extends AbstractMessageSignature {
constructor(method) {
super(method, 5);
}
}
exports.RequestType5 = RequestType5;
class RequestType6 extends AbstractMessageSignature {
constructor(method) {
super(method, 6);
}
}
exports.RequestType6 = RequestType6;
class RequestType7 extends AbstractMessageSignature {
constructor(method) {
super(method, 7);
}
}
exports.RequestType7 = RequestType7;
class RequestType8 extends AbstractMessageSignature {
constructor(method) {
super(method, 8);
}
}
exports.RequestType8 = RequestType8;
class RequestType9 extends AbstractMessageSignature {
constructor(method) {
super(method, 9);
}
}
exports.RequestType9 = RequestType9;
class NotificationType extends AbstractMessageSignature {
constructor(method, _parameterStructures = ParameterStructures.auto) {
super(method, 1);
this._parameterStructures = _parameterStructures;
}
get parameterStructures() {
return this._parameterStructures;
}
}
exports.NotificationType = NotificationType;
class NotificationType0 extends AbstractMessageSignature {
constructor(method) {
super(method, 0);
}
}
exports.NotificationType0 = NotificationType0;
class NotificationType1 extends AbstractMessageSignature {
constructor(method, _parameterStructures = ParameterStructures.auto) {
super(method, 1);
this._parameterStructures = _parameterStructures;
}
get parameterStructures() {
return this._parameterStructures;
}
}
exports.NotificationType1 = NotificationType1;
class NotificationType2 extends AbstractMessageSignature {
constructor(method) {
super(method, 2);
}
}
exports.NotificationType2 = NotificationType2;
class NotificationType3 extends AbstractMessageSignature {
constructor(method) {
super(method, 3);
}
}
exports.NotificationType3 = NotificationType3;
class NotificationType4 extends AbstractMessageSignature {
constructor(method) {
super(method, 4);
}
}
exports.NotificationType4 = NotificationType4;
class NotificationType5 extends AbstractMessageSignature {
constructor(method) {
super(method, 5);
}
}
exports.NotificationType5 = NotificationType5;
class NotificationType6 extends AbstractMessageSignature {
constructor(method) {
super(method, 6);
}
}
exports.NotificationType6 = NotificationType6;
class NotificationType7 extends AbstractMessageSignature {
constructor(method) {
super(method, 7);
}
}
exports.NotificationType7 = NotificationType7;
class NotificationType8 extends AbstractMessageSignature {
constructor(method) {
super(method, 8);
}
}
exports.NotificationType8 = NotificationType8;
class NotificationType9 extends AbstractMessageSignature {
constructor(method) {
super(method, 9);
}
}
exports.NotificationType9 = NotificationType9;
/**
* Tests if the given message is a request message
*/
function isRequestMessage(message) {
const candidate = message;
return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
}
exports.isRequestMessage = isRequestMessage;
/**
* Tests if the given message is a notification message
*/
function isNotificationMessage(message) {
const candidate = message;
return candidate && is.string(candidate.method) && message.id === void 0;
}
exports.isNotificationMessage = isNotificationMessage;
/**
* Tests if the given message is a response message
*/
function isResponseMessage(message) {
const candidate = message;
return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
}
exports.isResponseMessage = isResponseMessage;
//# sourceMappingURL=messages.js.map
/***/ }),
/* 14 */
/***/ ((__unused_webpack_module, exports) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
function boolean(value) {
return value === true || value === false;
}
exports.boolean = boolean;
function string(value) {
return typeof value === 'string' || value instanceof String;
}
exports.string = string;
function number(value) {
return typeof value === 'number' || value instanceof Number;
}
exports.number = number;
function error(value) {
return value instanceof Error;
}
exports.error = error;
function func(value) {
return typeof value === 'function';
}
exports.func = func;
function array(value) {
return Array.isArray(value);
}
exports.array = array;
function stringArray(value) {
return array(value) && value.every(elem => string(elem));
}
exports.stringArray = stringArray;
//# sourceMappingURL=is.js.map
/***/ }),
/* 15 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Emitter = exports.Event = void 0;
const ral_1 = __webpack_require__(8);
var Event;
(function (Event) {
const _disposable = { dispose() { } };
Event.None = function () { return _disposable; };
})(Event = exports.Event || (exports.Event = {}));
class CallbackList {
add(callback, context = null, bucket) {
if (!this._callbacks) {
this._callbacks = [];
this._contexts = [];
}
this._callbacks.push(callback);
this._contexts.push(context);
if (Array.isArray(bucket)) {
bucket.push({ dispose: () => this.remove(callback, context) });
}
}
remove(callback, context = null) {
if (!this._callbacks) {
return;
}
let foundCallbackWithDifferentContext = false;
for (let i = 0, len = this._callbacks.length; i < len; i++) {
if (this._callbacks[i] === callback) {
if (this._contexts[i] === context) {
// callback & context match => remove it
this._callbacks.splice(i, 1);
this._contexts.splice(i, 1);
return;
}
else {
foundCallbackWithDifferentContext = true;
}
}
}
if (foundCallbackWithDifferentContext) {
throw new Error('When adding a listener with a context, you should remove it with the same context');
}
}
invoke(...args) {
if (!this._callbacks) {
return [];
}
const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
for (let i = 0, len = callbacks.length; i < len; i++) {
try {
ret.push(callbacks[i].apply(contexts[i], args));
}
catch (e) {
// eslint-disable-next-line no-console
ral_1.default().console.error(e);
}
}
return ret;
}
isEmpty() {
return !this._callbacks || this._callbacks.length === 0;
}
dispose() {
this._callbacks = undefined;
this._contexts = undefined;
}
}
class Emitter {
constructor(_options) {
this._options = _options;
}
/**
* For the public to allow to subscribe
* to events from this Emitter
*/
get event() {
if (!this._event) {
this._event = (listener, thisArgs, disposables) => {
if (!this._callbacks) {
this._callbacks = new CallbackList();
}
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
this._options.onFirstListenerAdd(this);
}
this._callbacks.add(listener, thisArgs);
const result = {
dispose: () => {
if (!this._callbacks) {
// disposable is disposed after emitter is disposed.
return;
}
this._callbacks.remove(listener, thisArgs);
result.dispose = Emitter._noop;
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
this._options.onLastListenerRemove(this);
}
}
};
if (Array.isArray(disposables)) {
disposables.push(result);
}
return result;
};
}
return this._event;
}
/**
* To be kept private to fire an event to
* subscribers
*/
fire(event) {
if (this._callbacks) {
this._callbacks.invoke.call(this._callbacks, event);
}
}
dispose() {
if (this._callbacks) {
this._callbacks.dispose();
this._callbacks = undefined;
}
}
}
exports.Emitter = Emitter;
Emitter._noop = function () { };
//# sourceMappingURL=events.js.map
/***/ }),
/* 16 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CancellationTokenSource = exports.CancellationToken = void 0;
const ral_1 = __webpack_require__(8);
const Is = __webpack_require__(14);
const events_1 = __webpack_require__(15);
var CancellationToken;
(function (CancellationToken) {
CancellationToken.None = Object.freeze({
isCancellationRequested: false,
onCancellationRequested: events_1.Event.None
});
CancellationToken.Cancelled = Object.freeze({
isCancellationRequested: true,
onCancellationRequested: events_1.Event.None
});
function is(value) {
const candidate = value;
return candidate && (candidate === CancellationToken.None
|| candidate === CancellationToken.Cancelled
|| (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));
}
CancellationToken.is = is;
})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));
const shortcutEvent = Object.freeze(function (callback, context) {
const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
return { dispose() { ral_1.default().timer.clearTimeout(handle); } };
});
class MutableToken {
constructor() {
this._isCancelled = false;
}
cancel() {
if (!this._isCancelled) {
this._isCancelled = true;
if (this._emitter) {
this._emitter.fire(undefined);
this.dispose();
}
}
}
get isCancellationRequested() {
return this._isCancelled;
}
get onCancellationRequested() {
if (this._isCancelled) {
return shortcutEvent;
}
if (!this._emitter) {
this._emitter = new events_1.Emitter();
}
return this._emitter.event;
}
dispose() {
if (this._emitter) {
this._emitter.dispose();
this._emitter = undefined;
}
}
}
class CancellationTokenSource {
get token() {
if (!this._token) {
// be lazy and create the token only when
// actually needed
this._token = new MutableToken();
}
return this._token;
}
cancel() {
if (!this._token) {
// save an object by returning the default
// cancelled token when cancellation happens
// before someone asks for the token
this._token = CancellationToken.Cancelled;
}
else {
this._token.cancel();
}
}
dispose() {
if (!this._token) {
// ensure to initialize with an empty token if we had none
this._token = CancellationToken.None;
}
else if (this._token instanceof MutableToken) {
// actually dispose
this._token.dispose();
}
}
}
exports.CancellationTokenSource = CancellationTokenSource;
//# sourceMappingURL=cancellation.js.map
/***/ }),
/* 17 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0;
const ral_1 = __webpack_require__(8);
const Is = __webpack_require__(14);
const events_1 = __webpack_require__(15);
var MessageReader;
(function (MessageReader) {
function is(value) {
let candidate = value;
return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&
Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);
}
MessageReader.is = is;
})(MessageReader = exports.MessageReader || (exports.MessageReader = {}));
class AbstractMessageReader {
constructor() {
this.errorEmitter = new events_1.Emitter();
this.closeEmitter = new events_1.Emitter();
this.partialMessageEmitter = new events_1.Emitter();
}
dispose() {
this.errorEmitter.dispose();
this.closeEmitter.dispose();
}
get onError() {
return this.errorEmitter.event;
}
fireError(error) {
this.errorEmitter.fire(this.asError(error));
}
get onClose() {
return this.closeEmitter.event;
}
fireClose() {
this.closeEmitter.fire(undefined);
}
get onPartialMessage() {
return this.partialMessageEmitter.event;
}
firePartialMessage(info) {
this.partialMessageEmitter.fire(info);
}
asError(error) {
if (error instanceof Error) {
return error;
}
else {
return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
}
}
}
exports.AbstractMessageReader = AbstractMessageReader;
var ResolvedMessageReaderOptions;
(function (ResolvedMessageReaderOptions) {
function fromOptions(options) {
var _a;
let charset;
let result;
let contentDecoder;
const contentDecoders = new Map();
let contentTypeDecoder;
const contentTypeDecoders = new Map();
if (options === undefined || typeof options === 'string') {
charset = options !== null && options !== void 0 ? options : 'utf-8';
}
else {
charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8';
if (options.contentDecoder !== undefined) {
contentDecoder = options.contentDecoder;
contentDecoders.set(contentDecoder.name, contentDecoder);
}
if (options.contentDecoders !== undefined) {
for (const decoder of options.contentDecoders) {
contentDecoders.set(decoder.name, decoder);
}
}
if (options.contentTypeDecoder !== undefined) {
contentTypeDecoder = options.contentTypeDecoder;
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
}
if (options.contentTypeDecoders !== undefined) {
for (const decoder of options.contentTypeDecoders) {
contentTypeDecoders.set(decoder.name, decoder);
}
}
}
if (contentTypeDecoder === undefined) {
contentTypeDecoder = ral_1.default().applicationJson.decoder;
contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
}
return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
}
ResolvedMessageReaderOptions.fromOptions = fromOptions;
})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
class ReadableStreamMessageReader extends AbstractMessageReader {
constructor(readable, options) {
super();
this.readable = readable;
this.options = ResolvedMessageReaderOptions.fromOptions(options);
this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
this._partialMessageTimeout = 10000;
this.nextMessageLength = -1;
this.messageToken = 0;
}
set partialMessageTimeout(timeout) {
this._partialMessageTimeout = timeout;
}
get partialMessageTimeout() {
return this._partialMessageTimeout;
}
listen(callback) {
this.nextMessageLength = -1;
this.messageToken = 0;
this.partialMessageTimer = undefined;
this.callback = callback;
const result = this.readable.onData((data) => {
this.onData(data);
});
this.readable.onError((error) => this.fireError(error));
this.readable.onClose(() => this.fireClose());
return result;
}
onData(data) {
this.buffer.append(data);
while (true) {
if (this.nextMessageLength === -1) {
const headers = this.buffer.tryReadHeaders();
if (!headers) {
return;
}
const contentLength = headers.get('Content-Length');
if (!contentLength) {
throw new Error('Header must provide a Content-Length property.');
}
const length = parseInt(contentLength);
if (isNaN(length)) {
throw new Error('Content-Length value must be a number.');
}
this.nextMessageLength = length;
}
const body = this.buffer.tryReadBody(this.nextMessageLength);
if (body === undefined) {
/** We haven't received the full message yet. */
this.setPartialMessageTimer();
return;
}
this.clearPartialMessageTimer();
this.nextMessageLength = -1;
let p;
if (this.options.contentDecoder !== undefined) {
p = this.options.contentDecoder.decode(body);
}
else {
p = Promise.resolve(body);
}
p.then((value) => {
this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
this.callback(msg);
}, (error) => {
this.fireError(error);
});
}, (error) => {
this.fireError(error);
});
}
}
clearPartialMessageTimer() {
if (this.partialMessageTimer) {
ral_1.default().timer.clearTimeout(this.partialMessageTimer);
this.partialMessageTimer = undefined;
}
}
setPartialMessageTimer() {
this.clearPartialMessageTimer();
if (this._partialMessageTimeout <= 0) {
return;
}
this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
this.partialMessageTimer = undefined;
if (token === this.messageToken) {
this.firePartialMessage({ messageToken: token, waitingTime: timeout });
this.setPartialMessageTimer();
}
}, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
}
}
exports.ReadableStreamMessageReader = ReadableStreamMessageReader;
//# sourceMappingURL=messageReader.js.map
/***/ }),
/* 18 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0;
const ral_1 = __webpack_require__(8);
const Is = __webpack_require__(14);
const semaphore_1 = __webpack_require__(19);
const events_1 = __webpack_require__(15);
const ContentLength = 'Content-Length: ';
const CRLF = '\r\n';
var MessageWriter;
(function (MessageWriter) {
function is(value) {
let candidate = value;
return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&
Is.func(candidate.onError) && Is.func(candidate.write);
}
MessageWriter.is = is;
})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));
class AbstractMessageWriter {
constructor() {
this.errorEmitter = new events_1.Emitter();
this.closeEmitter = new events_1.Emitter();
}
dispose() {
this.errorEmitter.dispose();
this.closeEmitter.dispose();
}
get onError() {
return this.errorEmitter.event;
}
fireError(error, message, count) {
this.errorEmitter.fire([this.asError(error), message, count]);
}
get onClose() {
return this.closeEmitter.event;
}
fireClose() {
this.closeEmitter.fire(undefined);
}
asError(error) {
if (error instanceof Error) {
return error;
}
else {
return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);
}
}
}
exports.AbstractMessageWriter = AbstractMessageWriter;
var ResolvedMessageWriterOptions;
(function (ResolvedMessageWriterOptions) {
function fromOptions(options) {
var _a, _b;
if (options === undefined || typeof options === 'string') {
return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder };
}
else {
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 };
}
}
ResolvedMessageWriterOptions.fromOptions = fromOptions;
})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
class WriteableStreamMessageWriter extends AbstractMessageWriter {
constructor(writable, options) {
super();
this.writable = writable;
this.options = ResolvedMessageWriterOptions.fromOptions(options);
this.errorCount = 0;
this.writeSemaphore = new semaphore_1.Semaphore(1);
this.writable.onError((error) => this.fireError(error));
this.writable.onClose(() => this.fireClose());
}
async write(msg) {
return this.writeSemaphore.lock(async () => {
const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
if (this.options.contentEncoder !== undefined) {
return this.options.contentEncoder.encode(buffer);
}
else {
return buffer;
}
});
return payload.then((buffer) => {
const headers = [];
headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
headers.push(CRLF);
return this.doWrite(msg, headers, buffer);
}, (error) => {
this.fireError(error);
throw error;
});
});
}
async doWrite(msg, headers, data) {
try {
await this.writable.write(headers.join(''), 'ascii');
return this.writable.write(data);
}
catch (error) {
this.handleError(error, msg);
return Promise.reject(error);
}
}
handleError(error, msg) {
this.errorCount++;
this.fireError(error, msg, this.errorCount);
}
end() {
this.writable.end();
}
}
exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
//# sourceMappingURL=messageWriter.js.map
/***/ }),
/* 19 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Semaphore = void 0;
const ral_1 = __webpack_require__(8);
class Semaphore {
constructor(capacity = 1) {
if (capacity <= 0) {
throw new Error('Capacity must be greater than 0');
}
this._capacity = capacity;
this._active = 0;
this._waiting = [];
}
lock(thunk) {
return new Promise((resolve, reject) => {
this._waiting.push({ thunk, resolve, reject });
this.runNext();
});
}
get active() {
return this._active;
}
runNext() {
if (this._waiting.length === 0 || this._active === this._capacity) {
return;
}
ral_1.default().timer.setImmediate(() => this.doRunNext());
}
doRunNext() {
if (this._waiting.length === 0 || this._active === this._capacity) {
return;
}
const next = this._waiting.shift();
this._active++;
if (this._active > this._capacity) {
throw new Error(`To many thunks active`);
}
try {
const result = next.thunk();
if (result instanceof Promise) {
result.then((value) => {
this._active--;
next.resolve(value);
this.runNext();
}, (err) => {
this._active--;
next.reject(err);
this.runNext();
});
}
else {
this._active--;
next.resolve(result);
this.runNext();
}
}
catch (err) {
this._active--;
next.reject(err);
this.runNext();
}
}
}
exports.Semaphore = Semaphore;
//# sourceMappingURL=semaphore.js.map
/***/ }),
/* 20 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0;
const ral_1 = __webpack_require__(8);
const Is = __webpack_require__(14);
const messages_1 = __webpack_require__(13);
const linkedMap_1 = __webpack_require__(21);
const events_1 = __webpack_require__(15);
const cancellation_1 = __webpack_require__(16);
var CancelNotification;
(function (CancelNotification) {
CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');
})(CancelNotification || (CancelNotification = {}));
var ProgressNotification;
(function (ProgressNotification) {
ProgressNotification.type = new messages_1.NotificationType('$/progress');
})(ProgressNotification || (ProgressNotification = {}));
class ProgressType {
constructor() {
}
}
exports.ProgressType = ProgressType;
var StarRequestHandler;
(function (StarRequestHandler) {
function is(value) {
return Is.func(value);
}
StarRequestHandler.is = is;
})(StarRequestHandler || (StarRequestHandler = {}));
exports.NullLogger = Object.freeze({
error: () => { },
warn: () => { },
info: () => { },
log: () => { }
});
var Trace;
(function (Trace) {
Trace[Trace["Off"] = 0] = "Off";
Trace[Trace["Messages"] = 1] = "Messages";
Trace[Trace["Verbose"] = 2] = "Verbose";
})(Trace = exports.Trace || (exports.Trace = {}));
(function (Trace) {
function fromString(value) {
if (!Is.string(value)) {
return Trace.Off;
}
value = value.toLowerCase();
switch (value) {
case 'off':
return Trace.Off;
case 'messages':
return Trace.Messages;
case 'verbose':
return Trace.Verbose;
default:
return Trace.Off;
}
}
Trace.fromString = fromString;
function toString(value) {
switch (value) {
case Trace.Off:
return 'off';
case Trace.Messages:
return 'messages';
case Trace.Verbose:
return 'verbose';
default:
return 'off';
}
}
Trace.toString = toString;
})(Trace = exports.Trace || (exports.Trace = {}));
var TraceFormat;
(function (TraceFormat) {
TraceFormat["Text"] = "text";
TraceFormat["JSON"] = "json";
})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
(function (TraceFormat) {
function fromString(value) {
value = value.toLowerCase();
if (value === 'json') {
return TraceFormat.JSON;
}
else {
return TraceFormat.Text;
}
}
TraceFormat.fromString = fromString;
})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));
var SetTraceNotification;
(function (SetTraceNotification) {
SetTraceNotification.type = new messages_1.NotificationType('$/setTrace');
})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));
var LogTraceNotification;
(function (LogTraceNotification) {
LogTraceNotification.type = new messages_1.NotificationType('$/logTrace');
})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));
var ConnectionErrors;
(function (ConnectionErrors) {
/**
* The connection is closed.
*/
ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";
/**
* The connection got disposed.
*/
ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";
/**
* The connection is already in listening mode.
*/
ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";
})(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));
class ConnectionError extends Error {
constructor(code, message) {
super(message);
this.code = code;
Object.setPrototypeOf(this, ConnectionError.prototype);
}
}
exports.ConnectionError = ConnectionError;
var ConnectionStrategy;
(function (ConnectionStrategy) {
function is(value) {
const candidate = value;
return candidate && Is.func(candidate.cancelUndispatched);
}
ConnectionStrategy.is = is;
})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));
var CancellationReceiverStrategy;
(function (CancellationReceiverStrategy) {
CancellationReceiverStrategy.Message = Object.freeze({
createCancellationTokenSource(_) {
return new cancellation_1.CancellationTokenSource();
}
});
function is(value) {
const candidate = value;
return candidate && Is.func(candidate.createCancellationTokenSource);
}
CancellationReceiverStrategy.is = is;
})(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {}));
var CancellationSenderStrategy;
(function (CancellationSenderStrategy) {
CancellationSenderStrategy.Message = Object.freeze({
sendCancellation(conn, id) {
conn.sendNotification(CancelNotification.type, { id });
},
cleanup(_) { }
});
function is(value) {
const candidate = value;
return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup);
}
CancellationSenderStrategy.is = is;
})(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {}));
var CancellationStrategy;
(function (CancellationStrategy) {
CancellationStrategy.Message = Object.freeze({
receiver: CancellationReceiverStrategy.Message,
sender: CancellationSenderStrategy.Message
});
function is(value) {
const candidate = value;
return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
}
CancellationStrategy.is = is;
})(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {}));
var ConnectionOptions;
(function (ConnectionOptions) {
function is(value) {
const candidate = value;
return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
}
ConnectionOptions.is = is;
})(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {}));
var ConnectionState;
(function (ConnectionState) {
ConnectionState[ConnectionState["New"] = 1] = "New";
ConnectionState[ConnectionState["Listening"] = 2] = "Listening";
ConnectionState[ConnectionState["Closed"] = 3] = "Closed";
ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";
})(ConnectionState || (ConnectionState = {}));
function createMessageConnection(messageReader, messageWriter, _logger, options) {
const logger = _logger !== undefined ? _logger : exports.NullLogger;
let sequenceNumber = 0;
let notificationSquenceNumber = 0;
let unknownResponseSquenceNumber = 0;
const version = '2.0';
let starRequestHandler = undefined;
const requestHandlers = Object.create(null);
let starNotificationHandler = undefined;
const notificationHandlers = Object.create(null);
const progressHandlers = new Map();
let timer;
let messageQueue = new linkedMap_1.LinkedMap();
let responsePromises = Object.create(null);
let requestTokens = Object.create(null);
let trace = Trace.Off;
let traceFormat = TraceFormat.Text;
let tracer;
let state = ConnectionState.New;
const errorEmitter = new events_1.Emitter();
const closeEmitter = new events_1.Emitter();
const unhandledNotificationEmitter = new events_1.Emitter();
const unhandledProgressEmitter = new events_1.Emitter();
const disposeEmitter = new events_1.Emitter();
const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message;
function createRequestQueueKey(id) {
if (id === null) {
throw new Error(`Can't send requests with id null since the response can't be correlated.`);
}
return 'req-' + id.toString();
}
function createResponseQueueKey(id) {
if (id === null) {
return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();
}
else {
return 'res-' + id.toString();
}
}
function createNotificationQueueKey() {
return 'not-' + (++notificationSquenceNumber).toString();
}
function addMessageToQueue(queue, message) {
if (messages_1.isRequestMessage(message)) {
queue.set(createRequestQueueKey(message.id), message);
}
else if (messages_1.isResponseMessage(message)) {
queue.set(createResponseQueueKey(message.id), message);
}
else {
queue.set(createNotificationQueueKey(), message);
}
}
function cancelUndispatched(_message) {
return undefined;
}
function isListening() {
return state === ConnectionState.Listening;
}
function isClosed() {
return state === ConnectionState.Closed;
}
function isDisposed() {
return state === ConnectionState.Disposed;
}
function closeHandler() {
if (state === ConnectionState.New || state === ConnectionState.Listening) {
state = ConnectionState.Closed;
closeEmitter.fire(undefined);
}
// If the connection is disposed don't sent close events.
}
function readErrorHandler(error) {
errorEmitter.fire([error, undefined, undefined]);
}
function writeErrorHandler(data) {
errorEmitter.fire(data);
}
messageReader.onClose(closeHandler);
messageReader.onError(readErrorHandler);
messageWriter.onClose(closeHandler);
messageWriter.onError(writeErrorHandler);
function triggerMessageQueue() {
if (timer || messageQueue.size === 0) {
return;
}
timer = ral_1.default().timer.setImmediate(() => {
timer = undefined;
processMessageQueue();
});
}
function processMessageQueue() {
if (messageQueue.size === 0) {
return;
}
const message = messageQueue.shift();
try {
if (messages_1.isRequestMessage(message)) {
handleRequest(message);
}
else if (messages_1.isNotificationMessage(message)) {
handleNotification(message);
}
else if (messages_1.isResponseMessage(message)) {
handleResponse(message);
}
else {
handleInvalidMessage(message);
}
}
finally {
triggerMessageQueue();
}
}
const callback = (message) => {
try {
// We have received a cancellation message. Check if the message is still in the queue
// and cancel it if allowed to do so.
if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
const key = createRequestQueueKey(message.params.id);
const toCancel = messageQueue.get(key);
if (messages_1.isRequestMessage(toCancel)) {
const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
if (response && (response.error !== undefined || response.result !== undefined)) {
messageQueue.delete(key);
response.id = toCancel.id;
traceSendingResponse(response, message.method, Date.now());
messageWriter.write(response);
return;
}
}
}
addMessageToQueue(messageQueue, message);
}
finally {
triggerMessageQueue();
}
};
function handleRequest(requestMessage) {
if (isDisposed()) {
// we return here silently since we fired an event when the
// connection got disposed.
return;
}
function reply(resultOrError, method, startTime) {
const message = {
jsonrpc: version,
id: requestMessage.id
};
if (resultOrError instanceof messages_1.ResponseError) {
message.error = resultOrError.toJson();
}
else {
message.result = resultOrError === undefined ? null : resultOrError;
}
traceSendingResponse(message, method, startTime);
messageWriter.write(message);
}
function replyError(error, method, startTime) {
const message = {
jsonrpc: version,
id: requestMessage.id,
error: error.toJson()
};
traceSendingResponse(message, method, startTime);
messageWriter.write(message);
}
function replySuccess(result, method, startTime) {
// The JSON RPC defines that a response must either have a result or an error
// So we can't treat undefined as a valid response result.
if (result === undefined) {
result = null;
}
const message = {
jsonrpc: version,
id: requestMessage.id,
result: result
};
traceSendingResponse(message, method, startTime);
messageWriter.write(message);
}
traceReceivedRequest(requestMessage);
const element = requestHandlers[requestMessage.method];
let type;
let requestHandler;
if (element) {
type = element.type;
requestHandler = element.handler;
}
const startTime = Date.now();
if (requestHandler || starRequestHandler) {
const tokenKey = String(requestMessage.id);
const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
requestTokens[tokenKey] = cancellationSource;
try {
let handlerResult;
if (requestHandler) {
if (requestMessage.params === undefined) {
if (type !== undefined && type.numberOfParams !== 0) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
return;
}
handlerResult = requestHandler(cancellationSource.token);
}
else if (Array.isArray(requestMessage.params)) {
if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byName) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
return;
}
handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
}
else {
if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
return;
}
handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
}
}
else if (starRequestHandler) {
handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
}
const promise = handlerResult;
if (!handlerResult) {
delete requestTokens[tokenKey];
replySuccess(handlerResult, requestMessage.method, startTime);
}
else if (promise.then) {
promise.then((resultOrError) => {
delete requestTokens[tokenKey];
reply(resultOrError, requestMessage.method, startTime);
}, error => {
delete requestTokens[tokenKey];
if (error instanceof messages_1.ResponseError) {
replyError(error, requestMessage.method, startTime);
}
else if (error && Is.string(error.message)) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
}
else {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
}
});
}
else {
delete requestTokens[tokenKey];
reply(handlerResult, requestMessage.method, startTime);
}
}
catch (error) {
delete requestTokens[tokenKey];
if (error instanceof messages_1.ResponseError) {
reply(error, requestMessage.method, startTime);
}
else if (error && Is.string(error.message)) {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
}
else {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
}
}
}
else {
replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
}
}
function handleResponse(responseMessage) {
if (isDisposed()) {
// See handle request.
return;
}
if (responseMessage.id === null) {
if (responseMessage.error) {
logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);
}
else {
logger.error(`Received response message without id. No further error information provided.`);
}
}
else {
const key = String(responseMessage.id);
const responsePromise = responsePromises[key];
traceReceivedResponse(responseMessage, responsePromise);
if (responsePromise) {
delete responsePromises[key];
try {
if (responseMessage.error) {
const error = responseMessage.error;
responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
}
else if (responseMessage.result !== undefined) {
responsePromise.resolve(responseMessage.result);
}
else {
throw new Error('Should never happen.');
}
}
catch (error) {
if (error.message) {
logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
}
else {
logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
}
}
}
}
}
function handleNotification(message) {
if (isDisposed()) {
// See handle request.
return;
}
let type = undefined;
let notificationHandler;
if (message.method === CancelNotification.type.method) {
notificationHandler = (params) => {
const id = params.id;
const source = requestTokens[String(id)];
if (source) {
source.cancel();
}
};
}
else {
const element = notificationHandlers[message.method];
if (element) {
notificationHandler = element.handler;
type = element.type;
}
}
if (notificationHandler || starNotificationHandler) {
try {
traceReceivedNotification(message);
if (notificationHandler) {
if (message.params === undefined) {
if (type !== undefined) {
if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
}
}
notificationHandler();
}
else if (Array.isArray(message.params)) {
if (type !== undefined) {
if (type.parameterStructures === messages_1.ParameterStructures.byName) {
logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
}
if (type.numberOfParams !== message.params.length) {
logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
}
}
notificationHandler(...message.params);
}
else {
if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
}
notificationHandler(message.params);
}
}
else if (starNotificationHandler) {
starNotificationHandler(message.method, message.params);
}
}
catch (error) {
if (error.message) {
logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
}
else {
logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
}
}
}
else {
unhandledNotificationEmitter.fire(message);
}
}
function handleInvalidMessage(message) {
if (!message) {
logger.error('Received empty message.');
return;
}
logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);
// Test whether we find an id to reject the promise
const responseMessage = message;
if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {
const key = String(responseMessage.id);
const responseHandler = responsePromises[key];
if (responseHandler) {
responseHandler.reject(new Error('The received response has neither a result nor an error property.'));
}
}
}
function traceSendingRequest(message) {
if (trace === Trace.Off || !tracer) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose && message.params) {
data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
}
tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
}
else {
logLSPMessage('send-request', message);
}
}
function traceSendingNotification(message) {
if (trace === Trace.Off || !tracer) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
}
else {
data = 'No parameters provided.\n\n';
}
}
tracer.log(`Sending notification '${message.method}'.`, data);
}
else {
logLSPMessage('send-notification', message);
}
}
function traceSendingResponse(message, method, startTime) {
if (trace === Trace.Off || !tracer) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
}
else {
if (message.result) {
data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
}
else if (message.error === undefined) {
data = 'No result returned.\n\n';
}
}
}
tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
}
else {
logLSPMessage('send-response', message);
}
}
function traceReceivedRequest(message) {
if (trace === Trace.Off || !tracer) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose && message.params) {
data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
}
tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
}
else {
logLSPMessage('receive-request', message);
}
}
function traceReceivedNotification(message) {
if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose) {
if (message.params) {
data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;
}
else {
data = 'No parameters provided.\n\n';
}
}
tracer.log(`Received notification '${message.method}'.`, data);
}
else {
logLSPMessage('receive-notification', message);
}
}
function traceReceivedResponse(message, responsePromise) {
if (trace === Trace.Off || !tracer) {
return;
}
if (traceFormat === TraceFormat.Text) {
let data = undefined;
if (trace === Trace.Verbose) {
if (message.error && message.error.data) {
data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;
}
else {
if (message.result) {
data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;
}
else if (message.error === undefined) {
data = 'No result returned.\n\n';
}
}
}
if (responsePromise) {
const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';
tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
}
else {
tracer.log(`Received response ${message.id} without active response promise.`, data);
}
}
else {
logLSPMessage('receive-response', message);
}
}
function logLSPMessage(type, message) {
if (!tracer || trace === Trace.Off) {
return;
}
const lspMessage = {
isLSPMessage: true,
type,
message,
timestamp: Date.now()
};
tracer.log(lspMessage);
}
function throwIfClosedOrDisposed() {
if (isClosed()) {
throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');
}
if (isDisposed()) {
throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');
}
}
function throwIfListening() {
if (isListening()) {
throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');
}
}
function throwIfNotListening() {
if (!isListening()) {
throw new Error('Call listen() first.');
}
}
function undefinedToNull(param) {
if (param === undefined) {
return null;
}
else {
return param;
}
}
function nullToUndefined(param) {
if (param === null) {
return undefined;
}
else {
return param;
}
}
function isNamedParam(param) {
return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';
}
function computeSingleParam(parameterStructures, param) {
switch (parameterStructures) {
case messages_1.ParameterStructures.auto:
if (isNamedParam(param)) {
return nullToUndefined(param);
}
else {
return [undefinedToNull(param)];
}
break;
case messages_1.ParameterStructures.byName:
if (!isNamedParam(param)) {
throw new Error(`Recevied parameters by name but param is not an object literal.`);
}
return nullToUndefined(param);
case messages_1.ParameterStructures.byPosition:
return [undefinedToNull(param)];
default:
throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
}
}
function computeMessageParams(type, params) {
let result;
const numberOfParams = type.numberOfParams;
switch (numberOfParams) {
case 0:
result = undefined;
break;
case 1:
result = computeSingleParam(type.parameterStructures, params[0]);
break;
default:
result = [];
for (let i = 0; i < params.length && i < numberOfParams; i++) {
result.push(undefinedToNull(params[i]));
}
if (params.length < numberOfParams) {
for (let i = params.length; i < numberOfParams; i++) {
result.push(null);
}
}
break;
}
return result;
}
const connection = {
sendNotification: (type, ...args) => {
throwIfClosedOrDisposed();
let method;
let messageParams;
if (Is.string(type)) {
method = type;
const first = args[0];
let paramStart = 0;
let parameterStructures = messages_1.ParameterStructures.auto;
if (messages_1.ParameterStructures.is(first)) {
paramStart = 1;
parameterStructures = first;
}
let paramEnd = args.length;
const numberOfParams = paramEnd - paramStart;
switch (numberOfParams) {
case 0:
messageParams = undefined;
break;
case 1:
messageParams = computeSingleParam(parameterStructures, args[paramStart]);
break;
default:
if (parameterStructures === messages_1.ParameterStructures.byName) {
throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
}
messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
break;
}
}
else {
const params = args;
method = type.method;
messageParams = computeMessageParams(type, params);
}
const notificationMessage = {
jsonrpc: version,
method: method,
params: messageParams
};
traceSendingNotification(notificationMessage);
messageWriter.write(notificationMessage);
},
onNotification: (type, handler) => {
throwIfClosedOrDisposed();
let method;
if (Is.func(type)) {
starNotificationHandler = type;
}
else if (handler) {
if (Is.string(type)) {
method = type;
notificationHandlers[type] = { type: undefined, handler };
}
else {
method = type.method;
notificationHandlers[type.method] = { type, handler };
}
}
return {
dispose: () => {
if (method !== undefined) {
delete notificationHandlers[method];
}
else {
starNotificationHandler = undefined;
}
}
};
},
onProgress: (_type, token, handler) => {
if (progressHandlers.has(token)) {
throw new Error(`Progress handler for token ${token} already registered`);
}
progressHandlers.set(token, handler);
return {
dispose: () => {
progressHandlers.delete(token);
}
};
},
sendProgress: (_type, token, value) => {
connection.sendNotification(ProgressNotification.type, { token, value });
},
onUnhandledProgress: unhandledProgressEmitter.event,
sendRequest: (type, ...args) => {
throwIfClosedOrDisposed();
throwIfNotListening();
let method;
let messageParams;
let token = undefined;
if (Is.string(type)) {
method = type;
const first = args[0];
const last = args[args.length - 1];
let paramStart = 0;
let parameterStructures = messages_1.ParameterStructures.auto;
if (messages_1.ParameterStructures.is(first)) {
paramStart = 1;
parameterStructures = first;
}
let paramEnd = args.length;
if (cancellation_1.CancellationToken.is(last)) {
paramEnd = paramEnd - 1;
token = last;
}
const numberOfParams = paramEnd - paramStart;
switch (numberOfParams) {
case 0:
messageParams = undefined;
break;
case 1:
messageParams = computeSingleParam(parameterStructures, args[paramStart]);
break;
default:
if (parameterStructures === messages_1.ParameterStructures.byName) {
throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
}
messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value));
break;
}
}
else {
const params = args;
method = type.method;
messageParams = computeMessageParams(type, params);
const numberOfParams = type.numberOfParams;
token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;
}
const id = sequenceNumber++;
let disposable;
if (token) {
disposable = token.onCancellationRequested(() => {
cancellationStrategy.sender.sendCancellation(connection, id);
});
}
const result = new Promise((resolve, reject) => {
const requestMessage = {
jsonrpc: version,
id: id,
method: method,
params: messageParams
};
const resolveWithCleanup = (r) => {
resolve(r);
cancellationStrategy.sender.cleanup(id);
disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
};
const rejectWithCleanup = (r) => {
reject(r);
cancellationStrategy.sender.cleanup(id);
disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
};
let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
traceSendingRequest(requestMessage);
try {
messageWriter.write(requestMessage);
}
catch (e) {
// Writing the message failed. So we need to reject the promise.
responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
responsePromise = null;
}
if (responsePromise) {
responsePromises[String(id)] = responsePromise;
}
});
return result;
},
onRequest: (type, handler) => {
throwIfClosedOrDisposed();
let method = null;
if (StarRequestHandler.is(type)) {
method = undefined;
starRequestHandler = type;
}
else if (Is.string(type)) {
method = null;
if (handler !== undefined) {
method = type;
requestHandlers[type] = { handler: handler, type: undefined };
}
}
else {
if (handler !== undefined) {
method = type.method;
requestHandlers[type.method] = { type, handler };
}
}
return {
dispose: () => {
if (method === null) {
return;
}
if (method !== undefined) {
delete requestHandlers[method];
}
else {
starRequestHandler = undefined;
}
}
};
},
trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
let _sendNotification = false;
let _traceFormat = TraceFormat.Text;
if (sendNotificationOrTraceOptions !== undefined) {
if (Is.boolean(sendNotificationOrTraceOptions)) {
_sendNotification = sendNotificationOrTraceOptions;
}
else {
_sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
_traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
}
}
trace = _value;
traceFormat = _traceFormat;
if (trace === Trace.Off) {
tracer = undefined;
}
else {
tracer = _tracer;
}
if (_sendNotification && !isClosed() && !isDisposed()) {
connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
}
},
onError: errorEmitter.event,
onClose: closeEmitter.event,
onUnhandledNotification: unhandledNotificationEmitter.event,
onDispose: disposeEmitter.event,
end: () => {
messageWriter.end();
},
dispose: () => {
if (isDisposed()) {
return;
}
state = ConnectionState.Disposed;
disposeEmitter.fire(undefined);
const error = new Error('Connection got disposed.');
Object.keys(responsePromises).forEach((key) => {
responsePromises[key].reject(error);
});
responsePromises = Object.create(null);
requestTokens = Object.create(null);
messageQueue = new linkedMap_1.LinkedMap();
// Test for backwards compatibility
if (Is.func(messageWriter.dispose)) {
messageWriter.dispose();
}
if (Is.func(messageReader.dispose)) {
messageReader.dispose();
}
},
listen: () => {
throwIfClosedOrDisposed();
throwIfListening();
state = ConnectionState.Listening;
messageReader.listen(callback);
},
inspect: () => {
// eslint-disable-next-line no-console
ral_1.default().console.log('inspect');
}
};
connection.onNotification(LogTraceNotification.type, (params) => {
if (trace === Trace.Off || !tracer) {
return;
}
tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);
});
connection.onNotification(ProgressNotification.type, (params) => {
const handler = progressHandlers.get(params.token);
if (handler) {
handler(params.value);
}
else {
unhandledProgressEmitter.fire(params);
}
});
return connection;
}
exports.createMessageConnection = createMessageConnection;
//# sourceMappingURL=connection.js.map
/***/ }),
/* 21 */
/***/ ((__unused_webpack_module, exports) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LRUCache = exports.LinkedMap = exports.Touch = void 0;
var Touch;
(function (Touch) {
Touch.None = 0;
Touch.First = 1;
Touch.AsOld = Touch.First;
Touch.Last = 2;
Touch.AsNew = Touch.Last;
})(Touch = exports.Touch || (exports.Touch = {}));
class LinkedMap {
constructor() {
this[Symbol.toStringTag] = 'LinkedMap';
this._map = new Map();
this._head = undefined;
this._tail = undefined;
this._size = 0;
this._state = 0;
}
clear() {
this._map.clear();
this._head = undefined;
this._tail = undefined;
this._size = 0;
this._state++;
}
isEmpty() {
return !this._head && !this._tail;
}
get size() {
return this._size;
}
get first() {
var _a;
return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
}
get last() {
var _a;
return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
}
has(key) {
return this._map.has(key);
}
get(key, touch = Touch.None) {
const item = this._map.get(key);
if (!item) {
return undefined;
}
if (touch !== Touch.None) {
this.touch(item, touch);
}
return item.value;
}
set(key, value, touch = Touch.None) {
let item = this._map.get(key);
if (item) {
item.value = value;
if (touch !== Touch.None) {
this.touch(item, touch);
}
}
else {
item = { key, value, next: undefined, previous: undefined };
switch (touch) {
case Touch.None:
this.addItemLast(item);
break;
case Touch.First:
this.addItemFirst(item);
break;
case Touch.Last:
this.addItemLast(item);
break;
default:
this.addItemLast(item);
break;
}
this._map.set(key, item);
this._size++;
}
return this;
}
delete(key) {
return !!this.remove(key);
}
remove(key) {
const item = this._map.get(key);
if (!item) {
return undefined;
}
this._map.delete(key);
this.removeItem(item);
this._size--;
return item.value;
}
shift() {
if (!this._head && !this._tail) {
return undefined;
}
if (!this._head || !this._tail) {
throw new Error('Invalid list');
}
const item = this._head;
this._map.delete(item.key);
this.removeItem(item);
this._size--;
return item.value;
}
forEach(callbackfn, thisArg) {
const state = this._state;
let current = this._head;
while (current) {
if (thisArg) {
callbackfn.bind(thisArg)(current.value, current.key, this);
}
else {
callbackfn(current.value, current.key, this);
}
if (this._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
current = current.next;
}
}
keys() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: current.key, done: false };
current = current.next;
return result;
}
else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
values() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: current.value, done: false };
current = current.next;
return result;
}
else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
entries() {
const map = this;
const state = this._state;
let current = this._head;
const iterator = {
[Symbol.iterator]() {
return iterator;
},
next() {
if (map._state !== state) {
throw new Error(`LinkedMap got modified during iteration.`);
}
if (current) {
const result = { value: [current.key, current.value], done: false };
current = current.next;
return result;
}
else {
return { value: undefined, done: true };
}
}
};
return iterator;
}
[Symbol.iterator]() {
return this.entries();
}
trimOld(newSize) {
if (newSize >= this.size) {
return;
}
if (newSize === 0) {
this.clear();
return;
}
let current = this._head;
let currentSize = this.size;
while (current && currentSize > newSize) {
this._map.delete(current.key);
current = current.next;
currentSize--;
}
this._head = current;
this._size = currentSize;
if (current) {
current.previous = undefined;
}
this._state++;
}
addItemFirst(item) {
// First time Insert
if (!this._head && !this._tail) {
this._tail = item;
}
else if (!this._head) {
throw new Error('Invalid list');
}
else {
item.next = this._head;
this._head.previous = item;
}
this._head = item;
this._state++;
}
addItemLast(item) {
// First time Insert
if (!this._head && !this._tail) {
this._head = item;
}
else if (!this._tail) {
throw new Error('Invalid list');
}
else {
item.previous = this._tail;
this._tail.next = item;
}
this._tail = item;
this._state++;
}
removeItem(item) {
if (item === this._head && item === this._tail) {
this._head = undefined;
this._tail = undefined;
}
else if (item === this._head) {
// This can only happend if size === 1 which is handle
// by the case above.
if (!item.next) {
throw new Error('Invalid list');
}
item.next.previous = undefined;
this._head = item.next;
}
else if (item === this._tail) {
// This can only happend if size === 1 which is handle
// by the case above.
if (!item.previous) {
throw new Error('Invalid list');
}
item.previous.next = undefined;
this._tail = item.previous;
}
else {
const next = item.next;
const previous = item.previous;
if (!next || !previous) {
throw new Error('Invalid list');
}
next.previous = previous;
previous.next = next;
}
item.next = undefined;
item.previous = undefined;
this._state++;
}
touch(item, touch) {
if (!this._head || !this._tail) {
throw new Error('Invalid list');
}
if ((touch !== Touch.First && touch !== Touch.Last)) {
return;
}
if (touch === Touch.First) {
if (item === this._head) {
return;
}
const next = item.next;
const previous = item.previous;
// Unlink the item
if (item === this._tail) {
// previous must be defined since item was not head but is tail
// So there are more than on item in the map
previous.next = undefined;
this._tail = previous;
}
else {
// Both next and previous are not undefined since item was neither head nor tail.
next.previous = previous;
previous.next = next;
}
// Insert the node at head
item.previous = undefined;
item.next = this._head;
this._head.previous = item;
this._head = item;
this._state++;
}
else if (touch === Touch.Last) {
if (item === this._tail) {
return;
}
const next = item.next;
const previous = item.previous;
// Unlink the item.
if (item === this._head) {
// next must be defined since item was not tail but is head
// So there are more than on item in the map
next.previous = undefined;
this._head = next;
}
else {
// Both next and previous are not undefined since item was neither head nor tail.
next.previous = previous;
previous.next = next;
}
item.next = undefined;
item.previous = this._tail;
this._tail.next = item;
this._tail = item;
this._state++;
}
}
toJSON() {
const data = [];
this.forEach((value, key) => {
data.push([key, value]);
});
return data;
}
fromJSON(data) {
this.clear();
for (const [key, value] of data) {
this.set(key, value);
}
}
}
exports.LinkedMap = LinkedMap;
class LRUCache extends LinkedMap {
constructor(limit, ratio = 1) {
super();
this._limit = limit;
this._ratio = Math.min(Math.max(0, ratio), 1);
}
get limit() {
return this._limit;
}
set limit(limit) {
this._limit = limit;
this.checkTrim();
}
get ratio() {
return this._ratio;
}
set ratio(ratio) {
this._ratio = Math.min(Math.max(0, ratio), 1);
this.checkTrim();
}
get(key, touch = Touch.AsNew) {
return super.get(key, touch);
}
peek(key) {
return super.get(key, Touch.None);
}
set(key, value) {
super.set(key, value, Touch.Last);
this.checkTrim();
return this;
}
checkTrim() {
if (this.size > this._limit) {
this.trimOld(Math.round(this._limit * this._ratio));
}
}
}
exports.LRUCache = LRUCache;
//# sourceMappingURL=linkedMap.js.map
/***/ }),
/* 22 */
/***/ ((module) => {
module.exports = require("os");;
/***/ }),
/* 23 */
/***/ ((module) => {
module.exports = require("crypto");;
/***/ }),
/* 24 */
/***/ ((module) => {
module.exports = require("net");;
/***/ }),
/* 25 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LSPErrorCodes = exports.createProtocolConnection = void 0;
__exportStar(__webpack_require__(6), exports);
__exportStar(__webpack_require__(26), exports);
__exportStar(__webpack_require__(27), exports);
__exportStar(__webpack_require__(28), exports);
var connection_1 = __webpack_require__(45);
Object.defineProperty(exports, "createProtocolConnection", ({ enumerable: true, get: function () { return connection_1.createProtocolConnection; } }));
var LSPErrorCodes;
(function (LSPErrorCodes) {
/**
* This is the start range of LSP reserved error codes.
* It doesn't denote a real error code.
*
* @since 3.16.0
*/
LSPErrorCodes.lspReservedErrorRangeStart = -32899;
LSPErrorCodes.ContentModified = -32801;
LSPErrorCodes.RequestCancelled = -32800;
/**
* This is the end range of LSP reserved error codes.
* It doesn't denote a real error code.
*
* @since 3.16.0
*/
LSPErrorCodes.lspReservedErrorRangeEnd = -32800;
})(LSPErrorCodes = exports.LSPErrorCodes || (exports.LSPErrorCodes = {}));
//# sourceMappingURL=api.js.map
/***/ }),
/* 26 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "integer": () => /* binding */ integer,
/* harmony export */ "uinteger": () => /* binding */ uinteger,
/* harmony export */ "Position": () => /* binding */ Position,
/* harmony export */ "Range": () => /* binding */ Range,
/* harmony export */ "Location": () => /* binding */ Location,
/* harmony export */ "LocationLink": () => /* binding */ LocationLink,
/* harmony export */ "Color": () => /* binding */ Color,
/* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
/* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
/* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
/* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
/* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
/* harmony export */ "CodeDescription": () => /* binding */ CodeDescription,
/* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
/* harmony export */ "Command": () => /* binding */ Command,
/* harmony export */ "TextEdit": () => /* binding */ TextEdit,
/* harmony export */ "ChangeAnnotation": () => /* binding */ ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* binding */ ChangeAnnotationIdentifier,
/* harmony export */ "AnnotatedTextEdit": () => /* binding */ AnnotatedTextEdit,
/* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
/* harmony export */ "CreateFile": () => /* binding */ CreateFile,
/* harmony export */ "RenameFile": () => /* binding */ RenameFile,
/* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
/* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
/* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
/* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* binding */ OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
/* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
/* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
/* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
/* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
/* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
/* harmony export */ "InsertReplaceEdit": () => /* binding */ InsertReplaceEdit,
/* harmony export */ "InsertTextMode": () => /* binding */ InsertTextMode,
/* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
/* harmony export */ "CompletionList": () => /* binding */ CompletionList,
/* harmony export */ "MarkedString": () => /* binding */ MarkedString,
/* harmony export */ "Hover": () => /* binding */ Hover,
/* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
/* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
/* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
/* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
/* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
/* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
/* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
/* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
/* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
/* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
/* harmony export */ "CodeAction": () => /* binding */ CodeAction,
/* harmony export */ "CodeLens": () => /* binding */ CodeLens,
/* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
/* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
/* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
/* harmony export */ "EOL": () => /* binding */ EOL,
/* harmony export */ "TextDocument": () => /* binding */ TextDocument
/* harmony export */ });
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var integer;
(function (integer) {
integer.MIN_VALUE = -2147483648;
integer.MAX_VALUE = 2147483647;
})(integer || (integer = {}));
var uinteger;
(function (uinteger) {
uinteger.MIN_VALUE = 0;
uinteger.MAX_VALUE = 2147483647;
})(uinteger || (uinteger = {}));
/**
* The Position namespace provides helper functions to work with
* [Position](#Position) literals.
*/
var Position;
(function (Position) {
/**
* Creates a new Position literal from the given line and character.
* @param line The position's line.
* @param character The position's character.
*/
function create(line, character) {
if (line === Number.MAX_VALUE) {
line = uinteger.MAX_VALUE;
}
if (character === Number.MAX_VALUE) {
character = uinteger.MAX_VALUE;
}
return { line: line, character: character };
}
Position.create = create;
/**
* Checks whether the given literal conforms to the [Position](#Position) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
}
Position.is = is;
})(Position || (Position = {}));
/**
* The Range namespace provides helper functions to work with
* [Range](#Range) literals.
*/
var Range;
(function (Range) {
function create(one, two, three, four) {
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
return { start: Position.create(one, two), end: Position.create(three, four) };
}
else if (Position.is(one) && Position.is(two)) {
return { start: one, end: two };
}
else {
throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
}
}
Range.create = create;
/**
* Checks whether the given literal conforms to the [Range](#Range) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
}
Range.is = is;
})(Range || (Range = {}));
/**
* The Location namespace provides helper functions to work with
* [Location](#Location) literals.
*/
var Location;
(function (Location) {
/**
* Creates a Location literal.
* @param uri The location's uri.
* @param range The location's range.
*/
function create(uri, range) {
return { uri: uri, range: range };
}
Location.create = create;
/**
* Checks whether the given literal conforms to the [Location](#Location) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
}
Location.is = is;
})(Location || (Location = {}));
/**
* The LocationLink namespace provides helper functions to work with
* [LocationLink](#LocationLink) literals.
*/
var LocationLink;
(function (LocationLink) {
/**
* Creates a LocationLink literal.
* @param targetUri The definition's uri.
* @param targetRange The full range of the definition.
* @param targetSelectionRange The span of the symbol definition at the target.
* @param originSelectionRange The span of the symbol being defined in the originating source file.
*/
function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
}
LocationLink.create = create;
/**
* Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
&& (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
&& (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
}
LocationLink.is = is;
})(LocationLink || (LocationLink = {}));
/**
* The Color namespace provides helper functions to work with
* [Color](#Color) literals.
*/
var Color;
(function (Color) {
/**
* Creates a new Color literal.
*/
function create(red, green, blue, alpha) {
return {
red: red,
green: green,
blue: blue,
alpha: alpha,
};
}
Color.create = create;
/**
* Checks whether the given literal conforms to the [Color](#Color) interface.
*/
function is(value) {
var candidate = value;
return Is.numberRange(candidate.red, 0, 1)
&& Is.numberRange(candidate.green, 0, 1)
&& Is.numberRange(candidate.blue, 0, 1)
&& Is.numberRange(candidate.alpha, 0, 1);
}
Color.is = is;
})(Color || (Color = {}));
/**
* The ColorInformation namespace provides helper functions to work with
* [ColorInformation](#ColorInformation) literals.
*/
var ColorInformation;
(function (ColorInformation) {
/**
* Creates a new ColorInformation literal.
*/
function create(range, color) {
return {
range: range,
color: color,
};
}
ColorInformation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Range.is(candidate.range) && Color.is(candidate.color);
}
ColorInformation.is = is;
})(ColorInformation || (ColorInformation = {}));
/**
* The Color namespace provides helper functions to work with
* [ColorPresentation](#ColorPresentation) literals.
*/
var ColorPresentation;
(function (ColorPresentation) {
/**
* Creates a new ColorInformation literal.
*/
function create(label, textEdit, additionalTextEdits) {
return {
label: label,
textEdit: textEdit,
additionalTextEdits: additionalTextEdits,
};
}
ColorPresentation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.string(candidate.label)
&& (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
&& (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
}
ColorPresentation.is = is;
})(ColorPresentation || (ColorPresentation = {}));
/**
* Enum of known range kinds
*/
var FoldingRangeKind;
(function (FoldingRangeKind) {
/**
* Folding range for a comment
*/
FoldingRangeKind["Comment"] = "comment";
/**
* Folding range for a imports or includes
*/
FoldingRangeKind["Imports"] = "imports";
/**
* Folding range for a region (e.g. `#region`)
*/
FoldingRangeKind["Region"] = "region";
})(FoldingRangeKind || (FoldingRangeKind = {}));
/**
* The folding range namespace provides helper functions to work with
* [FoldingRange](#FoldingRange) literals.
*/
var FoldingRange;
(function (FoldingRange) {
/**
* Creates a new FoldingRange literal.
*/
function create(startLine, endLine, startCharacter, endCharacter, kind) {
var result = {
startLine: startLine,
endLine: endLine
};
if (Is.defined(startCharacter)) {
result.startCharacter = startCharacter;
}
if (Is.defined(endCharacter)) {
result.endCharacter = endCharacter;
}
if (Is.defined(kind)) {
result.kind = kind;
}
return result;
}
FoldingRange.create = create;
/**
* Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
*/
function is(value) {
var candidate = value;
return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
&& (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
&& (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
&& (Is.undefined(candidate.kind) || Is.string(candidate.kind));
}
FoldingRange.is = is;
})(FoldingRange || (FoldingRange = {}));
/**
* The DiagnosticRelatedInformation namespace provides helper functions to work with
* [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
*/
var DiagnosticRelatedInformation;
(function (DiagnosticRelatedInformation) {
/**
* Creates a new DiagnosticRelatedInformation literal.
*/
function create(location, message) {
return {
location: location,
message: message
};
}
DiagnosticRelatedInformation.create = create;
/**
* Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
}
DiagnosticRelatedInformation.is = is;
})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
/**
* The diagnostic's severity.
*/
var DiagnosticSeverity;
(function (DiagnosticSeverity) {
/**
* Reports an error.
*/
DiagnosticSeverity.Error = 1;
/**
* Reports a warning.
*/
DiagnosticSeverity.Warning = 2;
/**
* Reports an information.
*/
DiagnosticSeverity.Information = 3;
/**
* Reports a hint.
*/
DiagnosticSeverity.Hint = 4;
})(DiagnosticSeverity || (DiagnosticSeverity = {}));
/**
* The diagnostic tags.
*
* @since 3.15.0
*/
var DiagnosticTag;
(function (DiagnosticTag) {
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out instead of having
* an error squiggle.
*/
DiagnosticTag.Unnecessary = 1;
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
DiagnosticTag.Deprecated = 2;
})(DiagnosticTag || (DiagnosticTag = {}));
/**
* The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
*
* @since 3.16.0
*/
var CodeDescription;
(function (CodeDescription) {
function is(value) {
var candidate = value;
return candidate !== undefined && candidate !== null && Is.string(candidate.href);
}
CodeDescription.is = is;
})(CodeDescription || (CodeDescription = {}));
/**
* The Diagnostic namespace provides helper functions to work with
* [Diagnostic](#Diagnostic) literals.
*/
var Diagnostic;
(function (Diagnostic) {
/**
* Creates a new Diagnostic literal.
*/
function create(range, message, severity, code, source, relatedInformation) {
var result = { range: range, message: message };
if (Is.defined(severity)) {
result.severity = severity;
}
if (Is.defined(code)) {
result.code = code;
}
if (Is.defined(source)) {
result.source = source;
}
if (Is.defined(relatedInformation)) {
result.relatedInformation = relatedInformation;
}
return result;
}
Diagnostic.create = create;
/**
* Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
*/
function is(value) {
var _a;
var candidate = value;
return Is.defined(candidate)
&& Range.is(candidate.range)
&& Is.string(candidate.message)
&& (Is.number(candidate.severity) || Is.undefined(candidate.severity))
&& (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
&& (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
&& (Is.string(candidate.source) || Is.undefined(candidate.source))
&& (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
}
Diagnostic.is = is;
})(Diagnostic || (Diagnostic = {}));
/**
* The Command namespace provides helper functions to work with
* [Command](#Command) literals.
*/
var Command;
(function (Command) {
/**
* Creates a new Command literal.
*/
function create(title, command) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var result = { title: title, command: command };
if (Is.defined(args) && args.length > 0) {
result.arguments = args;
}
return result;
}
Command.create = create;
/**
* Checks whether the given literal conforms to the [Command](#Command) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
}
Command.is = is;
})(Command || (Command = {}));
/**
* The TextEdit namespace provides helper function to create replace,
* insert and delete edits more easily.
*/
var TextEdit;
(function (TextEdit) {
/**
* Creates a replace text edit.
* @param range The range of text to be replaced.
* @param newText The new text.
*/
function replace(range, newText) {
return { range: range, newText: newText };
}
TextEdit.replace = replace;
/**
* Creates a insert text edit.
* @param position The position to insert the text at.
* @param newText The text to be inserted.
*/
function insert(position, newText) {
return { range: { start: position, end: position }, newText: newText };
}
TextEdit.insert = insert;
/**
* Creates a delete text edit.
* @param range The range of text to be deleted.
*/
function del(range) {
return { range: range, newText: '' };
}
TextEdit.del = del;
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate)
&& Is.string(candidate.newText)
&& Range.is(candidate.range);
}
TextEdit.is = is;
})(TextEdit || (TextEdit = {}));
var ChangeAnnotation;
(function (ChangeAnnotation) {
function create(label, needsConfirmation, description) {
var result = { label: label };
if (needsConfirmation !== undefined) {
result.needsConfirmation = needsConfirmation;
}
if (description !== undefined) {
result.description = description;
}
return result;
}
ChangeAnnotation.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
(Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
(Is.string(candidate.description) || candidate.description === undefined);
}
ChangeAnnotation.is = is;
})(ChangeAnnotation || (ChangeAnnotation = {}));
var ChangeAnnotationIdentifier;
(function (ChangeAnnotationIdentifier) {
function is(value) {
var candidate = value;
return typeof candidate === 'string';
}
ChangeAnnotationIdentifier.is = is;
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
var AnnotatedTextEdit;
(function (AnnotatedTextEdit) {
/**
* Creates an annotated replace text edit.
*
* @param range The range of text to be replaced.
* @param newText The new text.
* @param annotation The annotation.
*/
function replace(range, newText, annotation) {
return { range: range, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.replace = replace;
/**
* Creates an annotated insert text edit.
*
* @param position The position to insert the text at.
* @param newText The text to be inserted.
* @param annotation The annotation.
*/
function insert(position, newText, annotation) {
return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.insert = insert;
/**
* Creates an annotated delete text edit.
*
* @param range The range of text to be deleted.
* @param annotation The annotation.
*/
function del(range, annotation) {
return { range: range, newText: '', annotationId: annotation };
}
AnnotatedTextEdit.del = del;
function is(value) {
var candidate = value;
return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
AnnotatedTextEdit.is = is;
})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
/**
* The TextDocumentEdit namespace provides helper function to create
* an edit that manipulates a text document.
*/
var TextDocumentEdit;
(function (TextDocumentEdit) {
/**
* Creates a new `TextDocumentEdit`
*/
function create(textDocument, edits) {
return { textDocument: textDocument, edits: edits };
}
TextDocumentEdit.create = create;
function is(value) {
var candidate = value;
return Is.defined(candidate)
&& OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
&& Array.isArray(candidate.edits);
}
TextDocumentEdit.is = is;
})(TextDocumentEdit || (TextDocumentEdit = {}));
var CreateFile;
(function (CreateFile) {
function create(uri, options, annotation) {
var result = {
kind: 'create',
uri: uri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
CreateFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
CreateFile.is = is;
})(CreateFile || (CreateFile = {}));
var RenameFile;
(function (RenameFile) {
function create(oldUri, newUri, options, annotation) {
var result = {
kind: 'rename',
oldUri: oldUri,
newUri: newUri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
RenameFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
RenameFile.is = is;
})(RenameFile || (RenameFile = {}));
var DeleteFile;
(function (DeleteFile) {
function create(uri, options, annotation) {
var result = {
kind: 'delete',
uri: uri
};
if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
DeleteFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
DeleteFile.is = is;
})(DeleteFile || (DeleteFile = {}));
var WorkspaceEdit;
(function (WorkspaceEdit) {
function is(value) {
var candidate = value;
return candidate &&
(candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
(candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
if (Is.string(change.kind)) {
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
}
else {
return TextDocumentEdit.is(change);
}
}));
}
WorkspaceEdit.is = is;
})(WorkspaceEdit || (WorkspaceEdit = {}));
var TextEditChangeImpl = /** @class */ (function () {
function TextEditChangeImpl(edits, changeAnnotations) {
this.edits = edits;
this.changeAnnotations = changeAnnotations;
}
TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.insert(position, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.insert(position, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.insert(position, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.replace(range, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.replace(range, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.replace(range, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.delete = function (range, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.del(range);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.del(range, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.del(range, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.add = function (edit) {
this.edits.push(edit);
};
TextEditChangeImpl.prototype.all = function () {
return this.edits;
};
TextEditChangeImpl.prototype.clear = function () {
this.edits.splice(0, this.edits.length);
};
TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
if (value === undefined) {
throw new Error("Text edit change is not configured to manage change annotations.");
}
};
return TextEditChangeImpl;
}());
/**
* A helper class
*/
var ChangeAnnotations = /** @class */ (function () {
function ChangeAnnotations(annotations) {
this._annotations = annotations === undefined ? Object.create(null) : annotations;
this._counter = 0;
this._size = 0;
}
ChangeAnnotations.prototype.all = function () {
return this._annotations;
};
Object.defineProperty(ChangeAnnotations.prototype, "size", {
get: function () {
return this._size;
},
enumerable: false,
configurable: true
});
ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
var id;
if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
id = idOrAnnotation;
}
else {
id = this.nextId();
annotation = idOrAnnotation;
}
if (this._annotations[id] !== undefined) {
throw new Error("Id " + id + " is already in use.");
}
if (annotation === undefined) {
throw new Error("No annotation provided for id " + id);
}
this._annotations[id] = annotation;
this._size++;
return id;
};
ChangeAnnotations.prototype.nextId = function () {
this._counter++;
return this._counter.toString();
};
return ChangeAnnotations;
}());
/**
* A workspace change helps constructing changes to a workspace.
*/
var WorkspaceChange = /** @class */ (function () {
function WorkspaceChange(workspaceEdit) {
var _this = this;
this._textEditChanges = Object.create(null);
if (workspaceEdit !== undefined) {
this._workspaceEdit = workspaceEdit;
if (workspaceEdit.documentChanges) {
this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
workspaceEdit.changeAnnotations = this._changeAnnotations.all();
workspaceEdit.documentChanges.forEach(function (change) {
if (TextDocumentEdit.is(change)) {
var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
_this._textEditChanges[change.textDocument.uri] = textEditChange;
}
});
}
else if (workspaceEdit.changes) {
Object.keys(workspaceEdit.changes).forEach(function (key) {
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
_this._textEditChanges[key] = textEditChange;
});
}
}
else {
this._workspaceEdit = {};
}
}
Object.defineProperty(WorkspaceChange.prototype, "edit", {
/**
* Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
* use to be returned from a workspace edit operation like rename.
*/
get: function () {
this.initDocumentChanges();
if (this._changeAnnotations !== undefined) {
if (this._changeAnnotations.size === 0) {
this._workspaceEdit.changeAnnotations = undefined;
}
else {
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
}
return this._workspaceEdit;
},
enumerable: false,
configurable: true
});
WorkspaceChange.prototype.getTextEditChange = function (key) {
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var textDocument = { uri: key.uri, version: key.version };
var result = this._textEditChanges[textDocument.uri];
if (!result) {
var edits = [];
var textDocumentEdit = {
textDocument: textDocument,
edits: edits
};
this._workspaceEdit.documentChanges.push(textDocumentEdit);
result = new TextEditChangeImpl(edits, this._changeAnnotations);
this._textEditChanges[textDocument.uri] = result;
}
return result;
}
else {
this.initChanges();
if (this._workspaceEdit.changes === undefined) {
throw new Error('Workspace edit is not configured for normal text edit changes.');
}
var result = this._textEditChanges[key];
if (!result) {
var edits = [];
this._workspaceEdit.changes[key] = edits;
result = new TextEditChangeImpl(edits);
this._textEditChanges[key] = result;
}
return result;
}
};
WorkspaceChange.prototype.initDocumentChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._changeAnnotations = new ChangeAnnotations();
this._workspaceEdit.documentChanges = [];
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
};
WorkspaceChange.prototype.initChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._workspaceEdit.changes = Object.create(null);
}
};
WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = CreateFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = CreateFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = RenameFile.create(oldUri, newUri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = RenameFile.create(oldUri, newUri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = DeleteFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = DeleteFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
return WorkspaceChange;
}());
/**
* The TextDocumentIdentifier namespace provides helper functions to work with
* [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
*/
var TextDocumentIdentifier;
(function (TextDocumentIdentifier) {
/**
* Creates a new TextDocumentIdentifier literal.
* @param uri The document's uri.
*/
function create(uri) {
return { uri: uri };
}
TextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri);
}
TextDocumentIdentifier.is = is;
})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
/**
* The VersionedTextDocumentIdentifier namespace provides helper functions to work with
* [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
*/
var VersionedTextDocumentIdentifier;
(function (VersionedTextDocumentIdentifier) {
/**
* Creates a new VersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
VersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
}
VersionedTextDocumentIdentifier.is = is;
})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
/**
* The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
* [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
*/
var OptionalVersionedTextDocumentIdentifier;
(function (OptionalVersionedTextDocumentIdentifier) {
/**
* Creates a new OptionalVersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
OptionalVersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
}
OptionalVersionedTextDocumentIdentifier.is = is;
})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
/**
* The TextDocumentItem namespace provides helper functions to work with
* [TextDocumentItem](#TextDocumentItem) literals.
*/
var TextDocumentItem;
(function (TextDocumentItem) {
/**
* Creates a new TextDocumentItem literal.
* @param uri The document's uri.
* @param languageId The document's language identifier.
* @param version The document's version number.
* @param text The document's text.
*/
function create(uri, languageId, version, text) {
return { uri: uri, languageId: languageId, version: version, text: text };
}
TextDocumentItem.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
}
TextDocumentItem.is = is;
})(TextDocumentItem || (TextDocumentItem = {}));
/**
* Describes the content type that a client supports in various
* result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
*
* Please note that `MarkupKinds` must not start with a `$`. This kinds
* are reserved for internal usage.
*/
var MarkupKind;
(function (MarkupKind) {
/**
* Plain text is supported as a content format
*/
MarkupKind.PlainText = 'plaintext';
/**
* Markdown is supported as a content format
*/
MarkupKind.Markdown = 'markdown';
})(MarkupKind || (MarkupKind = {}));
(function (MarkupKind) {
/**
* Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
*/
function is(value) {
var candidate = value;
return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
}
MarkupKind.is = is;
})(MarkupKind || (MarkupKind = {}));
var MarkupContent;
(function (MarkupContent) {
/**
* Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
}
MarkupContent.is = is;
})(MarkupContent || (MarkupContent = {}));
/**
* The kind of a completion entry.
*/
var CompletionItemKind;
(function (CompletionItemKind) {
CompletionItemKind.Text = 1;
CompletionItemKind.Method = 2;
CompletionItemKind.Function = 3;
CompletionItemKind.Constructor = 4;
CompletionItemKind.Field = 5;
CompletionItemKind.Variable = 6;
CompletionItemKind.Class = 7;
CompletionItemKind.Interface = 8;
CompletionItemKind.Module = 9;
CompletionItemKind.Property = 10;
CompletionItemKind.Unit = 11;
CompletionItemKind.Value = 12;
CompletionItemKind.Enum = 13;
CompletionItemKind.Keyword = 14;
CompletionItemKind.Snippet = 15;
CompletionItemKind.Color = 16;
CompletionItemKind.File = 17;
CompletionItemKind.Reference = 18;
CompletionItemKind.Folder = 19;
CompletionItemKind.EnumMember = 20;
CompletionItemKind.Constant = 21;
CompletionItemKind.Struct = 22;
CompletionItemKind.Event = 23;
CompletionItemKind.Operator = 24;
CompletionItemKind.TypeParameter = 25;
})(CompletionItemKind || (CompletionItemKind = {}));
/**
* Defines whether the insert text in a completion item should be interpreted as
* plain text or a snippet.
*/
var InsertTextFormat;
(function (InsertTextFormat) {
/**
* The primary text to be inserted is treated as a plain string.
*/
InsertTextFormat.PlainText = 1;
/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*
* See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
*/
InsertTextFormat.Snippet = 2;
})(InsertTextFormat || (InsertTextFormat = {}));
/**
* Completion item tags are extra annotations that tweak the rendering of a completion
* item.
*
* @since 3.15.0
*/
var CompletionItemTag;
(function (CompletionItemTag) {
/**
* Render a completion as obsolete, usually using a strike-out.
*/
CompletionItemTag.Deprecated = 1;
})(CompletionItemTag || (CompletionItemTag = {}));
/**
* The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
*
* @since 3.16.0
*/
var InsertReplaceEdit;
(function (InsertReplaceEdit) {
/**
* Creates a new insert / replace edit
*/
function create(newText, insert, replace) {
return { newText: newText, insert: insert, replace: replace };
}
InsertReplaceEdit.create = create;
/**
* Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
*/
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
}
InsertReplaceEdit.is = is;
})(InsertReplaceEdit || (InsertReplaceEdit = {}));
/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0
*/
var InsertTextMode;
(function (InsertTextMode) {
/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
InsertTextMode.asIs = 1;
/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: <2tabs><3tabs>foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
InsertTextMode.adjustIndentation = 2;
})(InsertTextMode || (InsertTextMode = {}));
/**
* The CompletionItem namespace provides functions to deal with
* completion items.
*/
var CompletionItem;
(function (CompletionItem) {
/**
* Create a completion item and seed it with a label.
* @param label The completion item's label
*/
function create(label) {
return { label: label };
}
CompletionItem.create = create;
})(CompletionItem || (CompletionItem = {}));
/**
* The CompletionList namespace provides functions to deal with
* completion lists.
*/
var CompletionList;
(function (CompletionList) {
/**
* Creates a new completion list.
*
* @param items The completion items.
* @param isIncomplete The list is not complete.
*/
function create(items, isIncomplete) {
return { items: items ? items : [], isIncomplete: !!isIncomplete };
}
CompletionList.create = create;
})(CompletionList || (CompletionList = {}));
var MarkedString;
(function (MarkedString) {
/**
* Creates a marked string from plain text.
*
* @param plainText The plain text.
*/
function fromPlainText(plainText) {
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}
MarkedString.fromPlainText = fromPlainText;
/**
* Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
*/
function is(value) {
var candidate = value;
return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
}
MarkedString.is = is;
})(MarkedString || (MarkedString = {}));
var Hover;
(function (Hover) {
/**
* Checks whether the given value conforms to the [Hover](#Hover) interface.
*/
function is(value) {
var candidate = value;
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
MarkedString.is(candidate.contents) ||
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
}
Hover.is = is;
})(Hover || (Hover = {}));
/**
* The ParameterInformation namespace provides helper functions to work with
* [ParameterInformation](#ParameterInformation) literals.
*/
var ParameterInformation;
(function (ParameterInformation) {
/**
* Creates a new parameter information literal.
*
* @param label A label string.
* @param documentation A doc string.
*/
function create(label, documentation) {
return documentation ? { label: label, documentation: documentation } : { label: label };
}
ParameterInformation.create = create;
})(ParameterInformation || (ParameterInformation = {}));
/**
* The SignatureInformation namespace provides helper functions to work with
* [SignatureInformation](#SignatureInformation) literals.
*/
var SignatureInformation;
(function (SignatureInformation) {
function create(label, documentation) {
var parameters = [];
for (var _i = 2; _i < arguments.length; _i++) {
parameters[_i - 2] = arguments[_i];
}
var result = { label: label };
if (Is.defined(documentation)) {
result.documentation = documentation;
}
if (Is.defined(parameters)) {
result.parameters = parameters;
}
else {
result.parameters = [];
}
return result;
}
SignatureInformation.create = create;
})(SignatureInformation || (SignatureInformation = {}));
/**
* A document highlight kind.
*/
var DocumentHighlightKind;
(function (DocumentHighlightKind) {
/**
* A textual occurrence.
*/
DocumentHighlightKind.Text = 1;
/**
* Read-access of a symbol, like reading a variable.
*/
DocumentHighlightKind.Read = 2;
/**
* Write-access of a symbol, like writing to a variable.
*/
DocumentHighlightKind.Write = 3;
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
/**
* DocumentHighlight namespace to provide helper functions to work with
* [DocumentHighlight](#DocumentHighlight) literals.
*/
var DocumentHighlight;
(function (DocumentHighlight) {
/**
* Create a DocumentHighlight object.
* @param range The range the highlight applies to.
*/
function create(range, kind) {
var result = { range: range };
if (Is.number(kind)) {
result.kind = kind;
}
return result;
}
DocumentHighlight.create = create;
})(DocumentHighlight || (DocumentHighlight = {}));
/**
* A symbol kind.
*/
var SymbolKind;
(function (SymbolKind) {
SymbolKind.File = 1;
SymbolKind.Module = 2;
SymbolKind.Namespace = 3;
SymbolKind.Package = 4;
SymbolKind.Class = 5;
SymbolKind.Method = 6;
SymbolKind.Property = 7;
SymbolKind.Field = 8;
SymbolKind.Constructor = 9;
SymbolKind.Enum = 10;
SymbolKind.Interface = 11;
SymbolKind.Function = 12;
SymbolKind.Variable = 13;
SymbolKind.Constant = 14;
SymbolKind.String = 15;
SymbolKind.Number = 16;
SymbolKind.Boolean = 17;
SymbolKind.Array = 18;
SymbolKind.Object = 19;
SymbolKind.Key = 20;
SymbolKind.Null = 21;
SymbolKind.EnumMember = 22;
SymbolKind.Struct = 23;
SymbolKind.Event = 24;
SymbolKind.Operator = 25;
SymbolKind.TypeParameter = 26;
})(SymbolKind || (SymbolKind = {}));
/**
* Symbol tags are extra annotations that tweak the rendering of a symbol.
* @since 3.16
*/
var SymbolTag;
(function (SymbolTag) {
/**
* Render a symbol as obsolete, usually using a strike-out.
*/
SymbolTag.Deprecated = 1;
})(SymbolTag || (SymbolTag = {}));
var SymbolInformation;
(function (SymbolInformation) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the location of the symbol.
* @param uri The resource of the location of symbol, defaults to the current document.
* @param containerName The name of the symbol containing the symbol.
*/
function create(name, kind, range, uri, containerName) {
var result = {
name: name,
kind: kind,
location: { uri: uri, range: range }
};
if (containerName) {
result.containerName = containerName;
}
return result;
}
SymbolInformation.create = create;
})(SymbolInformation || (SymbolInformation = {}));
var DocumentSymbol;
(function (DocumentSymbol) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param detail The detail of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the symbol.
* @param selectionRange The selectionRange of the symbol.
* @param children Children of the symbol.
*/
function create(name, detail, kind, range, selectionRange, children) {
var result = {
name: name,
detail: detail,
kind: kind,
range: range,
selectionRange: selectionRange
};
if (children !== undefined) {
result.children = children;
}
return result;
}
DocumentSymbol.create = create;
/**
* Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
*/
function is(value) {
var candidate = value;
return candidate &&
Is.string(candidate.name) && Is.number(candidate.kind) &&
Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
(candidate.detail === undefined || Is.string(candidate.detail)) &&
(candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
(candidate.children === undefined || Array.isArray(candidate.children)) &&
(candidate.tags === undefined || Array.isArray(candidate.tags));
}
DocumentSymbol.is = is;
})(DocumentSymbol || (DocumentSymbol = {}));
/**
* A set of predefined code action kinds
*/
var CodeActionKind;
(function (CodeActionKind) {
/**
* Empty kind.
*/
CodeActionKind.Empty = '';
/**
* Base kind for quickfix actions: 'quickfix'
*/
CodeActionKind.QuickFix = 'quickfix';
/**
* Base kind for refactoring actions: 'refactor'
*/
CodeActionKind.Refactor = 'refactor';
/**
* Base kind for refactoring extraction actions: 'refactor.extract'
*
* Example extract actions:
*
* - Extract method
* - Extract function
* - Extract variable
* - Extract interface from class
* - ...
*/
CodeActionKind.RefactorExtract = 'refactor.extract';
/**
* Base kind for refactoring inline actions: 'refactor.inline'
*
* Example inline actions:
*
* - Inline function
* - Inline variable
* - Inline constant
* - ...
*/
CodeActionKind.RefactorInline = 'refactor.inline';
/**
* Base kind for refactoring rewrite actions: 'refactor.rewrite'
*
* Example rewrite actions:
*
* - Convert JavaScript function to class
* - Add or remove parameter
* - Encapsulate field
* - Make method static
* - Move method to base class
* - ...
*/
CodeActionKind.RefactorRewrite = 'refactor.rewrite';
/**
* Base kind for source actions: `source`
*
* Source code actions apply to the entire file.
*/
CodeActionKind.Source = 'source';
/**
* Base kind for an organize imports source action: `source.organizeImports`
*/
CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
/**
* Base kind for auto-fix source actions: `source.fixAll`.
*
* Fix all actions automatically fix errors that have a clear fix that do not require user input.
* They should not suppress errors or perform unsafe fixes such as generating new types or classes.
*
* @since 3.15.0
*/
CodeActionKind.SourceFixAll = 'source.fixAll';
})(CodeActionKind || (CodeActionKind = {}));
/**
* The CodeActionContext namespace provides helper functions to work with
* [CodeActionContext](#CodeActionContext) literals.
*/
var CodeActionContext;
(function (CodeActionContext) {
/**
* Creates a new CodeActionContext literal.
*/
function create(diagnostics, only) {
var result = { diagnostics: diagnostics };
if (only !== undefined && only !== null) {
result.only = only;
}
return result;
}
CodeActionContext.create = create;
/**
* Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
}
CodeActionContext.is = is;
})(CodeActionContext || (CodeActionContext = {}));
var CodeAction;
(function (CodeAction) {
function create(title, kindOrCommandOrEdit, kind) {
var result = { title: title };
var checkKind = true;
if (typeof kindOrCommandOrEdit === 'string') {
checkKind = false;
result.kind = kindOrCommandOrEdit;
}
else if (Command.is(kindOrCommandOrEdit)) {
result.command = kindOrCommandOrEdit;
}
else {
result.edit = kindOrCommandOrEdit;
}
if (checkKind && kind !== undefined) {
result.kind = kind;
}
return result;
}
CodeAction.create = create;
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.title) &&
(candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
(candidate.kind === undefined || Is.string(candidate.kind)) &&
(candidate.edit !== undefined || candidate.command !== undefined) &&
(candidate.command === undefined || Command.is(candidate.command)) &&
(candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
}
CodeAction.is = is;
})(CodeAction || (CodeAction = {}));
/**
* The CodeLens namespace provides helper functions to work with
* [CodeLens](#CodeLens) literals.
*/
var CodeLens;
(function (CodeLens) {
/**
* Creates a new CodeLens literal.
*/
function create(range, data) {
var result = { range: range };
if (Is.defined(data)) {
result.data = data;
}
return result;
}
CodeLens.create = create;
/**
* Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
}
CodeLens.is = is;
})(CodeLens || (CodeLens = {}));
/**
* The FormattingOptions namespace provides helper functions to work with
* [FormattingOptions](#FormattingOptions) literals.
*/
var FormattingOptions;
(function (FormattingOptions) {
/**
* Creates a new FormattingOptions literal.
*/
function create(tabSize, insertSpaces) {
return { tabSize: tabSize, insertSpaces: insertSpaces };
}
FormattingOptions.create = create;
/**
* Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
}
FormattingOptions.is = is;
})(FormattingOptions || (FormattingOptions = {}));
/**
* The DocumentLink namespace provides helper functions to work with
* [DocumentLink](#DocumentLink) literals.
*/
var DocumentLink;
(function (DocumentLink) {
/**
* Creates a new DocumentLink literal.
*/
function create(range, target, data) {
return { range: range, target: target, data: data };
}
DocumentLink.create = create;
/**
* Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
}
DocumentLink.is = is;
})(DocumentLink || (DocumentLink = {}));
/**
* The SelectionRange namespace provides helper function to work with
* SelectionRange literals.
*/
var SelectionRange;
(function (SelectionRange) {
/**
* Creates a new SelectionRange
* @param range the range.
* @param parent an optional parent.
*/
function create(range, parent) {
return { range: range, parent: parent };
}
SelectionRange.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
}
SelectionRange.is = is;
})(SelectionRange || (SelectionRange = {}));
var EOL = ['\n', '\r\n', '\r'];
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var TextDocument;
(function (TextDocument) {
/**
* Creates a new ITextDocument literal from the given uri and content.
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
&& Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
}
TextDocument.is = is;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits, function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = text.length;
for (var i = sortedEdits.length - 1; i >= 0; i--) {
var e = sortedEdits[i];
var startOffset = document.offsetAt(e.range.start);
var endOffset = document.offsetAt(e.range.end);
if (endOffset <= lastModifiedOffset) {
text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
}
else {
throw new Error('Overlapping edit');
}
lastModifiedOffset = startOffset;
}
return text;
}
TextDocument.applyEdits = applyEdits;
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
})(TextDocument || (TextDocument = {}));
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: false,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (event, version) {
this._content = event.text;
this._version = version;
this._lineOffsets = undefined;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
var lineOffsets = [];
var text = this._content;
var isLineStart = true;
for (var i = 0; i < text.length; i++) {
if (isLineStart) {
lineOffsets.push(i);
isLineStart = false;
}
var ch = text.charAt(i);
isLineStart = (ch === '\r' || ch === '\n');
if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
i++;
}
}
if (isLineStart && text.length > 0) {
lineOffsets.push(text.length);
}
this._lineOffsets = lineOffsets;
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return Position.create(0, offset);
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return Position.create(line, offset - lineOffsets[line]);
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: false,
configurable: true
});
return FullTextDocument;
}());
var Is;
(function (Is) {
var toString = Object.prototype.toString;
function defined(value) {
return typeof value !== 'undefined';
}
Is.defined = defined;
function undefined(value) {
return typeof value === 'undefined';
}
Is.undefined = undefined;
function boolean(value) {
return value === true || value === false;
}
Is.boolean = boolean;
function string(value) {
return toString.call(value) === '[object String]';
}
Is.string = string;
function number(value) {
return toString.call(value) === '[object Number]';
}
Is.number = number;
function numberRange(value, min, max) {
return toString.call(value) === '[object Number]' && min <= value && value <= max;
}
Is.numberRange = numberRange;
function integer(value) {
return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
}
Is.integer = integer;
function uinteger(value) {
return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
}
Is.uinteger = uinteger;
function func(value) {
return toString.call(value) === '[object Function]';
}
Is.func = func;
function objectLiteral(value) {
// Strictly speaking class instances pass this check as well. Since the LSP
// doesn't use classes we ignore this for now. If we do we need to add something
// like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
return value !== null && typeof value === 'object';
}
Is.objectLiteral = objectLiteral;
function typedArray(value, check) {
return Array.isArray(value) && value.every(check);
}
Is.typedArray = typedArray;
})(Is || (Is = {}));
/***/ }),
/* 27 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0;
const vscode_jsonrpc_1 = __webpack_require__(6);
class RegistrationType {
constructor(method) {
this.method = method;
}
}
exports.RegistrationType = RegistrationType;
class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {
constructor(method) {
super(method);
}
}
exports.ProtocolRequestType0 = ProtocolRequestType0;
class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {
constructor(method) {
super(method, vscode_jsonrpc_1.ParameterStructures.byName);
}
}
exports.ProtocolRequestType = ProtocolRequestType;
class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {
constructor(method) {
super(method);
}
}
exports.ProtocolNotificationType0 = ProtocolNotificationType0;
class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {
constructor(method) {
super(method, vscode_jsonrpc_1.ParameterStructures.byName);
}
}
exports.ProtocolNotificationType = ProtocolNotificationType;
// let x: ProtocolNotificationType;
// let y: ProtocolNotificationType;
// x = y;
//# sourceMappingURL=messages.js.map
/***/ }),
/* 28 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0;
exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0;
const Is = __webpack_require__(29);
const messages_1 = __webpack_require__(27);
const protocol_implementation_1 = __webpack_require__(30);
Object.defineProperty(exports, "ImplementationRequest", ({ enumerable: true, get: function () { return protocol_implementation_1.ImplementationRequest; } }));
const protocol_typeDefinition_1 = __webpack_require__(31);
Object.defineProperty(exports, "TypeDefinitionRequest", ({ enumerable: true, get: function () { return protocol_typeDefinition_1.TypeDefinitionRequest; } }));
const protocol_workspaceFolders_1 = __webpack_require__(32);
Object.defineProperty(exports, "WorkspaceFoldersRequest", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.WorkspaceFoldersRequest; } }));
Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", ({ enumerable: true, get: function () { return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; } }));
const protocol_configuration_1 = __webpack_require__(33);
Object.defineProperty(exports, "ConfigurationRequest", ({ enumerable: true, get: function () { return protocol_configuration_1.ConfigurationRequest; } }));
const protocol_colorProvider_1 = __webpack_require__(34);
Object.defineProperty(exports, "DocumentColorRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.DocumentColorRequest; } }));
Object.defineProperty(exports, "ColorPresentationRequest", ({ enumerable: true, get: function () { return protocol_colorProvider_1.ColorPresentationRequest; } }));
const protocol_foldingRange_1 = __webpack_require__(35);
Object.defineProperty(exports, "FoldingRangeRequest", ({ enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRequest; } }));
const protocol_declaration_1 = __webpack_require__(36);
Object.defineProperty(exports, "DeclarationRequest", ({ enumerable: true, get: function () { return protocol_declaration_1.DeclarationRequest; } }));
const protocol_selectionRange_1 = __webpack_require__(37);
Object.defineProperty(exports, "SelectionRangeRequest", ({ enumerable: true, get: function () { return protocol_selectionRange_1.SelectionRangeRequest; } }));
const protocol_progress_1 = __webpack_require__(38);
Object.defineProperty(exports, "WorkDoneProgress", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgress; } }));
Object.defineProperty(exports, "WorkDoneProgressCreateRequest", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCreateRequest; } }));
Object.defineProperty(exports, "WorkDoneProgressCancelNotification", ({ enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCancelNotification; } }));
const protocol_callHierarchy_1 = __webpack_require__(39);
Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } }));
Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } }));
Object.defineProperty(exports, "CallHierarchyPrepareRequest", ({ enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } }));
const protocol_semanticTokens_1 = __webpack_require__(40);
Object.defineProperty(exports, "SemanticTokenTypes", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenTypes; } }));
Object.defineProperty(exports, "SemanticTokenModifiers", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenModifiers; } }));
Object.defineProperty(exports, "SemanticTokens", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokens; } }));
Object.defineProperty(exports, "TokenFormat", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.TokenFormat; } }));
Object.defineProperty(exports, "SemanticTokensRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRequest; } }));
Object.defineProperty(exports, "SemanticTokensDeltaRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } }));
Object.defineProperty(exports, "SemanticTokensRangeRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } }));
Object.defineProperty(exports, "SemanticTokensRefreshRequest", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } }));
Object.defineProperty(exports, "SemanticTokensRegistrationType", ({ enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } }));
const protocol_showDocument_1 = __webpack_require__(41);
Object.defineProperty(exports, "ShowDocumentRequest", ({ enumerable: true, get: function () { return protocol_showDocument_1.ShowDocumentRequest; } }));
const protocol_linkedEditingRange_1 = __webpack_require__(42);
Object.defineProperty(exports, "LinkedEditingRangeRequest", ({ enumerable: true, get: function () { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } }));
const protocol_fileOperations_1 = __webpack_require__(43);
Object.defineProperty(exports, "FileOperationPatternKind", ({ enumerable: true, get: function () { return protocol_fileOperations_1.FileOperationPatternKind; } }));
Object.defineProperty(exports, "DidCreateFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidCreateFilesNotification; } }));
Object.defineProperty(exports, "WillCreateFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillCreateFilesRequest; } }));
Object.defineProperty(exports, "DidRenameFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidRenameFilesNotification; } }));
Object.defineProperty(exports, "WillRenameFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillRenameFilesRequest; } }));
Object.defineProperty(exports, "DidDeleteFilesNotification", ({ enumerable: true, get: function () { return protocol_fileOperations_1.DidDeleteFilesNotification; } }));
Object.defineProperty(exports, "WillDeleteFilesRequest", ({ enumerable: true, get: function () { return protocol_fileOperations_1.WillDeleteFilesRequest; } }));
const protocol_moniker_1 = __webpack_require__(44);
Object.defineProperty(exports, "UniquenessLevel", ({ enumerable: true, get: function () { return protocol_moniker_1.UniquenessLevel; } }));
Object.defineProperty(exports, "MonikerKind", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerKind; } }));
Object.defineProperty(exports, "MonikerRequest", ({ enumerable: true, get: function () { return protocol_moniker_1.MonikerRequest; } }));
// @ts-ignore: to avoid inlining LocationLink as dynamic import
let __noDynamicImport;
/**
* The DocumentFilter namespace provides helper functions to work with
* [DocumentFilter](#DocumentFilter) literals.
*/
var DocumentFilter;
(function (DocumentFilter) {
function is(value) {
const candidate = value;
return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);
}
DocumentFilter.is = is;
})(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));
/**
* The DocumentSelector namespace provides helper functions to work with
* [DocumentSelector](#DocumentSelector)s.
*/
var DocumentSelector;
(function (DocumentSelector) {
function is(value) {
if (!Array.isArray(value)) {
return false;
}
for (let elem of value) {
if (!Is.string(elem) && !DocumentFilter.is(elem)) {
return false;
}
}
return true;
}
DocumentSelector.is = is;
})(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));
/**
* The `client/registerCapability` request is sent from the server to the client to register a new capability
* handler on the client side.
*/
var RegistrationRequest;
(function (RegistrationRequest) {
RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');
})(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));
/**
* The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability
* handler on the client side.
*/
var UnregistrationRequest;
(function (UnregistrationRequest) {
UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');
})(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));
var ResourceOperationKind;
(function (ResourceOperationKind) {
/**
* Supports creating new files and folders.
*/
ResourceOperationKind.Create = 'create';
/**
* Supports renaming existing files and folders.
*/
ResourceOperationKind.Rename = 'rename';
/**
* Supports deleting existing files and folders.
*/
ResourceOperationKind.Delete = 'delete';
})(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));
var FailureHandlingKind;
(function (FailureHandlingKind) {
/**
* Applying the workspace change is simply aborted if one of the changes provided
* fails. All operations executed before the failing operation stay executed.
*/
FailureHandlingKind.Abort = 'abort';
/**
* All operations are executed transactional. That means they either all
* succeed or no changes at all are applied to the workspace.
*/
FailureHandlingKind.Transactional = 'transactional';
/**
* If the workspace edit contains only textual file changes they are executed transactional.
* If resource changes (create, rename or delete file) are part of the change the failure
* handling strategy is abort.
*/
FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';
/**
* The client tries to undo the operations already executed. But there is no
* guarantee that this is succeeding.
*/
FailureHandlingKind.Undo = 'undo';
})(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));
/**
* The StaticRegistrationOptions namespace provides helper functions to work with
* [StaticRegistrationOptions](#StaticRegistrationOptions) literals.
*/
var StaticRegistrationOptions;
(function (StaticRegistrationOptions) {
function hasId(value) {
const candidate = value;
return candidate && Is.string(candidate.id) && candidate.id.length > 0;
}
StaticRegistrationOptions.hasId = hasId;
})(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));
/**
* The TextDocumentRegistrationOptions namespace provides helper functions to work with
* [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.
*/
var TextDocumentRegistrationOptions;
(function (TextDocumentRegistrationOptions) {
function is(value) {
const candidate = value;
return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
}
TextDocumentRegistrationOptions.is = is;
})(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));
/**
* The WorkDoneProgressOptions namespace provides helper functions to work with
* [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.
*/
var WorkDoneProgressOptions;
(function (WorkDoneProgressOptions) {
function is(value) {
const candidate = value;
return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));
}
WorkDoneProgressOptions.is = is;
function hasWorkDoneProgress(value) {
const candidate = value;
return candidate && Is.boolean(candidate.workDoneProgress);
}
WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;
})(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));
/**
* The initialize request is sent from the client to the server.
* It is sent once as the request after starting up the server.
* The requests parameter is of type [InitializeParams](#InitializeParams)
* the response if of type [InitializeResult](#InitializeResult) of a Thenable that
* resolves to such.
*/
var InitializeRequest;
(function (InitializeRequest) {
InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');
})(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));
/**
* Known error codes for an `InitializeError`;
*/
var InitializeError;
(function (InitializeError) {
/**
* If the protocol version provided by the client can't be handled by the server.
* @deprecated This initialize error got replaced by client capabilities. There is
* no version handshake in version 3.0x
*/
InitializeError.unknownProtocolVersion = 1;
})(InitializeError = exports.InitializeError || (exports.InitializeError = {}));
/**
* The initialized notification is sent from the client to the
* server after the client is fully initialized and the server
* is allowed to send requests from the server to the client.
*/
var InitializedNotification;
(function (InitializedNotification) {
InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');
})(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));
//---- Shutdown Method ----
/**
* A shutdown request is sent from the client to the server.
* It is sent once when the client decides to shutdown the
* server. The only notification that is sent after a shutdown request
* is the exit event.
*/
var ShutdownRequest;
(function (ShutdownRequest) {
ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');
})(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));
//---- Exit Notification ----
/**
* The exit event is sent from the client to the server to
* ask the server to exit its process.
*/
var ExitNotification;
(function (ExitNotification) {
ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');
})(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));
/**
* The configuration change notification is sent from the client to the server
* when the client's configuration has changed. The notification contains
* the changed configuration as defined by the language client.
*/
var DidChangeConfigurationNotification;
(function (DidChangeConfigurationNotification) {
DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');
})(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));
//---- Message show and log notifications ----
/**
* The message type
*/
var MessageType;
(function (MessageType) {
/**
* An error message.
*/
MessageType.Error = 1;
/**
* A warning message.
*/
MessageType.Warning = 2;
/**
* An information message.
*/
MessageType.Info = 3;
/**
* A log message.
*/
MessageType.Log = 4;
})(MessageType = exports.MessageType || (exports.MessageType = {}));
/**
* The show message notification is sent from a server to a client to ask
* the client to display a particular message in the user interface.
*/
var ShowMessageNotification;
(function (ShowMessageNotification) {
ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');
})(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));
/**
* The show message request is sent from the server to the client to show a message
* and a set of options actions to the user.
*/
var ShowMessageRequest;
(function (ShowMessageRequest) {
ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');
})(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));
/**
* The log message notification is sent from the server to the client to ask
* the client to log a particular message.
*/
var LogMessageNotification;
(function (LogMessageNotification) {
LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');
})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));
//---- Telemetry notification
/**
* The telemetry event notification is sent from the server to the client to ask
* the client to log telemetry data.
*/
var TelemetryEventNotification;
(function (TelemetryEventNotification) {
TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');
})(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));
/**
* Defines how the host (editor) should sync
* document changes to the language server.
*/
var TextDocumentSyncKind;
(function (TextDocumentSyncKind) {
/**
* Documents should not be synced at all.
*/
TextDocumentSyncKind.None = 0;
/**
* Documents are synced by always sending the full content
* of the document.
*/
TextDocumentSyncKind.Full = 1;
/**
* Documents are synced by sending the full content on open.
* After that only incremental updates to the document are
* send.
*/
TextDocumentSyncKind.Incremental = 2;
})(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));
/**
* The document open notification is sent from the client to the server to signal
* newly opened text documents. The document's truth is now managed by the client
* and the server must not try to read the document's truth using the document's
* uri. Open in this sense means it is managed by the client. It doesn't necessarily
* mean that its content is presented in an editor. An open notification must not
* be sent more than once without a corresponding close notification send before.
* This means open and close notification must be balanced and the max open count
* is one.
*/
var DidOpenTextDocumentNotification;
(function (DidOpenTextDocumentNotification) {
DidOpenTextDocumentNotification.method = 'textDocument/didOpen';
DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);
})(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));
var TextDocumentContentChangeEvent;
(function (TextDocumentContentChangeEvent) {
/**
* Checks whether the information describes a delta event.
*/
function isIncremental(event) {
let candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range !== undefined &&
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
}
TextDocumentContentChangeEvent.isIncremental = isIncremental;
/**
* Checks whether the information describes a full replacement event.
*/
function isFull(event) {
let candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
}
TextDocumentContentChangeEvent.isFull = isFull;
})(TextDocumentContentChangeEvent = exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {}));
/**
* The document change notification is sent from the client to the server to signal
* changes to a text document.
*/
var DidChangeTextDocumentNotification;
(function (DidChangeTextDocumentNotification) {
DidChangeTextDocumentNotification.method = 'textDocument/didChange';
DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);
})(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));
/**
* The document close notification is sent from the client to the server when
* the document got closed in the client. The document's truth now exists where
* the document's uri points to (e.g. if the document's uri is a file uri the
* truth now exists on disk). As with the open notification the close notification
* is about managing the document's content. Receiving a close notification
* doesn't mean that the document was open in an editor before. A close
* notification requires a previous open notification to be sent.
*/
var DidCloseTextDocumentNotification;
(function (DidCloseTextDocumentNotification) {
DidCloseTextDocumentNotification.method = 'textDocument/didClose';
DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);
})(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));
/**
* The document save notification is sent from the client to the server when
* the document got saved in the client.
*/
var DidSaveTextDocumentNotification;
(function (DidSaveTextDocumentNotification) {
DidSaveTextDocumentNotification.method = 'textDocument/didSave';
DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);
})(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));
/**
* Represents reasons why a text document is saved.
*/
var TextDocumentSaveReason;
(function (TextDocumentSaveReason) {
/**
* Manually triggered, e.g. by the user pressing save, by starting debugging,
* or by an API call.
*/
TextDocumentSaveReason.Manual = 1;
/**
* Automatic after a delay.
*/
TextDocumentSaveReason.AfterDelay = 2;
/**
* When the editor lost focus.
*/
TextDocumentSaveReason.FocusOut = 3;
})(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));
/**
* A document will save notification is sent from the client to the server before
* the document is actually saved.
*/
var WillSaveTextDocumentNotification;
(function (WillSaveTextDocumentNotification) {
WillSaveTextDocumentNotification.method = 'textDocument/willSave';
WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);
})(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));
/**
* A document will save request is sent from the client to the server before
* the document is actually saved. The request can return an array of TextEdits
* which will be applied to the text document before it is saved. Please note that
* clients might drop results if computing the text edits took too long or if a
* server constantly fails on this request. This is done to keep the save fast and
* reliable.
*/
var WillSaveTextDocumentWaitUntilRequest;
(function (WillSaveTextDocumentWaitUntilRequest) {
WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';
WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);
})(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));
/**
* The watched files notification is sent from the client to the server when
* the client detects changes to file watched by the language client.
*/
var DidChangeWatchedFilesNotification;
(function (DidChangeWatchedFilesNotification) {
DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');
})(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));
/**
* The file event type
*/
var FileChangeType;
(function (FileChangeType) {
/**
* The file got created.
*/
FileChangeType.Created = 1;
/**
* The file got changed.
*/
FileChangeType.Changed = 2;
/**
* The file got deleted.
*/
FileChangeType.Deleted = 3;
})(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));
var WatchKind;
(function (WatchKind) {
/**
* Interested in create events.
*/
WatchKind.Create = 1;
/**
* Interested in change events
*/
WatchKind.Change = 2;
/**
* Interested in delete events
*/
WatchKind.Delete = 4;
})(WatchKind = exports.WatchKind || (exports.WatchKind = {}));
/**
* Diagnostics notification are sent from the server to the client to signal
* results of validation runs.
*/
var PublishDiagnosticsNotification;
(function (PublishDiagnosticsNotification) {
PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');
})(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));
/**
* How a completion was triggered
*/
var CompletionTriggerKind;
(function (CompletionTriggerKind) {
/**
* Completion was triggered by typing an identifier (24x7 code
* complete), manual invocation (e.g Ctrl+Space) or via API.
*/
CompletionTriggerKind.Invoked = 1;
/**
* Completion was triggered by a trigger character specified by
* the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
*/
CompletionTriggerKind.TriggerCharacter = 2;
/**
* Completion was re-triggered as current completion list is incomplete
*/
CompletionTriggerKind.TriggerForIncompleteCompletions = 3;
})(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));
/**
* Request to request completion at a given text document position. The request's
* parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response
* is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)
* or a Thenable that resolves to such.
*
* The request can delay the computation of the [`detail`](#CompletionItem.detail)
* and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`
* request. However, properties that are needed for the initial sorting and filtering, like `sortText`,
* `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
*/
var CompletionRequest;
(function (CompletionRequest) {
CompletionRequest.method = 'textDocument/completion';
CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);
})(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));
/**
* Request to resolve additional information for a given completion item.The request's
* parameter is of type [CompletionItem](#CompletionItem) the response
* is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.
*/
var CompletionResolveRequest;
(function (CompletionResolveRequest) {
CompletionResolveRequest.method = 'completionItem/resolve';
CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);
})(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));
/**
* Request to request hover information at a given text document position. The request's
* parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of
* type [Hover](#Hover) or a Thenable that resolves to such.
*/
var HoverRequest;
(function (HoverRequest) {
HoverRequest.method = 'textDocument/hover';
HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);
})(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));
/**
* How a signature help was triggered.
*
* @since 3.15.0
*/
var SignatureHelpTriggerKind;
(function (SignatureHelpTriggerKind) {
/**
* Signature help was invoked manually by the user or by a command.
*/
SignatureHelpTriggerKind.Invoked = 1;
/**
* Signature help was triggered by a trigger character.
*/
SignatureHelpTriggerKind.TriggerCharacter = 2;
/**
* Signature help was triggered by the cursor moving or by the document content changing.
*/
SignatureHelpTriggerKind.ContentChange = 3;
})(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));
var SignatureHelpRequest;
(function (SignatureHelpRequest) {
SignatureHelpRequest.method = 'textDocument/signatureHelp';
SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);
})(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));
/**
* A request to resolve the definition location of a symbol at a given text
* document position. The request's parameter is of type [TextDocumentPosition]
* (#TextDocumentPosition) the response is of either type [Definition](#Definition)
* or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves
* to such.
*/
var DefinitionRequest;
(function (DefinitionRequest) {
DefinitionRequest.method = 'textDocument/definition';
DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);
})(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));
/**
* A request to resolve project-wide references for the symbol denoted
* by the given text document position. The request's parameter is of
* type [ReferenceParams](#ReferenceParams) the response is of type
* [Location[]](#Location) or a Thenable that resolves to such.
*/
var ReferencesRequest;
(function (ReferencesRequest) {
ReferencesRequest.method = 'textDocument/references';
ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);
})(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));
/**
* Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given
* text document position. The request's parameter is of type [TextDocumentPosition]
* (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
* (#DocumentHighlight) or a Thenable that resolves to such.
*/
var DocumentHighlightRequest;
(function (DocumentHighlightRequest) {
DocumentHighlightRequest.method = 'textDocument/documentHighlight';
DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);
})(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));
/**
* A request to list all symbols found in a given text document. The request's
* parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the
* response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable
* that resolves to such.
*/
var DocumentSymbolRequest;
(function (DocumentSymbolRequest) {
DocumentSymbolRequest.method = 'textDocument/documentSymbol';
DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);
})(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));
/**
* A request to provide commands for the given text document and range.
*/
var CodeActionRequest;
(function (CodeActionRequest) {
CodeActionRequest.method = 'textDocument/codeAction';
CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);
})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));
/**
* Request to resolve additional information for a given code action.The request's
* parameter is of type [CodeAction](#CodeAction) the response
* is of type [CodeAction](#CodeAction) or a Thenable that resolves to such.
*/
var CodeActionResolveRequest;
(function (CodeActionResolveRequest) {
CodeActionResolveRequest.method = 'codeAction/resolve';
CodeActionResolveRequest.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest.method);
})(CodeActionResolveRequest = exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {}));
/**
* A request to list project-wide symbols matching the query string given
* by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is
* of type [SymbolInformation[]](#SymbolInformation) or a Thenable that
* resolves to such.
*/
var WorkspaceSymbolRequest;
(function (WorkspaceSymbolRequest) {
WorkspaceSymbolRequest.method = 'workspace/symbol';
WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);
})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));
/**
* A request to provide code lens for the given text document.
*/
var CodeLensRequest;
(function (CodeLensRequest) {
CodeLensRequest.method = 'textDocument/codeLens';
CodeLensRequest.type = new messages_1.ProtocolRequestType(CodeLensRequest.method);
})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));
/**
* A request to resolve a command for a given code lens.
*/
var CodeLensResolveRequest;
(function (CodeLensResolveRequest) {
CodeLensResolveRequest.method = 'codeLens/resolve';
CodeLensResolveRequest.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest.method);
})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));
/**
* A request to refresh all code actions
*
* @since 3.16.0
*/
var CodeLensRefreshRequest;
(function (CodeLensRefreshRequest) {
CodeLensRefreshRequest.method = `workspace/codeLens/refresh`;
CodeLensRefreshRequest.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest.method);
})(CodeLensRefreshRequest = exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {}));
/**
* A request to provide document links
*/
var DocumentLinkRequest;
(function (DocumentLinkRequest) {
DocumentLinkRequest.method = 'textDocument/documentLink';
DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);
})(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));
/**
* Request to resolve additional information for a given document link. The request's
* parameter is of type [DocumentLink](#DocumentLink) the response
* is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.
*/
var DocumentLinkResolveRequest;
(function (DocumentLinkResolveRequest) {
DocumentLinkResolveRequest.method = 'documentLink/resolve';
DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest.method);
})(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));
/**
* A request to to format a whole document.
*/
var DocumentFormattingRequest;
(function (DocumentFormattingRequest) {
DocumentFormattingRequest.method = 'textDocument/formatting';
DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);
})(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));
/**
* A request to to format a range in a document.
*/
var DocumentRangeFormattingRequest;
(function (DocumentRangeFormattingRequest) {
DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';
DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);
})(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));
/**
* A request to format a document on type.
*/
var DocumentOnTypeFormattingRequest;
(function (DocumentOnTypeFormattingRequest) {
DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';
DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);
})(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));
//---- Rename ----------------------------------------------
var PrepareSupportDefaultBehavior;
(function (PrepareSupportDefaultBehavior) {
/**
* The client's default behavior is to select the identifier
* according the to language's syntax rule.
*/
PrepareSupportDefaultBehavior.Identifier = 1;
})(PrepareSupportDefaultBehavior = exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {}));
/**
* A request to rename a symbol.
*/
var RenameRequest;
(function (RenameRequest) {
RenameRequest.method = 'textDocument/rename';
RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);
})(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));
/**
* A request to test and perform the setup necessary for a rename.
*
* @since 3.16 - support for default behavior
*/
var PrepareRenameRequest;
(function (PrepareRenameRequest) {
PrepareRenameRequest.method = 'textDocument/prepareRename';
PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);
})(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));
/**
* A request send from the client to the server to execute a command. The request might return
* a workspace edit which the client will apply to the workspace.
*/
var ExecuteCommandRequest;
(function (ExecuteCommandRequest) {
ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');
})(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));
/**
* A request sent from the server to the client to modified certain resources.
*/
var ApplyWorkspaceEditRequest;
(function (ApplyWorkspaceEditRequest) {
ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');
})(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));
//# sourceMappingURL=protocol.js.map
/***/ }),
/* 29 */
/***/ ((__unused_webpack_module, exports) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
function boolean(value) {
return value === true || value === false;
}
exports.boolean = boolean;
function string(value) {
return typeof value === 'string' || value instanceof String;
}
exports.string = string;
function number(value) {
return typeof value === 'number' || value instanceof Number;
}
exports.number = number;
function error(value) {
return value instanceof Error;
}
exports.error = error;
function func(value) {
return typeof value === 'function';
}
exports.func = func;
function array(value) {
return Array.isArray(value);
}
exports.array = array;
function stringArray(value) {
return array(value) && value.every(elem => string(elem));
}
exports.stringArray = stringArray;
function typedArray(value, check) {
return Array.isArray(value) && value.every(check);
}
exports.typedArray = typedArray;
function objectLiteral(value) {
// Strictly speaking class instances pass this check as well. Since the LSP
// doesn't use classes we ignore this for now. If we do we need to add something
// like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
return value !== null && typeof value === 'object';
}
exports.objectLiteral = objectLiteral;
//# sourceMappingURL=is.js.map
/***/ }),
/* 30 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ImplementationRequest = void 0;
const messages_1 = __webpack_require__(27);
// @ts-ignore: to avoid inlining LocatioLink as dynamic import
let __noDynamicImport;
/**
* A request to resolve the implementation locations of a symbol at a given text
* document position. The request's parameter is of type [TextDocumentPositioParams]
* (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
* Thenable that resolves to such.
*/
var ImplementationRequest;
(function (ImplementationRequest) {
ImplementationRequest.method = 'textDocument/implementation';
ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);
})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));
//# sourceMappingURL=protocol.implementation.js.map
/***/ }),
/* 31 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TypeDefinitionRequest = void 0;
const messages_1 = __webpack_require__(27);
// @ts-ignore: to avoid inlining LocatioLink as dynamic import
let __noDynamicImport;
/**
* A request to resolve the type definition locations of a symbol at a given text
* document position. The request's parameter is of type [TextDocumentPositioParams]
* (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a
* Thenable that resolves to such.
*/
var TypeDefinitionRequest;
(function (TypeDefinitionRequest) {
TypeDefinitionRequest.method = 'textDocument/typeDefinition';
TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);
})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));
//# sourceMappingURL=protocol.typeDefinition.js.map
/***/ }),
/* 32 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
*/
var WorkspaceFoldersRequest;
(function (WorkspaceFoldersRequest) {
WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');
})(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));
/**
* The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace
* folder configuration changes.
*/
var DidChangeWorkspaceFoldersNotification;
(function (DidChangeWorkspaceFoldersNotification) {
DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');
})(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));
//# sourceMappingURL=protocol.workspaceFolders.js.map
/***/ }),
/* 33 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigurationRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* The 'workspace/configuration' request is sent from the server to the client to fetch a certain
* configuration setting.
*
* This pull model replaces the old push model were the client signaled configuration change via an
* event. If the server still needs to react to configuration changes (since the server caches the
* result of `workspace/configuration` requests) the server should register for an empty configuration
* change event and empty the cache if such an event is received.
*/
var ConfigurationRequest;
(function (ConfigurationRequest) {
ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');
})(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));
//# sourceMappingURL=protocol.configuration.js.map
/***/ }),
/* 34 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* A request to list all color symbols found in a given text document. The request's
* parameter is of type [DocumentColorParams](#DocumentColorParams) the
* response is of type [ColorInformation[]](#ColorInformation) or a Thenable
* that resolves to such.
*/
var DocumentColorRequest;
(function (DocumentColorRequest) {
DocumentColorRequest.method = 'textDocument/documentColor';
DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);
})(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));
/**
* A request to list all presentation for a color. The request's
* parameter is of type [ColorPresentationParams](#ColorPresentationParams) the
* response is of type [ColorInformation[]](#ColorInformation) or a Thenable
* that resolves to such.
*/
var ColorPresentationRequest;
(function (ColorPresentationRequest) {
ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');
})(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));
//# sourceMappingURL=protocol.colorProvider.js.map
/***/ }),
/* 35 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0;
const messages_1 = __webpack_require__(27);
/**
* Enum of known range kinds
*/
var FoldingRangeKind;
(function (FoldingRangeKind) {
/**
* Folding range for a comment
*/
FoldingRangeKind["Comment"] = "comment";
/**
* Folding range for a imports or includes
*/
FoldingRangeKind["Imports"] = "imports";
/**
* Folding range for a region (e.g. `#region`)
*/
FoldingRangeKind["Region"] = "region";
})(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));
/**
* A request to provide folding ranges in a document. The request's
* parameter is of type [FoldingRangeParams](#FoldingRangeParams), the
* response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable
* that resolves to such.
*/
var FoldingRangeRequest;
(function (FoldingRangeRequest) {
FoldingRangeRequest.method = 'textDocument/foldingRange';
FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);
})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));
//# sourceMappingURL=protocol.foldingRange.js.map
/***/ }),
/* 36 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DeclarationRequest = void 0;
const messages_1 = __webpack_require__(27);
// @ts-ignore: to avoid inlining LocatioLink as dynamic import
let __noDynamicImport;
/**
* A request to resolve the type definition locations of a symbol at a given text
* document position. The request's parameter is of type [TextDocumentPositioParams]
* (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)
* or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves
* to such.
*/
var DeclarationRequest;
(function (DeclarationRequest) {
DeclarationRequest.method = 'textDocument/declaration';
DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);
})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));
//# sourceMappingURL=protocol.declaration.js.map
/***/ }),
/* 37 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SelectionRangeRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* A request to provide selection ranges in a document. The request's
* parameter is of type [SelectionRangeParams](#SelectionRangeParams), the
* response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable
* that resolves to such.
*/
var SelectionRangeRequest;
(function (SelectionRangeRequest) {
SelectionRangeRequest.method = 'textDocument/selectionRange';
SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);
})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));
//# sourceMappingURL=protocol.selectionRange.js.map
/***/ }),
/* 38 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0;
const vscode_jsonrpc_1 = __webpack_require__(6);
const messages_1 = __webpack_require__(27);
var WorkDoneProgress;
(function (WorkDoneProgress) {
WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();
function is(value) {
return value === WorkDoneProgress.type;
}
WorkDoneProgress.is = is;
})(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));
/**
* The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress
* reporting from the server.
*/
var WorkDoneProgressCreateRequest;
(function (WorkDoneProgressCreateRequest) {
WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');
})(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));
/**
* The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress
* initiated on the server side.
*/
var WorkDoneProgressCancelNotification;
(function (WorkDoneProgressCancelNotification) {
WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');
})(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));
//# sourceMappingURL=protocol.progress.js.map
/***/ }),
/* 39 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) TypeFox and others. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* A request to result a `CallHierarchyItem` in a document at a given position.
* Can be used as an input to a incoming or outgoing call hierarchy.
*
* @since 3.16.0
*/
var CallHierarchyPrepareRequest;
(function (CallHierarchyPrepareRequest) {
CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';
CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);
})(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));
/**
* A request to resolve the incoming calls for a given `CallHierarchyItem`.
*
* @since 3.16.0
*/
var CallHierarchyIncomingCallsRequest;
(function (CallHierarchyIncomingCallsRequest) {
CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';
CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);
})(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));
/**
* A request to resolve the outgoing calls for a given `CallHierarchyItem`.
*
* @since 3.16.0
*/
var CallHierarchyOutgoingCallsRequest;
(function (CallHierarchyOutgoingCallsRequest) {
CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';
CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);
})(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));
//# sourceMappingURL=protocol.callHierarchy.js.map
/***/ }),
/* 40 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = void 0;
const messages_1 = __webpack_require__(27);
/**
* A set of predefined token types. This set is not fixed
* an clients can specify additional token types via the
* corresponding client capabilities.
*
* @since 3.16.0
*/
var SemanticTokenTypes;
(function (SemanticTokenTypes) {
SemanticTokenTypes["namespace"] = "namespace";
/**
* Represents a generic type. Acts as a fallback for types which can't be mapped to
* a specific type like class or enum.
*/
SemanticTokenTypes["type"] = "type";
SemanticTokenTypes["class"] = "class";
SemanticTokenTypes["enum"] = "enum";
SemanticTokenTypes["interface"] = "interface";
SemanticTokenTypes["struct"] = "struct";
SemanticTokenTypes["typeParameter"] = "typeParameter";
SemanticTokenTypes["parameter"] = "parameter";
SemanticTokenTypes["variable"] = "variable";
SemanticTokenTypes["property"] = "property";
SemanticTokenTypes["enumMember"] = "enumMember";
SemanticTokenTypes["event"] = "event";
SemanticTokenTypes["function"] = "function";
SemanticTokenTypes["method"] = "method";
SemanticTokenTypes["macro"] = "macro";
SemanticTokenTypes["keyword"] = "keyword";
SemanticTokenTypes["modifier"] = "modifier";
SemanticTokenTypes["comment"] = "comment";
SemanticTokenTypes["string"] = "string";
SemanticTokenTypes["number"] = "number";
SemanticTokenTypes["regexp"] = "regexp";
SemanticTokenTypes["operator"] = "operator";
})(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));
/**
* A set of predefined token modifiers. This set is not fixed
* an clients can specify additional token types via the
* corresponding client capabilities.
*
* @since 3.16.0
*/
var SemanticTokenModifiers;
(function (SemanticTokenModifiers) {
SemanticTokenModifiers["declaration"] = "declaration";
SemanticTokenModifiers["definition"] = "definition";
SemanticTokenModifiers["readonly"] = "readonly";
SemanticTokenModifiers["static"] = "static";
SemanticTokenModifiers["deprecated"] = "deprecated";
SemanticTokenModifiers["abstract"] = "abstract";
SemanticTokenModifiers["async"] = "async";
SemanticTokenModifiers["modification"] = "modification";
SemanticTokenModifiers["documentation"] = "documentation";
SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary";
})(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));
/**
* @since 3.16.0
*/
var SemanticTokens;
(function (SemanticTokens) {
function is(value) {
const candidate = value;
return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&
Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');
}
SemanticTokens.is = is;
})(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));
//------- 'textDocument/semanticTokens' -----
var TokenFormat;
(function (TokenFormat) {
TokenFormat.Relative = 'relative';
})(TokenFormat = exports.TokenFormat || (exports.TokenFormat = {}));
var SemanticTokensRegistrationType;
(function (SemanticTokensRegistrationType) {
SemanticTokensRegistrationType.method = 'textDocument/semanticTokens';
SemanticTokensRegistrationType.type = new messages_1.RegistrationType(SemanticTokensRegistrationType.method);
})(SemanticTokensRegistrationType = exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {}));
/**
* @since 3.16.0
*/
var SemanticTokensRequest;
(function (SemanticTokensRequest) {
SemanticTokensRequest.method = 'textDocument/semanticTokens/full';
SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);
})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));
/**
* @since 3.16.0
*/
var SemanticTokensDeltaRequest;
(function (SemanticTokensDeltaRequest) {
SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta';
SemanticTokensDeltaRequest.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest.method);
})(SemanticTokensDeltaRequest = exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {}));
/**
* @since 3.16.0
*/
var SemanticTokensRangeRequest;
(function (SemanticTokensRangeRequest) {
SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';
SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);
})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));
/**
* @since 3.16.0
*/
var SemanticTokensRefreshRequest;
(function (SemanticTokensRefreshRequest) {
SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`;
SemanticTokensRefreshRequest.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest.method);
})(SemanticTokensRefreshRequest = exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {}));
//# sourceMappingURL=protocol.semanticTokens.js.map
/***/ }),
/* 41 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ShowDocumentRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* A request to show a document. This request might open an
* external program depending on the value of the URI to open.
* For example a request to open `https://code.visualstudio.com/`
* will very likely open the URI in a WEB browser.
*
* @since 3.16.0
*/
var ShowDocumentRequest;
(function (ShowDocumentRequest) {
ShowDocumentRequest.method = 'window/showDocument';
ShowDocumentRequest.type = new messages_1.ProtocolRequestType(ShowDocumentRequest.method);
})(ShowDocumentRequest = exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {}));
//# sourceMappingURL=protocol.showDocument.js.map
/***/ }),
/* 42 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LinkedEditingRangeRequest = void 0;
const messages_1 = __webpack_require__(27);
/**
* A request to provide ranges that can be edited together.
*
* @since 3.16.0
*/
var LinkedEditingRangeRequest;
(function (LinkedEditingRangeRequest) {
LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange';
LinkedEditingRangeRequest.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest.method);
})(LinkedEditingRangeRequest = exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {}));
//# sourceMappingURL=protocol.linkedEditingRange.js.map
/***/ }),
/* 43 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0;
const messages_1 = __webpack_require__(27);
/**
* A pattern kind describing if a glob pattern matches a file a folder or
* both.
*
* @since 3.16.0
*/
var FileOperationPatternKind;
(function (FileOperationPatternKind) {
/**
* The pattern matches a file only.
*/
FileOperationPatternKind.file = 'file';
/**
* The pattern matches a folder only.
*/
FileOperationPatternKind.folder = 'folder';
})(FileOperationPatternKind = exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {}));
/**
* The will create files request is sent from the client to the server before files are actually
* created as long as the creation is triggered from within the client.
*
* @since 3.16.0
*/
var WillCreateFilesRequest;
(function (WillCreateFilesRequest) {
WillCreateFilesRequest.method = 'workspace/willCreateFiles';
WillCreateFilesRequest.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest.method);
})(WillCreateFilesRequest = exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {}));
/**
* The did create files notification is sent from the client to the server when
* files were created from within the client.
*
* @since 3.16.0
*/
var DidCreateFilesNotification;
(function (DidCreateFilesNotification) {
DidCreateFilesNotification.method = 'workspace/didCreateFiles';
DidCreateFilesNotification.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification.method);
})(DidCreateFilesNotification = exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {}));
/**
* The will rename files request is sent from the client to the server before files are actually
* renamed as long as the rename is triggered from within the client.
*
* @since 3.16.0
*/
var WillRenameFilesRequest;
(function (WillRenameFilesRequest) {
WillRenameFilesRequest.method = 'workspace/willRenameFiles';
WillRenameFilesRequest.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest.method);
})(WillRenameFilesRequest = exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {}));
/**
* The did rename files notification is sent from the client to the server when
* files were renamed from within the client.
*
* @since 3.16.0
*/
var DidRenameFilesNotification;
(function (DidRenameFilesNotification) {
DidRenameFilesNotification.method = 'workspace/didRenameFiles';
DidRenameFilesNotification.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification.method);
})(DidRenameFilesNotification = exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {}));
/**
* The will delete files request is sent from the client to the server before files are actually
* deleted as long as the deletion is triggered from within the client.
*
* @since 3.16.0
*/
var DidDeleteFilesNotification;
(function (DidDeleteFilesNotification) {
DidDeleteFilesNotification.method = 'workspace/didDeleteFiles';
DidDeleteFilesNotification.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification.method);
})(DidDeleteFilesNotification = exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {}));
/**
* The did delete files notification is sent from the client to the server when
* files were deleted from within the client.
*
* @since 3.16.0
*/
var WillDeleteFilesRequest;
(function (WillDeleteFilesRequest) {
WillDeleteFilesRequest.method = 'workspace/willDeleteFiles';
WillDeleteFilesRequest.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest.method);
})(WillDeleteFilesRequest = exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {}));
//# sourceMappingURL=protocol.fileOperations.js.map
/***/ }),
/* 44 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0;
const messages_1 = __webpack_require__(27);
/**
* Moniker uniqueness level to define scope of the moniker.
*
* @since 3.16.0
*/
var UniquenessLevel;
(function (UniquenessLevel) {
/**
* The moniker is only unique inside a document
*/
UniquenessLevel["document"] = "document";
/**
* The moniker is unique inside a project for which a dump got created
*/
UniquenessLevel["project"] = "project";
/**
* The moniker is unique inside the group to which a project belongs
*/
UniquenessLevel["group"] = "group";
/**
* The moniker is unique inside the moniker scheme.
*/
UniquenessLevel["scheme"] = "scheme";
/**
* The moniker is globally unique
*/
UniquenessLevel["global"] = "global";
})(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {}));
/**
* The moniker kind.
*
* @since 3.16.0
*/
var MonikerKind;
(function (MonikerKind) {
/**
* The moniker represent a symbol that is imported into a project
*/
MonikerKind["import"] = "import";
/**
* The moniker represents a symbol that is exported from a project
*/
MonikerKind["export"] = "export";
/**
* The moniker represents a symbol that is local to a project (e.g. a local
* variable of a function, a class not visible outside the project, ...)
*/
MonikerKind["local"] = "local";
})(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {}));
/**
* A request to get the moniker of a symbol at a given text document position.
* The request parameter is of type [TextDocumentPositionParams](#TextDocumentPositionParams).
* The response is of type [Moniker[]](#Moniker[]) or `null`.
*/
var MonikerRequest;
(function (MonikerRequest) {
MonikerRequest.method = 'textDocument/moniker';
MonikerRequest.type = new messages_1.ProtocolRequestType(MonikerRequest.method);
})(MonikerRequest = exports.MonikerRequest || (exports.MonikerRequest = {}));
//# sourceMappingURL=protocol.moniker.js.map
/***/ }),
/* 45 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createProtocolConnection = void 0;
const vscode_jsonrpc_1 = __webpack_require__(6);
function createProtocolConnection(input, output, logger, options) {
if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
options = { connectionStrategy: options };
}
return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
}
exports.createProtocolConnection = createProtocolConnection;
//# sourceMappingURL=connection.js.map
/***/ }),
/* 46 */,
/* 47 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
const node_1 = __webpack_require__(48);
const runner_1 = __webpack_require__(68);
const htmlServer_1 = __webpack_require__(69);
const nodeFs_1 = __webpack_require__(163);
// Create a connection for the server.
const connection = node_1.createConnection();
console.log = connection.console.log.bind(connection.console);
console.error = connection.console.error.bind(connection.console);
process.on('unhandledRejection', (e) => {
connection.console.error(runner_1.formatError(`Unhandled exception`, e));
});
htmlServer_1.startServer(connection, { file: nodeFs_1.getNodeFSRequestService() });
/***/ }),
/* 48 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ----------------------------------------------------------------------------------------- */
module.exports = __webpack_require__(49);
/***/ }),
/* 49 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
///
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createConnection = exports.Files = void 0;
const Is = __webpack_require__(50);
const server_1 = __webpack_require__(51);
const fm = __webpack_require__(62);
const node_1 = __webpack_require__(66);
__exportStar(__webpack_require__(66), exports);
__exportStar(__webpack_require__(67), exports);
var Files;
(function (Files) {
Files.uriToFilePath = fm.uriToFilePath;
Files.resolveGlobalNodePath = fm.resolveGlobalNodePath;
Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath;
Files.resolve = fm.resolve;
Files.resolveModulePath = fm.resolveModulePath;
})(Files = exports.Files || (exports.Files = {}));
let _protocolConnection;
function endProtocolConnection() {
if (_protocolConnection === undefined) {
return;
}
try {
_protocolConnection.end();
}
catch (_err) {
// Ignore. The client process could have already
// did and we can't send an end into the connection.
}
}
let _shutdownReceived = false;
let exitTimer = undefined;
function setupExitTimer() {
const argName = '--clientProcessId';
function runTimer(value) {
try {
let processId = parseInt(value);
if (!isNaN(processId)) {
exitTimer = setInterval(() => {
try {
process.kill(processId, 0);
}
catch (ex) {
// Parent process doesn't exist anymore. Exit the server.
endProtocolConnection();
process.exit(_shutdownReceived ? 0 : 1);
}
}, 3000);
}
}
catch (e) {
// Ignore errors;
}
}
for (let i = 2; i < process.argv.length; i++) {
let arg = process.argv[i];
if (arg === argName && i + 1 < process.argv.length) {
runTimer(process.argv[i + 1]);
return;
}
else {
let args = arg.split('=');
if (args[0] === argName) {
runTimer(args[1]);
}
}
}
}
setupExitTimer();
const watchDog = {
initialize: (params) => {
const processId = params.processId;
if (Is.number(processId) && exitTimer === undefined) {
// We received a parent process id. Set up a timer to periodically check
// if the parent is still alive.
setInterval(() => {
try {
process.kill(processId, 0);
}
catch (ex) {
// Parent process doesn't exist anymore. Exit the server.
process.exit(_shutdownReceived ? 0 : 1);
}
}, 3000);
}
},
get shutdownReceived() {
return _shutdownReceived;
},
set shutdownReceived(value) {
_shutdownReceived = value;
},
exit: (code) => {
endProtocolConnection();
process.exit(code);
}
};
function createConnection(arg1, arg2, arg3, arg4) {
let factories;
let input;
let output;
let options;
if (arg1 !== void 0 && arg1.__brand === 'features') {
factories = arg1;
arg1 = arg2;
arg2 = arg3;
arg3 = arg4;
}
if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) {
options = arg1;
}
else {
input = arg1;
output = arg2;
options = arg3;
}
return _createConnection(input, output, options, factories);
}
exports.createConnection = createConnection;
function _createConnection(input, output, options, factories) {
if (!input && !output && process.argv.length > 2) {
let port = void 0;
let pipeName = void 0;
let argv = process.argv.slice(2);
for (let i = 0; i < argv.length; i++) {
let arg = argv[i];
if (arg === '--node-ipc') {
input = new node_1.IPCMessageReader(process);
output = new node_1.IPCMessageWriter(process);
break;
}
else if (arg === '--stdio') {
input = process.stdin;
output = process.stdout;
break;
}
else if (arg === '--socket') {
port = parseInt(argv[i + 1]);
break;
}
else if (arg === '--pipe') {
pipeName = argv[i + 1];
break;
}
else {
var args = arg.split('=');
if (args[0] === '--socket') {
port = parseInt(args[1]);
break;
}
else if (args[0] === '--pipe') {
pipeName = args[1];
break;
}
}
}
if (port) {
let transport = node_1.createServerSocketTransport(port);
input = transport[0];
output = transport[1];
}
else if (pipeName) {
let transport = node_1.createServerPipeTransport(pipeName);
input = transport[0];
output = transport[1];
}
}
var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\'';
if (!input) {
throw new Error('Connection input stream is not set. ' + commandLineMessage);
}
if (!output) {
throw new Error('Connection output stream is not set. ' + commandLineMessage);
}
// Backwards compatibility
if (Is.func(input.read) && Is.func(input.on)) {
let inputStream = input;
inputStream.on('end', () => {
endProtocolConnection();
process.exit(_shutdownReceived ? 0 : 1);
});
inputStream.on('close', () => {
endProtocolConnection();
process.exit(_shutdownReceived ? 0 : 1);
});
}
const connectionFactory = (logger) => {
const result = node_1.createProtocolConnection(input, output, logger, options);
return result;
};
return server_1.createConnection(connectionFactory, watchDog, factories);
}
//# sourceMappingURL=main.js.map
/***/ }),
/* 50 */
/***/ ((__unused_webpack_module, exports) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
function boolean(value) {
return value === true || value === false;
}
exports.boolean = boolean;
function string(value) {
return typeof value === 'string' || value instanceof String;
}
exports.string = string;
function number(value) {
return typeof value === 'number' || value instanceof Number;
}
exports.number = number;
function error(value) {
return value instanceof Error;
}
exports.error = error;
function func(value) {
return typeof value === 'function';
}
exports.func = func;
function array(value) {
return Array.isArray(value);
}
exports.array = array;
function stringArray(value) {
return array(value) && value.every(elem => string(elem));
}
exports.stringArray = stringArray;
function typedArray(value, check) {
return Array.isArray(value) && value.every(check);
}
exports.typedArray = typedArray;
function thenable(value) {
return value && func(value.then);
}
exports.thenable = thenable;
//# sourceMappingURL=is.js.map
/***/ }),
/* 51 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createConnection = exports.combineFeatures = exports.combineLanguagesFeatures = exports.combineWorkspaceFeatures = exports.combineWindowFeatures = exports.combineClientFeatures = exports.combineTracerFeatures = exports.combineTelemetryFeatures = exports.combineConsoleFeatures = exports._LanguagesImpl = exports.BulkUnregistration = exports.BulkRegistration = exports.ErrorMessageTracker = exports.TextDocuments = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const Is = __webpack_require__(50);
const UUID = __webpack_require__(52);
const progress_1 = __webpack_require__(53);
const configuration_1 = __webpack_require__(54);
const workspaceFolders_1 = __webpack_require__(55);
const callHierarchy_1 = __webpack_require__(56);
const semanticTokens_1 = __webpack_require__(57);
const showDocument_1 = __webpack_require__(58);
const fileOperations_1 = __webpack_require__(59);
const linkedEditingRange_1 = __webpack_require__(60);
const moniker_1 = __webpack_require__(61);
function null2Undefined(value) {
if (value === null) {
return undefined;
}
return value;
}
/**
* A manager for simple text documents
*/
class TextDocuments {
/**
* Create a new text document manager.
*/
constructor(configuration) {
this._documents = Object.create(null);
this._configuration = configuration;
this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter();
this._onDidOpen = new vscode_languageserver_protocol_1.Emitter();
this._onDidClose = new vscode_languageserver_protocol_1.Emitter();
this._onDidSave = new vscode_languageserver_protocol_1.Emitter();
this._onWillSave = new vscode_languageserver_protocol_1.Emitter();
}
/**
* An event that fires when a text document managed by this manager
* has been opened or the content changes.
*/
get onDidChangeContent() {
return this._onDidChangeContent.event;
}
/**
* An event that fires when a text document managed by this manager
* has been opened.
*/
get onDidOpen() {
return this._onDidOpen.event;
}
/**
* An event that fires when a text document managed by this manager
* will be saved.
*/
get onWillSave() {
return this._onWillSave.event;
}
/**
* Sets a handler that will be called if a participant wants to provide
* edits during a text document save.
*/
onWillSaveWaitUntil(handler) {
this._willSaveWaitUntil = handler;
}
/**
* An event that fires when a text document managed by this manager
* has been saved.
*/
get onDidSave() {
return this._onDidSave.event;
}
/**
* An event that fires when a text document managed by this manager
* has been closed.
*/
get onDidClose() {
return this._onDidClose.event;
}
/**
* Returns the document for the given URI. Returns undefined if
* the document is not managed by this instance.
*
* @param uri The text document's URI to retrieve.
* @return the text document or `undefined`.
*/
get(uri) {
return this._documents[uri];
}
/**
* Returns all text documents managed by this instance.
*
* @return all text documents.
*/
all() {
return Object.keys(this._documents).map(key => this._documents[key]);
}
/**
* Returns the URIs of all text documents managed by this instance.
*
* @return the URI's of all text documents.
*/
keys() {
return Object.keys(this._documents);
}
/**
* Listens for `low level` notification on the given connection to
* update the text documents managed by this instance.
*
* Please note that the connection only provides handlers not an event model. Therefore
* listening on a connection will overwrite the following handlers on a connection:
* `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`,
* `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`.
*
* Use the corresponding events on the TextDocuments instance instead.
*
* @param connection The connection to listen on.
*/
listen(connection) {
connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full;
connection.onDidOpenTextDocument((event) => {
let td = event.textDocument;
let document = this._configuration.create(td.uri, td.languageId, td.version, td.text);
this._documents[td.uri] = document;
let toFire = Object.freeze({ document });
this._onDidOpen.fire(toFire);
this._onDidChangeContent.fire(toFire);
});
connection.onDidChangeTextDocument((event) => {
let td = event.textDocument;
let changes = event.contentChanges;
if (changes.length === 0) {
return;
}
let document = this._documents[td.uri];
const { version } = td;
if (version === null || version === undefined) {
throw new Error(`Received document change event for ${td.uri} without valid version identifier`);
}
document = this._configuration.update(document, changes, version);
this._documents[td.uri] = document;
this._onDidChangeContent.fire(Object.freeze({ document }));
});
connection.onDidCloseTextDocument((event) => {
let document = this._documents[event.textDocument.uri];
if (document) {
delete this._documents[event.textDocument.uri];
this._onDidClose.fire(Object.freeze({ document }));
}
});
connection.onWillSaveTextDocument((event) => {
let document = this._documents[event.textDocument.uri];
if (document) {
this._onWillSave.fire(Object.freeze({ document, reason: event.reason }));
}
});
connection.onWillSaveTextDocumentWaitUntil((event, token) => {
let document = this._documents[event.textDocument.uri];
if (document && this._willSaveWaitUntil) {
return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token);
}
else {
return [];
}
});
connection.onDidSaveTextDocument((event) => {
let document = this._documents[event.textDocument.uri];
if (document) {
this._onDidSave.fire(Object.freeze({ document }));
}
});
}
}
exports.TextDocuments = TextDocuments;
/**
* Helps tracking error message. Equal occurrences of the same
* message are only stored once. This class is for example
* useful if text documents are validated in a loop and equal
* error message should be folded into one.
*/
class ErrorMessageTracker {
constructor() {
this._messages = Object.create(null);
}
/**
* Add a message to the tracker.
*
* @param message The message to add.
*/
add(message) {
let count = this._messages[message];
if (!count) {
count = 0;
}
count++;
this._messages[message] = count;
}
/**
* Send all tracked messages to the connection's window.
*
* @param connection The connection established between client and server.
*/
sendErrors(connection) {
Object.keys(this._messages).forEach(message => {
connection.window.showErrorMessage(message);
});
}
}
exports.ErrorMessageTracker = ErrorMessageTracker;
class RemoteConsoleImpl {
constructor() {
}
rawAttach(connection) {
this._rawConnection = connection;
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
fillServerCapabilities(_capabilities) {
}
initialize(_capabilities) {
}
error(message) {
this.send(vscode_languageserver_protocol_1.MessageType.Error, message);
}
warn(message) {
this.send(vscode_languageserver_protocol_1.MessageType.Warning, message);
}
info(message) {
this.send(vscode_languageserver_protocol_1.MessageType.Info, message);
}
log(message) {
this.send(vscode_languageserver_protocol_1.MessageType.Log, message);
}
send(type, message) {
if (this._rawConnection) {
this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message });
}
}
}
class _RemoteWindowImpl {
constructor() {
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
showErrorMessage(message, ...actions) {
let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions };
return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
}
showWarningMessage(message, ...actions) {
let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions };
return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
}
showInformationMessage(message, ...actions) {
let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions };
return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined);
}
}
const RemoteWindowImpl = showDocument_1.ShowDocumentFeature(progress_1.ProgressFeature(_RemoteWindowImpl));
var BulkRegistration;
(function (BulkRegistration) {
/**
* Creates a new bulk registration.
* @return an empty bulk registration.
*/
function create() {
return new BulkRegistrationImpl();
}
BulkRegistration.create = create;
})(BulkRegistration = exports.BulkRegistration || (exports.BulkRegistration = {}));
class BulkRegistrationImpl {
constructor() {
this._registrations = [];
this._registered = new Set();
}
add(type, registerOptions) {
const method = Is.string(type) ? type : type.method;
if (this._registered.has(method)) {
throw new Error(`${method} is already added to this registration`);
}
const id = UUID.generateUuid();
this._registrations.push({
id: id,
method: method,
registerOptions: registerOptions || {}
});
this._registered.add(method);
}
asRegistrationParams() {
return {
registrations: this._registrations
};
}
}
var BulkUnregistration;
(function (BulkUnregistration) {
function create() {
return new BulkUnregistrationImpl(undefined, []);
}
BulkUnregistration.create = create;
})(BulkUnregistration = exports.BulkUnregistration || (exports.BulkUnregistration = {}));
class BulkUnregistrationImpl {
constructor(_connection, unregistrations) {
this._connection = _connection;
this._unregistrations = new Map();
unregistrations.forEach(unregistration => {
this._unregistrations.set(unregistration.method, unregistration);
});
}
get isAttached() {
return !!this._connection;
}
attach(connection) {
this._connection = connection;
}
add(unregistration) {
this._unregistrations.set(unregistration.method, unregistration);
}
dispose() {
let unregistrations = [];
for (let unregistration of this._unregistrations.values()) {
unregistrations.push(unregistration);
}
let params = {
unregisterations: unregistrations
};
this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {
this._connection.console.info(`Bulk unregistration failed.`);
});
}
disposeSingle(arg) {
const method = Is.string(arg) ? arg : arg.method;
const unregistration = this._unregistrations.get(method);
if (!unregistration) {
return false;
}
let params = {
unregisterations: [unregistration]
};
this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => {
this._unregistrations.delete(method);
}, (_error) => {
this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`);
});
return true;
}
}
class RemoteClientImpl {
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
register(typeOrRegistrations, registerOptionsOrType, registerOptions) {
if (typeOrRegistrations instanceof BulkRegistrationImpl) {
return this.registerMany(typeOrRegistrations);
}
else if (typeOrRegistrations instanceof BulkUnregistrationImpl) {
return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions);
}
else {
return this.registerSingle2(typeOrRegistrations, registerOptionsOrType);
}
}
registerSingle1(unregistration, type, registerOptions) {
const method = Is.string(type) ? type : type.method;
const id = UUID.generateUuid();
let params = {
registrations: [{ id, method, registerOptions: registerOptions || {} }]
};
if (!unregistration.isAttached) {
unregistration.attach(this.connection);
}
return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
unregistration.add({ id: id, method: method });
return unregistration;
}, (_error) => {
this.connection.console.info(`Registering request handler for ${method} failed.`);
return Promise.reject(_error);
});
}
registerSingle2(type, registerOptions) {
const method = Is.string(type) ? type : type.method;
const id = UUID.generateUuid();
let params = {
registrations: [{ id, method, registerOptions: registerOptions || {} }]
};
return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => {
return vscode_languageserver_protocol_1.Disposable.create(() => {
this.unregisterSingle(id, method);
});
}, (_error) => {
this.connection.console.info(`Registering request handler for ${method} failed.`);
return Promise.reject(_error);
});
}
unregisterSingle(id, method) {
let params = {
unregisterations: [{ id, method }]
};
return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => {
this.connection.console.info(`Un-registering request handler for ${id} failed.`);
});
}
registerMany(registrations) {
let params = registrations.asRegistrationParams();
return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => {
return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; }));
}, (_error) => {
this.connection.console.info(`Bulk registration failed.`);
return Promise.reject(_error);
});
}
}
class _RemoteWorkspaceImpl {
constructor() {
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
applyEdit(paramOrEdit) {
function isApplyWorkspaceEditParams(value) {
return value && !!value.edit;
}
let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit };
return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params);
}
}
const RemoteWorkspaceImpl = fileOperations_1.FileOperationsFeature(workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl)));
class TracerImpl {
constructor() {
this._trace = vscode_languageserver_protocol_1.Trace.Off;
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
set trace(value) {
this._trace = value;
}
log(message, verbose) {
if (this._trace === vscode_languageserver_protocol_1.Trace.Off) {
return;
}
this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, {
message: message,
verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined
});
}
}
class TelemetryImpl {
constructor() {
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
logEvent(data) {
this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data);
}
}
class _LanguagesImpl {
constructor() {
}
attach(connection) {
this._connection = connection;
}
get connection() {
if (!this._connection) {
throw new Error('Remote is not attached to a connection yet.');
}
return this._connection;
}
initialize(_capabilities) {
}
fillServerCapabilities(_capabilities) {
}
attachWorkDoneProgress(params) {
return progress_1.attachWorkDone(this.connection, params);
}
attachPartialResultProgress(_type, params) {
return progress_1.attachPartialResult(this.connection, params);
}
}
exports._LanguagesImpl = _LanguagesImpl;
const LanguagesImpl = moniker_1.MonikerFeature(linkedEditingRange_1.LinkedEditingRangeFeature(semanticTokens_1.SemanticTokensFeature(callHierarchy_1.CallHierarchyFeature(_LanguagesImpl))));
function combineConsoleFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineConsoleFeatures = combineConsoleFeatures;
function combineTelemetryFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineTelemetryFeatures = combineTelemetryFeatures;
function combineTracerFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineTracerFeatures = combineTracerFeatures;
function combineClientFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineClientFeatures = combineClientFeatures;
function combineWindowFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineWindowFeatures = combineWindowFeatures;
function combineWorkspaceFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineWorkspaceFeatures = combineWorkspaceFeatures;
function combineLanguagesFeatures(one, two) {
return function (Base) {
return two(one(Base));
};
}
exports.combineLanguagesFeatures = combineLanguagesFeatures;
function combineFeatures(one, two) {
function combine(one, two, func) {
if (one && two) {
return func(one, two);
}
else if (one) {
return one;
}
else {
return two;
}
}
let result = {
__brand: 'features',
console: combine(one.console, two.console, combineConsoleFeatures),
tracer: combine(one.tracer, two.tracer, combineTracerFeatures),
telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures),
client: combine(one.client, two.client, combineClientFeatures),
window: combine(one.window, two.window, combineWindowFeatures),
workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures)
};
return result;
}
exports.combineFeatures = combineFeatures;
function createConnection(connectionFactory, watchDog, factories) {
const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl());
const connection = connectionFactory(logger);
logger.rawAttach(connection);
const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl());
const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl());
const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl());
const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl());
const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl());
const languages = (factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl());
const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages];
function asPromise(value) {
if (value instanceof Promise) {
return value;
}
else if (Is.thenable(value)) {
return new Promise((resolve, reject) => {
value.then((resolved) => resolve(resolved), (error) => reject(error));
});
}
else {
return Promise.resolve(value);
}
}
let shutdownHandler = undefined;
let initializeHandler = undefined;
let exitHandler = undefined;
let protocolConnection = {
listen: () => connection.listen(),
sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params),
onRequest: (type, handler) => connection.onRequest(type, handler),
sendNotification: (type, param) => {
const method = Is.string(type) ? type : type.method;
if (arguments.length === 1) {
connection.sendNotification(method);
}
else {
connection.sendNotification(method, param);
}
},
onNotification: (type, handler) => connection.onNotification(type, handler),
onProgress: connection.onProgress,
sendProgress: connection.sendProgress,
onInitialize: (handler) => initializeHandler = handler,
onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler),
onShutdown: (handler) => shutdownHandler = handler,
onExit: (handler) => exitHandler = handler,
get console() { return logger; },
get telemetry() { return telemetry; },
get tracer() { return tracer; },
get client() { return client; },
get window() { return remoteWindow; },
get workspace() { return workspace; },
get languages() { return languages; },
onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler),
onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler),
__textDocumentSync: undefined,
onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler),
onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler),
onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler),
onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler),
onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler),
onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler),
sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params),
onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler),
onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onCodeActionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => {
return handler(params, cancel);
}),
onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => {
return handler(params, cancel);
}),
onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => {
return handler(params, cancel);
}),
onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => {
return handler(params, cancel);
}),
onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => {
return handler(params, cancel);
}),
onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params));
}),
onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => {
return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined);
}),
dispose: () => connection.dispose()
};
for (let remote of allRemotes) {
remote.attach(protocolConnection);
}
connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => {
watchDog.initialize(params);
if (Is.string(params.trace)) {
tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace);
}
for (let remote of allRemotes) {
remote.initialize(params.capabilities);
}
if (initializeHandler) {
let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, progress_1.attachWorkDone(connection, params), undefined);
return asPromise(result).then((value) => {
if (value instanceof vscode_languageserver_protocol_1.ResponseError) {
return value;
}
let result = value;
if (!result) {
result = { capabilities: {} };
}
let capabilities = result.capabilities;
if (!capabilities) {
capabilities = {};
result.capabilities = capabilities;
}
if (capabilities.textDocumentSync === undefined || capabilities.textDocumentSync === null) {
capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
}
else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) {
capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None;
}
for (let remote of allRemotes) {
remote.fillServerCapabilities(capabilities);
}
return result;
});
}
else {
let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } };
for (let remote of allRemotes) {
remote.fillServerCapabilities(result.capabilities);
}
return result;
}
});
connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => {
watchDog.shutdownReceived = true;
if (shutdownHandler) {
return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token);
}
else {
return undefined;
}
});
connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => {
try {
if (exitHandler) {
exitHandler();
}
}
finally {
if (watchDog.shutdownReceived) {
watchDog.exit(0);
}
else {
watchDog.exit(1);
}
}
});
connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => {
tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value);
});
return protocolConnection;
}
exports.createConnection = createConnection;
//# sourceMappingURL=server.js.map
/***/ }),
/* 52 */
/***/ ((__unused_webpack_module, exports) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateUuid = exports.parse = exports.isUUID = exports.v4 = exports.empty = void 0;
class ValueUUID {
constructor(_value) {
this._value = _value;
// empty
}
asHex() {
return this._value;
}
equals(other) {
return this.asHex() === other.asHex();
}
}
class V4UUID extends ValueUUID {
constructor() {
super([
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
'4',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._oneOf(V4UUID._timeHighBits),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
'-',
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
V4UUID._randomHex(),
].join(''));
}
static _oneOf(array) {
return array[Math.floor(array.length * Math.random())];
}
static _randomHex() {
return V4UUID._oneOf(V4UUID._chars);
}
}
V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
V4UUID._timeHighBits = ['8', '9', 'a', 'b'];
/**
* An empty UUID that contains only zeros.
*/
exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000');
function v4() {
return new V4UUID();
}
exports.v4 = v4;
const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
function isUUID(value) {
return _UUIDPattern.test(value);
}
exports.isUUID = isUUID;
/**
* Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
* @param value A uuid string.
*/
function parse(value) {
if (!isUUID(value)) {
throw new Error('invalid uuid');
}
return new ValueUUID(value);
}
exports.parse = parse;
function generateUuid() {
return v4().asHex();
}
exports.generateUuid = generateUuid;
//# sourceMappingURL=uuid.js.map
/***/ }),
/* 53 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.attachPartialResult = exports.ProgressFeature = exports.attachWorkDone = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const uuid_1 = __webpack_require__(52);
class WorkDoneProgressReporterImpl {
constructor(_connection, _token) {
this._connection = _connection;
this._token = _token;
WorkDoneProgressReporterImpl.Instances.set(this._token, this);
}
begin(title, percentage, message, cancellable) {
let param = {
kind: 'begin',
title,
percentage,
message,
cancellable
};
this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
}
report(arg0, arg1) {
let param = {
kind: 'report'
};
if (typeof arg0 === 'number') {
param.percentage = arg0;
if (arg1 !== undefined) {
param.message = arg1;
}
}
else {
param.message = arg0;
}
this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param);
}
done() {
WorkDoneProgressReporterImpl.Instances.delete(this._token);
this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' });
}
}
WorkDoneProgressReporterImpl.Instances = new Map();
class WorkDoneProgressServerReporterImpl extends WorkDoneProgressReporterImpl {
constructor(connection, token) {
super(connection, token);
this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
}
get token() {
return this._source.token;
}
done() {
this._source.dispose();
super.done();
}
cancel() {
this._source.cancel();
}
}
class NullProgressReporter {
constructor() {
}
begin() {
}
report() {
}
done() {
}
}
class NullProgressServerReporter extends NullProgressReporter {
constructor() {
super();
this._source = new vscode_languageserver_protocol_1.CancellationTokenSource();
}
get token() {
return this._source.token;
}
done() {
this._source.dispose();
}
cancel() {
this._source.cancel();
}
}
function attachWorkDone(connection, params) {
if (params === undefined || params.workDoneToken === undefined) {
return new NullProgressReporter();
}
const token = params.workDoneToken;
delete params.workDoneToken;
return new WorkDoneProgressReporterImpl(connection, token);
}
exports.attachWorkDone = attachWorkDone;
const ProgressFeature = (Base) => {
return class extends Base {
constructor() {
super();
this._progressSupported = false;
}
initialize(capabilities) {
var _a;
if (((_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.window) === null || _a === void 0 ? void 0 : _a.workDoneProgress) === true) {
this._progressSupported = true;
this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => {
let progress = WorkDoneProgressReporterImpl.Instances.get(params.token);
if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) {
progress.cancel();
}
});
}
}
attachWorkDoneProgress(token) {
if (token === undefined) {
return new NullProgressReporter();
}
else {
return new WorkDoneProgressReporterImpl(this.connection, token);
}
}
createWorkDoneProgress() {
if (this._progressSupported) {
const token = uuid_1.generateUuid();
return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => {
const result = new WorkDoneProgressServerReporterImpl(this.connection, token);
return result;
});
}
else {
return Promise.resolve(new NullProgressServerReporter());
}
}
};
};
exports.ProgressFeature = ProgressFeature;
var ResultProgress;
(function (ResultProgress) {
ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType();
})(ResultProgress || (ResultProgress = {}));
class ResultProgressReporterImpl {
constructor(_connection, _token) {
this._connection = _connection;
this._token = _token;
}
report(data) {
this._connection.sendProgress(ResultProgress.type, this._token, data);
}
}
function attachPartialResult(connection, params) {
if (params === undefined || params.partialResultToken === undefined) {
return undefined;
}
const token = params.partialResultToken;
delete params.partialResultToken;
return new ResultProgressReporterImpl(connection, token);
}
exports.attachPartialResult = attachPartialResult;
//# sourceMappingURL=progress.js.map
/***/ }),
/* 54 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigurationFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const Is = __webpack_require__(50);
const ConfigurationFeature = (Base) => {
return class extends Base {
getConfiguration(arg) {
if (!arg) {
return this._getConfiguration({});
}
else if (Is.string(arg)) {
return this._getConfiguration({ section: arg });
}
else {
return this._getConfiguration(arg);
}
}
_getConfiguration(arg) {
let params = {
items: Array.isArray(arg) ? arg : [arg]
};
return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => {
return Array.isArray(arg) ? result : result[0];
});
}
};
};
exports.ConfigurationFeature = ConfigurationFeature;
//# sourceMappingURL=configuration.js.map
/***/ }),
/* 55 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.WorkspaceFoldersFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const WorkspaceFoldersFeature = (Base) => {
return class extends Base {
initialize(capabilities) {
let workspaceCapabilities = capabilities.workspace;
if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) {
this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter();
this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => {
this._onDidChangeWorkspaceFolders.fire(params.event);
});
}
}
getWorkspaceFolders() {
return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type);
}
get onDidChangeWorkspaceFolders() {
if (!this._onDidChangeWorkspaceFolders) {
throw new Error('Client doesn\'t support sending workspace folder change events.');
}
if (!this._unregistration) {
this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type);
}
return this._onDidChangeWorkspaceFolders.event;
}
};
};
exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature;
//# sourceMappingURL=workspaceFolders.js.map
/***/ }),
/* 56 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CallHierarchyFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const CallHierarchyFeature = (Base) => {
return class extends Base {
get callHierarchy() {
return {
onPrepare: (handler) => {
this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
});
},
onIncomingCalls: (handler) => {
const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
},
onOutgoingCalls: (handler) => {
const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
}
};
}
};
};
exports.CallHierarchyFeature = CallHierarchyFeature;
//# sourceMappingURL=callHierarchy.js.map
/***/ }),
/* 57 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SemanticTokensBuilder = exports.SemanticTokensFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const SemanticTokensFeature = (Base) => {
return class extends Base {
get semanticTokens() {
return {
on: (handler) => {
const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
},
onDelta: (handler) => {
const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
},
onRange: (handler) => {
const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
}
};
}
};
};
exports.SemanticTokensFeature = SemanticTokensFeature;
class SemanticTokensBuilder {
constructor() {
this._prevData = undefined;
this.initialize();
}
initialize() {
this._id = Date.now();
this._prevLine = 0;
this._prevChar = 0;
this._data = [];
this._dataLen = 0;
}
push(line, char, length, tokenType, tokenModifiers) {
let pushLine = line;
let pushChar = char;
if (this._dataLen > 0) {
pushLine -= this._prevLine;
if (pushLine === 0) {
pushChar -= this._prevChar;
}
}
this._data[this._dataLen++] = pushLine;
this._data[this._dataLen++] = pushChar;
this._data[this._dataLen++] = length;
this._data[this._dataLen++] = tokenType;
this._data[this._dataLen++] = tokenModifiers;
this._prevLine = line;
this._prevChar = char;
}
get id() {
return this._id.toString();
}
previousResult(id) {
if (this.id === id) {
this._prevData = this._data;
}
this.initialize();
}
build() {
this._prevData = undefined;
return {
resultId: this.id,
data: this._data
};
}
canBuildEdits() {
return this._prevData !== undefined;
}
buildEdits() {
if (this._prevData !== undefined) {
const prevDataLength = this._prevData.length;
const dataLength = this._data.length;
let startIndex = 0;
while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) {
startIndex++;
}
if (startIndex < dataLength && startIndex < prevDataLength) {
// Find end index
let endIndex = 0;
while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) {
endIndex++;
}
const newData = this._data.slice(startIndex, dataLength - endIndex);
const result = {
resultId: this.id,
edits: [
{ start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData }
]
};
return result;
}
else if (startIndex < dataLength) {
return { resultId: this.id, edits: [
{ start: startIndex, deleteCount: 0, data: this._data.slice(startIndex) }
] };
}
else if (startIndex < prevDataLength) {
return { resultId: this.id, edits: [
{ start: startIndex, deleteCount: prevDataLength - startIndex }
] };
}
else {
return { resultId: this.id, edits: [] };
}
}
else {
return this.build();
}
}
}
exports.SemanticTokensBuilder = SemanticTokensBuilder;
//# sourceMappingURL=semanticTokens.js.map
/***/ }),
/* 58 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ShowDocumentFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const ShowDocumentFeature = (Base) => {
return class extends Base {
showDocument(params) {
return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params);
}
};
};
exports.ShowDocumentFeature = ShowDocumentFeature;
//# sourceMappingURL=showDocument.js.map
/***/ }),
/* 59 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FileOperationsFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const FileOperationsFeature = (Base) => {
return class extends Base {
onDidCreateFiles(handler) {
this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => {
handler(params);
});
}
onDidRenameFiles(handler) {
this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => {
handler(params);
});
}
onDidDeleteFiles(handler) {
this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => {
handler(params);
});
}
onWillCreateFiles(handler) {
return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => {
return handler(params, cancel);
});
}
onWillRenameFiles(handler) {
return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => {
return handler(params, cancel);
});
}
onWillDeleteFiles(handler) {
return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => {
return handler(params, cancel);
});
}
};
};
exports.FileOperationsFeature = FileOperationsFeature;
//# sourceMappingURL=fileOperations.js.map
/***/ }),
/* 60 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.LinkedEditingRangeFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const LinkedEditingRangeFeature = (Base) => {
return class extends Base {
onLinkedEditingRange(handler) {
this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), undefined);
});
}
};
};
exports.LinkedEditingRangeFeature = LinkedEditingRangeFeature;
//# sourceMappingURL=linkedEditingRange.js.map
/***/ }),
/* 61 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MonikerFeature = void 0;
const vscode_languageserver_protocol_1 = __webpack_require__(4);
const MonikerFeature = (Base) => {
return class extends Base {
get moniker() {
return {
on: (handler) => {
const type = vscode_languageserver_protocol_1.MonikerRequest.type;
this.connection.onRequest(type, (params, cancel) => {
return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params));
});
},
};
}
};
};
exports.MonikerFeature = MonikerFeature;
//# sourceMappingURL=moniker.js.map
/***/ }),
/* 62 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.resolveModulePath = exports.FileSystem = exports.resolveGlobalYarnPath = exports.resolveGlobalNodePath = exports.resolve = exports.uriToFilePath = void 0;
const url = __webpack_require__(63);
const path = __webpack_require__(3);
const fs = __webpack_require__(64);
const child_process_1 = __webpack_require__(65);
/**
* @deprecated Use the `vscode-uri` npm module which provides a more
* complete implementation of handling VS Code URIs.
*/
function uriToFilePath(uri) {
let parsed = url.parse(uri);
if (parsed.protocol !== 'file:' || !parsed.path) {
return undefined;
}
let segments = parsed.path.split('/');
for (var i = 0, len = segments.length; i < len; i++) {
segments[i] = decodeURIComponent(segments[i]);
}
if (process.platform === 'win32' && segments.length > 1) {
let first = segments[0];
let second = segments[1];
// Do we have a drive letter and we started with a / which is the
// case if the first segement is empty (see split above)
if (first.length === 0 && second.length > 1 && second[1] === ':') {
// Remove first slash
segments.shift();
}
}
return path.normalize(segments.join('/'));
}
exports.uriToFilePath = uriToFilePath;
function isWindows() {
return process.platform === 'win32';
}
function resolve(moduleName, nodePath, cwd, tracer) {
const nodePathKey = 'NODE_PATH';
const app = [
'var p = process;',
'p.on(\'message\',function(m){',
'if(m.c===\'e\'){',
'p.exit(0);',
'}',
'else if(m.c===\'rs\'){',
'try{',
'var r=require.resolve(m.a);',
'p.send({c:\'r\',s:true,r:r});',
'}',
'catch(err){',
'p.send({c:\'r\',s:false});',
'}',
'}',
'});'
].join('');
return new Promise((resolve, reject) => {
let env = process.env;
let newEnv = Object.create(null);
Object.keys(env).forEach(key => newEnv[key] = env[key]);
if (nodePath && fs.existsSync(nodePath) /* see issue 545 */) {
if (newEnv[nodePathKey]) {
newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey];
}
else {
newEnv[nodePathKey] = nodePath;
}
if (tracer) {
tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`);
}
}
newEnv['ELECTRON_RUN_AS_NODE'] = '1';
try {
let cp = child_process_1.fork('', [], {
cwd: cwd,
env: newEnv,
execArgv: ['-e', app]
});
if (cp.pid === void 0) {
reject(new Error(`Starting process to resolve node module ${moduleName} failed`));
return;
}
cp.on('error', (error) => {
reject(error);
});
cp.on('message', (message) => {
if (message.c === 'r') {
cp.send({ c: 'e' });
if (message.s) {
resolve(message.r);
}
else {
reject(new Error(`Failed to resolve module: ${moduleName}`));
}
}
});
let message = {
c: 'rs',
a: moduleName
};
cp.send(message);
}
catch (error) {
reject(error);
}
});
}
exports.resolve = resolve;
/**
* Resolve the global npm package path.
* @deprecated Since this depends on the used package manager and their version the best is that servers
* implement this themselves since they know best what kind of package managers to support.
* @param tracer the tracer to use
*/
function resolveGlobalNodePath(tracer) {
let npmCommand = 'npm';
const env = Object.create(null);
Object.keys(process.env).forEach(key => env[key] = process.env[key]);
env['NO_UPDATE_NOTIFIER'] = 'true';
const options = {
encoding: 'utf8',
env
};
if (isWindows()) {
npmCommand = 'npm.cmd';
options.shell = true;
}
let handler = () => { };
try {
process.on('SIGPIPE', handler);
let stdout = child_process_1.spawnSync(npmCommand, ['config', 'get', 'prefix'], options).stdout;
if (!stdout) {
if (tracer) {
tracer(`'npm config get prefix' didn't return a value.`);
}
return undefined;
}
let prefix = stdout.trim();
if (tracer) {
tracer(`'npm config get prefix' value is: ${prefix}`);
}
if (prefix.length > 0) {
if (isWindows()) {
return path.join(prefix, 'node_modules');
}
else {
return path.join(prefix, 'lib', 'node_modules');
}
}
return undefined;
}
catch (err) {
return undefined;
}
finally {
process.removeListener('SIGPIPE', handler);
}
}
exports.resolveGlobalNodePath = resolveGlobalNodePath;
/*
* Resolve the global yarn pakage path.
* @deprecated Since this depends on the used package manager and their version the best is that servers
* implement this themselves since they know best what kind of package managers to support.
* @param tracer the tracer to use
*/
function resolveGlobalYarnPath(tracer) {
let yarnCommand = 'yarn';
let options = {
encoding: 'utf8'
};
if (isWindows()) {
yarnCommand = 'yarn.cmd';
options.shell = true;
}
let handler = () => { };
try {
process.on('SIGPIPE', handler);
let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options);
let stdout = results.stdout;
if (!stdout) {
if (tracer) {
tracer(`'yarn global dir' didn't return a value.`);
if (results.stderr) {
tracer(results.stderr);
}
}
return undefined;
}
let lines = stdout.trim().split(/\r?\n/);
for (let line of lines) {
try {
let yarn = JSON.parse(line);
if (yarn.type === 'log') {
return path.join(yarn.data, 'node_modules');
}
}
catch (e) {
// Do nothing. Ignore the line
}
}
return undefined;
}
catch (err) {
return undefined;
}
finally {
process.removeListener('SIGPIPE', handler);
}
}
exports.resolveGlobalYarnPath = resolveGlobalYarnPath;
var FileSystem;
(function (FileSystem) {
let _isCaseSensitive = undefined;
function isCaseSensitive() {
if (_isCaseSensitive !== void 0) {
return _isCaseSensitive;
}
if (process.platform === 'win32') {
_isCaseSensitive = false;
}
else {
// convert current file name to upper case / lower case and check if file exists
// (guards against cases when name is already all uppercase or lowercase)
_isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase());
}
return _isCaseSensitive;
}
FileSystem.isCaseSensitive = isCaseSensitive;
function isParent(parent, child) {
if (isCaseSensitive()) {
return path.normalize(child).indexOf(path.normalize(parent)) === 0;
}
else {
return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0;
}
}
FileSystem.isParent = isParent;
})(FileSystem = exports.FileSystem || (exports.FileSystem = {}));
function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) {
if (nodePath) {
if (!path.isAbsolute(nodePath)) {
nodePath = path.join(workspaceRoot, nodePath);
}
return resolve(moduleName, nodePath, nodePath, tracer).then((value) => {
if (FileSystem.isParent(nodePath, value)) {
return value;
}
else {
return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));
}
}).then(undefined, (_error) => {
return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
});
}
else {
return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
}
}
exports.resolveModulePath = resolveModulePath;
//# sourceMappingURL=files.js.map
/***/ }),
/* 63 */
/***/ ((module) => {
module.exports = require("url");;
/***/ }),
/* 64 */
/***/ ((module) => {
module.exports = require("fs");;
/***/ }),
/* 65 */
/***/ ((module) => {
module.exports = require("child_process");;
/***/ }),
/* 66 */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ----------------------------------------------------------------------------------------- */
module.exports = __webpack_require__(4);
/***/ }),
/* 67 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ProposedFeatures = exports.SemanticTokensBuilder = void 0;
const semanticTokens_1 = __webpack_require__(57);
Object.defineProperty(exports, "SemanticTokensBuilder", ({ enumerable: true, get: function () { return semanticTokens_1.SemanticTokensBuilder; } }));
__exportStar(__webpack_require__(4), exports);
__exportStar(__webpack_require__(51), exports);
var ProposedFeatures;
(function (ProposedFeatures) {
ProposedFeatures.all = {
__brand: 'features'
};
})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {}));
//# sourceMappingURL=api.js.map
/***/ }),
/* 68 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.runSafe = exports.formatError = void 0;
const vscode_languageserver_1 = __webpack_require__(49);
function formatError(message, err) {
if (err instanceof Error) {
let error = err;
return `${message}: ${error.message}\n${error.stack}`;
}
else if (typeof err === 'string') {
return `${message}: ${err}`;
}
else if (err) {
return `${message}: ${err.toString()}`;
}
return message;
}
exports.formatError = formatError;
function runSafe(func, errorVal, errorMessage, token) {
return new Promise((resolve) => {
setImmediate(() => {
if (token.isCancellationRequested) {
resolve(cancelValue());
}
return func().then(result => {
if (token.isCancellationRequested) {
resolve(cancelValue());
return;
}
else {
resolve(result);
}
}, e => {
console.error(formatError(errorMessage, e));
resolve(errorVal);
});
});
});
}
exports.runSafe = runSafe;
function cancelValue() {
return new vscode_languageserver_1.ResponseError(vscode_languageserver_1.LSPErrorCodes.RequestCancelled, 'Request cancelled');
}
/***/ }),
/* 69 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.startServer = void 0;
const vscode_languageserver_1 = __webpack_require__(49);
const languageModes_1 = __webpack_require__(70);
const formatting_1 = __webpack_require__(154);
const arrays_1 = __webpack_require__(155);
const documentContext_1 = __webpack_require__(156);
const vscode_uri_1 = __webpack_require__(135);
const runner_1 = __webpack_require__(68);
const htmlFolding_1 = __webpack_require__(158);
const customData_1 = __webpack_require__(159);
const selectionRanges_1 = __webpack_require__(160);
const semanticTokens_1 = __webpack_require__(162);
const requests_1 = __webpack_require__(157);
var CustomDataChangedNotification;
(function (CustomDataChangedNotification) {
CustomDataChangedNotification.type = new vscode_languageserver_1.NotificationType('html/customDataChanged');
})(CustomDataChangedNotification || (CustomDataChangedNotification = {}));
var TagCloseRequest;
(function (TagCloseRequest) {
TagCloseRequest.type = new vscode_languageserver_1.RequestType('html/tag');
})(TagCloseRequest || (TagCloseRequest = {}));
var SemanticTokenRequest;
(function (SemanticTokenRequest) {
SemanticTokenRequest.type = new vscode_languageserver_1.RequestType('html/semanticTokens');
})(SemanticTokenRequest || (SemanticTokenRequest = {}));
var SemanticTokenLegendRequest;
(function (SemanticTokenLegendRequest) {
SemanticTokenLegendRequest.type = new vscode_languageserver_1.RequestType0('html/semanticTokenLegend');
})(SemanticTokenLegendRequest || (SemanticTokenLegendRequest = {}));
function startServer(connection, runtime) {
// Create a text document manager.
const documents = new vscode_languageserver_1.TextDocuments(languageModes_1.TextDocument);
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
let workspaceFolders = [];
let languageModes;
let clientSnippetSupport = false;
let dynamicFormatterRegistration = false;
let scopedSettingsSupport = false;
let workspaceFoldersSupport = false;
let foldingRangeLimit = Number.MAX_VALUE;
const notReady = () => Promise.reject('Not Ready');
let requestService = { getContent: notReady, stat: notReady, readDirectory: notReady };
let globalSettings = {};
let documentSettings = {};
// remove document settings on close
documents.onDidClose(e => {
delete documentSettings[e.document.uri];
});
function getDocumentSettings(textDocument, needsDocumentSettings) {
if (scopedSettingsSupport && needsDocumentSettings()) {
let promise = documentSettings[textDocument.uri];
if (!promise) {
const scopeUri = textDocument.uri;
const configRequestParam = { items: [{ scopeUri, section: 'css' }, { scopeUri, section: 'html' }, { scopeUri, section: 'javascript' }] };
promise = connection.sendRequest(vscode_languageserver_1.ConfigurationRequest.type, configRequestParam).then(s => ({ css: s[0], html: s[1], javascript: s[2] }));
documentSettings[textDocument.uri] = promise;
}
return promise;
}
return Promise.resolve(undefined);
}
// After the server has started the client sends an initialize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilities
connection.onInitialize((params) => {
const initializationOptions = params.initializationOptions;
workspaceFolders = params.workspaceFolders;
if (!Array.isArray(workspaceFolders)) {
workspaceFolders = [];
if (params.rootPath) {
workspaceFolders.push({ name: '', uri: vscode_uri_1.URI.file(params.rootPath).toString() });
}
}
requestService = requests_1.getRequestService((initializationOptions === null || initializationOptions === void 0 ? void 0 : initializationOptions.handledSchemas) || ['file'], connection, runtime);
const workspace = {
get settings() { return globalSettings; },
get folders() { return workspaceFolders; }
};
languageModes = languageModes_1.getLanguageModes((initializationOptions === null || initializationOptions === void 0 ? void 0 : initializationOptions.embeddedLanguages) || { css: true, javascript: true }, workspace, params.capabilities, requestService);
const dataPaths = (initializationOptions === null || initializationOptions === void 0 ? void 0 : initializationOptions.dataPaths) || [];
customData_1.fetchHTMLDataProviders(dataPaths, requestService).then(dataProviders => {
languageModes.updateDataProviders(dataProviders);
});
documents.onDidClose(e => {
languageModes.onDocumentRemoved(e.document);
});
connection.onShutdown(() => {
languageModes.dispose();
});
function getClientCapability(name, def) {
const keys = name.split('.');
let c = params.capabilities;
for (let i = 0; c && i < keys.length; i++) {
if (!c.hasOwnProperty(keys[i])) {
return def;
}
c = c[keys[i]];
}
return c;
}
clientSnippetSupport = getClientCapability('textDocument.completion.completionItem.snippetSupport', false);
dynamicFormatterRegistration = getClientCapability('textDocument.rangeFormatting.dynamicRegistration', false) && (typeof (initializationOptions === null || initializationOptions === void 0 ? void 0 : initializationOptions.provideFormatter) !== 'boolean');
scopedSettingsSupport = getClientCapability('workspace.configuration', false);
workspaceFoldersSupport = getClientCapability('workspace.workspaceFolders', false);
foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE);
const capabilities = {
textDocumentSync: vscode_languageserver_1.TextDocumentSyncKind.Incremental,
completionProvider: clientSnippetSupport ? { resolveProvider: true, triggerCharacters: ['.', ':', '<', '"', '=', '/'] } : undefined,
hoverProvider: true,
documentHighlightProvider: true,
documentRangeFormattingProvider: (initializationOptions === null || initializationOptions === void 0 ? void 0 : initializationOptions.provideFormatter) === true,
documentLinkProvider: { resolveProvider: false },
documentSymbolProvider: true,
definitionProvider: true,
signatureHelpProvider: { triggerCharacters: ['('] },
referencesProvider: true,
colorProvider: {},
foldingRangeProvider: true,
selectionRangeProvider: true,
renameProvider: true,
linkedEditingRangeProvider: true
};
return { capabilities };
});
connection.onInitialized(() => {
if (workspaceFoldersSupport) {
connection.client.register(vscode_languageserver_1.DidChangeWorkspaceFoldersNotification.type);
connection.onNotification(vscode_languageserver_1.DidChangeWorkspaceFoldersNotification.type, e => {
const toAdd = e.event.added;
const toRemove = e.event.removed;
const updatedFolders = [];
if (workspaceFolders) {
for (const folder of workspaceFolders) {
if (!toRemove.some(r => r.uri === folder.uri) && !toAdd.some(r => r.uri === folder.uri)) {
updatedFolders.push(folder);
}
}
}
workspaceFolders = updatedFolders.concat(toAdd);
documents.all().forEach(triggerValidation);
});
}
});
let formatterRegistration = null;
// The settings have changed. Is send on server activation as well.
connection.onDidChangeConfiguration((change) => {
globalSettings = change.settings;
documentSettings = {}; // reset all document settings
documents.all().forEach(triggerValidation);
// dynamically enable & disable the formatter
if (dynamicFormatterRegistration) {
const enableFormatter = globalSettings && globalSettings.html && globalSettings.html.format && globalSettings.html.format.enable;
if (enableFormatter) {
if (!formatterRegistration) {
const documentSelector = [{ language: 'html' }, { language: 'handlebars' }];
formatterRegistration = connection.client.register(vscode_languageserver_1.DocumentRangeFormattingRequest.type, { documentSelector });
}
}
else if (formatterRegistration) {
formatterRegistration.then(r => r.dispose());
formatterRegistration = null;
}
}
});
const pendingValidationRequests = {};
const validationDelayMs = 500;
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(change => {
triggerValidation(change.document);
});
// a document has closed: clear all diagnostics
documents.onDidClose(event => {
cleanPendingValidation(event.document);
connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
});
function cleanPendingValidation(textDocument) {
const request = pendingValidationRequests[textDocument.uri];
if (request) {
clearTimeout(request);
delete pendingValidationRequests[textDocument.uri];
}
}
function triggerValidation(textDocument) {
cleanPendingValidation(textDocument);
pendingValidationRequests[textDocument.uri] = setTimeout(() => {
delete pendingValidationRequests[textDocument.uri];
validateTextDocument(textDocument);
}, validationDelayMs);
}
function isValidationEnabled(languageId, settings = globalSettings) {
const validationSettings = settings && settings.html && settings.html.validate;
if (validationSettings) {
return languageId === 'css' && validationSettings.styles !== false || languageId === 'javascript' && validationSettings.scripts !== false;
}
return true;
}
function validateTextDocument(textDocument) {
return __awaiter(this, void 0, void 0, function* () {
try {
const version = textDocument.version;
const diagnostics = [];
if (textDocument.languageId === 'html') {
const modes = languageModes.getAllModesInDocument(textDocument);
const settings = yield getDocumentSettings(textDocument, () => modes.some(m => !!m.doValidation));
const latestTextDocument = documents.get(textDocument.uri);
if (latestTextDocument && latestTextDocument.version === version) { // check no new version has come in after in after the async op
for (const mode of modes) {
if (mode.doValidation && isValidationEnabled(mode.getId(), settings)) {
arrays_1.pushAll(diagnostics, yield mode.doValidation(latestTextDocument, settings));
}
}
connection.sendDiagnostics({ uri: latestTextDocument.uri, diagnostics });
}
}
}
catch (e) {
connection.console.error(runner_1.formatError(`Error while validating ${textDocument.uri}`, e));
}
});
}
connection.onCompletion((textDocumentPosition, token) => __awaiter(this, void 0, void 0, function* () {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(textDocumentPosition.textDocument.uri);
if (!document) {
return null;
}
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
if (!mode || !mode.doComplete) {
return { isIncomplete: true, items: [] };
}
const doComplete = mode.doComplete;
if (mode.getId() !== 'html') {
/* __GDPR__
"html.embbedded.complete" : {
"languageId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
connection.telemetry.logEvent({ key: 'html.embbedded.complete', value: { languageId: mode.getId() } });
}
const settings = yield getDocumentSettings(document, () => doComplete.length > 2);
const documentContext = documentContext_1.getDocumentContext(document.uri, workspaceFolders);
return doComplete(document, textDocumentPosition.position, documentContext, settings);
}), null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token);
}));
connection.onCompletionResolve((item, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const data = item.data;
if (data && data.languageId && data.uri) {
const mode = languageModes.getMode(data.languageId);
const document = documents.get(data.uri);
if (mode && mode.doResolve && document) {
return mode.doResolve(document, item);
}
}
return item;
}), item, `Error while resolving completion proposal`, token);
});
connection.onHover((textDocumentPosition, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(textDocumentPosition.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position);
const doHover = mode === null || mode === void 0 ? void 0 : mode.doHover;
if (doHover) {
const settings = yield getDocumentSettings(document, () => doHover.length > 2);
return doHover(document, textDocumentPosition.position, settings);
}
}
return null;
}), null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token);
});
connection.onDocumentHighlight((documentHighlightParams, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(documentHighlightParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, documentHighlightParams.position);
if (mode && mode.findDocumentHighlight) {
return mode.findDocumentHighlight(document, documentHighlightParams.position);
}
}
return [];
}), [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token);
});
connection.onDefinition((definitionParams, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(definitionParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, definitionParams.position);
if (mode && mode.findDefinition) {
return mode.findDefinition(document, definitionParams.position);
}
}
return [];
}), null, `Error while computing definitions for ${definitionParams.textDocument.uri}`, token);
});
connection.onReferences((referenceParams, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(referenceParams.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, referenceParams.position);
if (mode && mode.findReferences) {
return mode.findReferences(document, referenceParams.position);
}
}
return [];
}), [], `Error while computing references for ${referenceParams.textDocument.uri}`, token);
});
connection.onSignatureHelp((signatureHelpParms, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(signatureHelpParms.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, signatureHelpParms.position);
if (mode && mode.doSignatureHelp) {
return mode.doSignatureHelp(document, signatureHelpParms.position);
}
}
return null;
}), null, `Error while computing signature help for ${signatureHelpParms.textDocument.uri}`, token);
});
connection.onDocumentRangeFormatting((formatParams, token) => __awaiter(this, void 0, void 0, function* () {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(formatParams.textDocument.uri);
if (document) {
let settings = yield getDocumentSettings(document, () => true);
if (!settings) {
settings = globalSettings;
}
const unformattedTags = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
const enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };
return formatting_1.format(languageModes, document, formatParams.range, formatParams.options, settings, enabledModes);
}
return [];
}), [], `Error while formatting range for ${formatParams.textDocument.uri}`, token);
}));
connection.onDocumentLinks((documentLinkParam, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(documentLinkParam.textDocument.uri);
const links = [];
if (document) {
const documentContext = documentContext_1.getDocumentContext(document.uri, workspaceFolders);
for (const m of languageModes.getAllModesInDocument(document)) {
if (m.findDocumentLinks) {
arrays_1.pushAll(links, yield m.findDocumentLinks(document, documentContext));
}
}
}
return links;
}), [], `Error while document links for ${documentLinkParam.textDocument.uri}`, token);
});
connection.onDocumentSymbol((documentSymbolParms, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(documentSymbolParms.textDocument.uri);
const symbols = [];
if (document) {
for (const m of languageModes.getAllModesInDocument(document)) {
if (m.findDocumentSymbols) {
arrays_1.pushAll(symbols, yield m.findDocumentSymbols(document));
}
}
}
return symbols;
}), [], `Error while computing document symbols for ${documentSymbolParms.textDocument.uri}`, token);
});
connection.onRequest(vscode_languageserver_1.DocumentColorRequest.type, (params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const infos = [];
const document = documents.get(params.textDocument.uri);
if (document) {
for (const m of languageModes.getAllModesInDocument(document)) {
if (m.findDocumentColors) {
arrays_1.pushAll(infos, yield m.findDocumentColors(document));
}
}
}
return infos;
}), [], `Error while computing document colors for ${params.textDocument.uri}`, token);
});
connection.onRequest(vscode_languageserver_1.ColorPresentationRequest.type, (params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
const mode = languageModes.getModeAtPosition(document, params.range.start);
if (mode && mode.getColorPresentations) {
return mode.getColorPresentations(document, params.color, params.range);
}
}
return [];
}), [], `Error while computing color presentations for ${params.textDocument.uri}`, token);
});
connection.onRequest(TagCloseRequest.type, (params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
const pos = params.position;
if (pos.character > 0) {
const mode = languageModes.getModeAtPosition(document, languageModes_1.Position.create(pos.line, pos.character - 1));
if (mode && mode.doAutoClose) {
return mode.doAutoClose(document, pos);
}
}
}
return null;
}), null, `Error while computing tag close actions for ${params.textDocument.uri}`, token);
});
connection.onFoldingRanges((params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
return htmlFolding_1.getFoldingRanges(languageModes, document, foldingRangeLimit, token);
}
return null;
}), null, `Error while computing folding regions for ${params.textDocument.uri}`, token);
});
connection.onSelectionRanges((params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
return selectionRanges_1.getSelectionRanges(languageModes, document, params.positions);
}
return [];
}), [], `Error while computing selection ranges for ${params.textDocument.uri}`, token);
});
connection.onRenameRequest((params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
const position = params.position;
if (document) {
const mode = languageModes.getModeAtPosition(document, params.position);
if (mode && mode.doRename) {
return mode.doRename(document, position, params.newName);
}
}
return null;
}), null, `Error while computing rename for ${params.textDocument.uri}`, token);
});
connection.languages.onLinkedEditingRange((params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
const pos = params.position;
if (pos.character > 0) {
const mode = languageModes.getModeAtPosition(document, languageModes_1.Position.create(pos.line, pos.character - 1));
if (mode && mode.doLinkedEditing) {
const ranges = yield mode.doLinkedEditing(document, pos);
if (ranges) {
return { ranges };
}
}
}
}
return null;
}), null, `Error while computing synced regions for ${params.textDocument.uri}`, token);
});
let semanticTokensProvider;
function getSemanticTokenProvider() {
if (!semanticTokensProvider) {
semanticTokensProvider = semanticTokens_1.newSemanticTokenProvider(languageModes);
}
return semanticTokensProvider;
}
connection.onRequest(SemanticTokenRequest.type, (params, token) => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
const document = documents.get(params.textDocument.uri);
if (document) {
return getSemanticTokenProvider().getSemanticTokens(document, params.ranges);
}
return null;
}), null, `Error while computing semantic tokens for ${params.textDocument.uri}`, token);
});
connection.onRequest(SemanticTokenLegendRequest.type, token => {
return runner_1.runSafe(() => __awaiter(this, void 0, void 0, function* () {
return getSemanticTokenProvider().legend;
}), null, `Error while computing semantic tokens legend`, token);
});
connection.onNotification(CustomDataChangedNotification.type, dataPaths => {
customData_1.fetchHTMLDataProviders(dataPaths, requestService).then(dataProviders => {
languageModes.updateDataProviders(dataProviders);
});
});
// Listen on the connection
connection.listen();
}
exports.startServer = startServer;
/***/ }),
/* 70 */
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getLanguageModes = void 0;
const vscode_css_languageservice_1 = __webpack_require__(71);
const vscode_html_languageservice_1 = __webpack_require__(115);
const languageModelCache_1 = __webpack_require__(145);
const cssMode_1 = __webpack_require__(146);
const embeddedSupport_1 = __webpack_require__(147);
const htmlMode_1 = __webpack_require__(148);
const javascriptMode_1 = __webpack_require__(149);
__exportStar(__webpack_require__(115), exports);
function getLanguageModes(supportedLanguages, workspace, clientCapabilities, requestService) {
const htmlLanguageService = vscode_html_languageservice_1.getLanguageService({ clientCapabilities, fileSystemProvider: requestService });
const cssLanguageService = vscode_css_languageservice_1.getCSSLanguageService({ clientCapabilities, fileSystemProvider: requestService });
let documentRegions = languageModelCache_1.getLanguageModelCache(10, 60, document => embeddedSupport_1.getDocumentRegions(htmlLanguageService, document));
let modelCaches = [];
modelCaches.push(documentRegions);
let modes = Object.create(null);
modes['html'] = htmlMode_1.getHTMLMode(htmlLanguageService, workspace);
if (supportedLanguages['css']) {
modes['css'] = cssMode_1.getCSSMode(cssLanguageService, documentRegions, workspace);
}
if (supportedLanguages['javascript']) {
modes['javascript'] = javascriptMode_1.getJavaScriptMode(documentRegions, 'javascript', workspace);
modes['typescript'] = javascriptMode_1.getJavaScriptMode(documentRegions, 'typescript', workspace);
}
return {
updateDataProviders(dataProviders) {
return __awaiter(this, void 0, void 0, function* () {
htmlLanguageService.setDataProviders(true, dataProviders);
});
},
getModeAtPosition(document, position) {
let languageId = documentRegions.get(document).getLanguageAtPosition(position);
if (languageId) {
return modes[languageId];
}
return undefined;
},
getModesInRange(document, range) {
return documentRegions.get(document).getLanguageRanges(range).map(r => {
return {
start: r.start,
end: r.end,
mode: r.languageId && modes[r.languageId],
attributeValue: r.attributeValue
};
});
},
getAllModesInDocument(document) {
let result = [];
for (let languageId of documentRegions.get(document).getLanguagesInDocument()) {
let mode = modes[languageId];
if (mode) {
result.push(mode);
}
}
return result;
},
getAllModes() {
let result = [];
for (let languageId in modes) {
let mode = modes[languageId];
if (mode) {
result.push(mode);
}
}
return result;
},
getMode(languageId) {
return modes[languageId];
},
onDocumentRemoved(document) {
modelCaches.forEach(mc => mc.onDocumentRemoved(document));
for (let mode in modes) {
modes[mode].onDocumentRemoved(document);
}
},
dispose() {
modelCaches.forEach(mc => mc.dispose());
modelCaches = [];
for (let mode in modes) {
modes[mode].dispose();
}
modes = {};
}
};
}
exports.getLanguageModes = getLanguageModes;
/***/ }),
/* 71 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "AnnotatedTextEdit": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.AnnotatedTextEdit,
/* harmony export */ "ChangeAnnotation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ChangeAnnotationIdentifier,
/* harmony export */ "ClientCapabilities": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ClientCapabilities,
/* harmony export */ "CodeAction": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CodeAction,
/* harmony export */ "CodeActionContext": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CodeActionContext,
/* harmony export */ "CodeActionKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CodeActionKind,
/* harmony export */ "CodeDescription": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CodeDescription,
/* harmony export */ "CodeLens": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CodeLens,
/* harmony export */ "Color": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Color,
/* harmony export */ "ColorInformation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ColorInformation,
/* harmony export */ "ColorPresentation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ColorPresentation,
/* harmony export */ "Command": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Command,
/* harmony export */ "CompletionItem": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CompletionItem,
/* harmony export */ "CompletionItemKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CompletionItemKind,
/* harmony export */ "CompletionItemTag": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CompletionItemTag,
/* harmony export */ "CompletionList": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CompletionList,
/* harmony export */ "CreateFile": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.CreateFile,
/* harmony export */ "DeleteFile": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DeleteFile,
/* harmony export */ "Diagnostic": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Diagnostic,
/* harmony export */ "DiagnosticRelatedInformation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DiagnosticTag,
/* harmony export */ "DocumentHighlight": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DocumentHighlight,
/* harmony export */ "DocumentHighlightKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DocumentHighlightKind,
/* harmony export */ "DocumentLink": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DocumentLink,
/* harmony export */ "DocumentSymbol": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DocumentSymbol,
/* harmony export */ "EOL": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.EOL,
/* harmony export */ "FileType": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.FileType,
/* harmony export */ "FoldingRange": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.FoldingRange,
/* harmony export */ "FoldingRangeKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.FoldingRangeKind,
/* harmony export */ "FormattingOptions": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.FormattingOptions,
/* harmony export */ "Hover": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Hover,
/* harmony export */ "InsertReplaceEdit": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.InsertReplaceEdit,
/* harmony export */ "InsertTextFormat": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.InsertTextFormat,
/* harmony export */ "InsertTextMode": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.InsertTextMode,
/* harmony export */ "Location": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Location,
/* harmony export */ "LocationLink": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.LocationLink,
/* harmony export */ "MarkedString": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.MarkedString,
/* harmony export */ "MarkupContent": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.MarkupContent,
/* harmony export */ "MarkupKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.MarkupKind,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "ParameterInformation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.ParameterInformation,
/* harmony export */ "Position": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Position,
/* harmony export */ "Range": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.Range,
/* harmony export */ "RenameFile": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.RenameFile,
/* harmony export */ "SelectionRange": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.SelectionRange,
/* harmony export */ "SignatureInformation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.SignatureInformation,
/* harmony export */ "SymbolInformation": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.SymbolInformation,
/* harmony export */ "SymbolKind": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.SymbolKind,
/* harmony export */ "SymbolTag": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.SymbolTag,
/* harmony export */ "TextDocument": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.TextDocument,
/* harmony export */ "TextDocumentEdit": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.TextDocumentEdit,
/* harmony export */ "TextDocumentIdentifier": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.TextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.TextDocumentItem,
/* harmony export */ "TextEdit": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.TextEdit,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.VersionedTextDocumentIdentifier,
/* harmony export */ "WorkspaceChange": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.WorkspaceChange,
/* harmony export */ "WorkspaceEdit": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.WorkspaceEdit,
/* harmony export */ "integer": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.integer,
/* harmony export */ "uinteger": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.uinteger,
/* harmony export */ "getDefaultCSSDataProvider": () => /* binding */ getDefaultCSSDataProvider,
/* harmony export */ "newCSSDataProvider": () => /* binding */ newCSSDataProvider,
/* harmony export */ "getCSSLanguageService": () => /* binding */ getCSSLanguageService,
/* harmony export */ "getSCSSLanguageService": () => /* binding */ getSCSSLanguageService,
/* harmony export */ "getLESSLanguageService": () => /* binding */ getLESSLanguageService
/* harmony export */ });
/* harmony import */ var _parser_cssParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72);
/* harmony import */ var _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(85);
/* harmony import */ var _services_cssHover__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94);
/* harmony import */ var _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(96);
/* harmony import */ var _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(97);
/* harmony import */ var _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(99);
/* harmony import */ var _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(102);
/* harmony import */ var _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(105);
/* harmony import */ var _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(106);
/* harmony import */ var _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(108);
/* harmony import */ var _services_cssFolding__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(109);
/* harmony import */ var _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(110);
/* harmony import */ var _languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(112);
/* harmony import */ var _services_cssSelectionRange__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(113);
/* harmony import */ var _services_scssNavigation__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(114);
/* harmony import */ var _data_webCustomData__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(111);
/* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(88);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function getDefaultCSSDataProvider() {
return newCSSDataProvider(_data_webCustomData__WEBPACK_IMPORTED_MODULE_15__.cssData);
}
function newCSSDataProvider(data) {
return new _languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_12__.CSSDataProvider(data);
}
function createFacade(parser, completion, hover, navigation, codeActions, validation, cssDataManager) {
return {
configure: function (settings) {
validation.configure(settings);
completion.configure(settings);
},
setDataProviders: cssDataManager.setDataProviders.bind(cssDataManager),
doValidation: validation.doValidation.bind(validation),
parseStylesheet: parser.parseStylesheet.bind(parser),
doComplete: completion.doComplete.bind(completion),
doComplete2: completion.doComplete2.bind(completion),
setCompletionParticipants: completion.setCompletionParticipants.bind(completion),
doHover: hover.doHover.bind(hover),
findDefinition: navigation.findDefinition.bind(navigation),
findReferences: navigation.findReferences.bind(navigation),
findDocumentHighlights: navigation.findDocumentHighlights.bind(navigation),
findDocumentLinks: navigation.findDocumentLinks.bind(navigation),
findDocumentLinks2: navigation.findDocumentLinks2.bind(navigation),
findDocumentSymbols: navigation.findDocumentSymbols.bind(navigation),
doCodeActions: codeActions.doCodeActions.bind(codeActions),
doCodeActions2: codeActions.doCodeActions2.bind(codeActions),
findDocumentColors: navigation.findDocumentColors.bind(navigation),
getColorPresentations: navigation.getColorPresentations.bind(navigation),
doRename: navigation.doRename.bind(navigation),
getFoldingRanges: _services_cssFolding__WEBPACK_IMPORTED_MODULE_10__.getFoldingRanges,
getSelectionRanges: _services_cssSelectionRange__WEBPACK_IMPORTED_MODULE_13__.getSelectionRanges
};
}
var defaultLanguageServiceOptions = {};
function getCSSLanguageService(options) {
if (options === void 0) { options = defaultLanguageServiceOptions; }
var cssDataManager = new _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__.CSSDataManager(options);
return createFacade(new _parser_cssParser__WEBPACK_IMPORTED_MODULE_0__.Parser(), new _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__.CSSCompletion(null, options, cssDataManager), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__.CSSHover(options && options.clientCapabilities, cssDataManager), new _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__.CSSNavigation(options && options.fileSystemProvider), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__.CSSCodeActions(cssDataManager), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__.CSSValidation(cssDataManager), cssDataManager);
}
function getSCSSLanguageService(options) {
if (options === void 0) { options = defaultLanguageServiceOptions; }
var cssDataManager = new _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__.CSSDataManager(options);
return createFacade(new _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__.SCSSParser(), new _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__.SCSSCompletion(options, cssDataManager), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__.CSSHover(options && options.clientCapabilities, cssDataManager), new _services_scssNavigation__WEBPACK_IMPORTED_MODULE_14__.SCSSNavigation(options && options.fileSystemProvider), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__.CSSCodeActions(cssDataManager), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__.CSSValidation(cssDataManager), cssDataManager);
}
function getLESSLanguageService(options) {
if (options === void 0) { options = defaultLanguageServiceOptions; }
var cssDataManager = new _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__.CSSDataManager(options);
return createFacade(new _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__.LESSParser(), new _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__.LESSCompletion(options, cssDataManager), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__.CSSHover(options && options.clientCapabilities, cssDataManager), new _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__.CSSNavigation(options && options.fileSystemProvider), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__.CSSCodeActions(cssDataManager), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__.CSSValidation(cssDataManager), cssDataManager);
}
/***/ }),
/* 72 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Parser": () => /* binding */ Parser
/* harmony export */ });
/* harmony import */ var _cssScanner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73);
/* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(74);
/* harmony import */ var _cssErrors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(76);
/* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(80);
/* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
///
/// A parser for the css core specification. See for reference:
/// https://www.w3.org/TR/CSS21/grammar.html
/// http://www.w3.org/TR/CSS21/syndata.html#tokenization
///
var Parser = /** @class */ (function () {
function Parser(scnr) {
if (scnr === void 0) { scnr = new _cssScanner__WEBPACK_IMPORTED_MODULE_0__.Scanner(); }
this.keyframeRegex = /^@(\-(webkit|ms|moz|o)\-)?keyframes$/i;
this.scanner = scnr;
this.token = { type: _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF, offset: -1, len: 0, text: '' };
this.prevToken = undefined;
}
Parser.prototype.peekIdent = function (text) {
return _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase();
};
Parser.prototype.peekKeyword = function (text) {
return _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword === this.token.type && text.length === this.token.text.length && text === this.token.text.toLowerCase();
};
Parser.prototype.peekDelim = function (text) {
return _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Delim === this.token.type && text === this.token.text;
};
Parser.prototype.peek = function (type) {
return type === this.token.type;
};
Parser.prototype.peekOne = function (types) {
return types.indexOf(this.token.type) !== -1;
};
Parser.prototype.peekRegExp = function (type, regEx) {
if (type !== this.token.type) {
return false;
}
return regEx.test(this.token.text);
};
Parser.prototype.hasWhitespace = function () {
return !!this.prevToken && (this.prevToken.offset + this.prevToken.len !== this.token.offset);
};
Parser.prototype.consumeToken = function () {
this.prevToken = this.token;
this.token = this.scanner.scan();
};
Parser.prototype.mark = function () {
return {
prev: this.prevToken,
curr: this.token,
pos: this.scanner.pos()
};
};
Parser.prototype.restoreAtMark = function (mark) {
this.prevToken = mark.prev;
this.token = mark.curr;
this.scanner.goBackTo(mark.pos);
};
Parser.prototype.try = function (func) {
var pos = this.mark();
var node = func();
if (!node) {
this.restoreAtMark(pos);
return null;
}
return node;
};
Parser.prototype.acceptOneKeyword = function (keywords) {
if (_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword === this.token.type) {
for (var _i = 0, keywords_1 = keywords; _i < keywords_1.length; _i++) {
var keyword = keywords_1[_i];
if (keyword.length === this.token.text.length && keyword === this.token.text.toLowerCase()) {
this.consumeToken();
return true;
}
}
}
return false;
};
Parser.prototype.accept = function (type) {
if (type === this.token.type) {
this.consumeToken();
return true;
}
return false;
};
Parser.prototype.acceptIdent = function (text) {
if (this.peekIdent(text)) {
this.consumeToken();
return true;
}
return false;
};
Parser.prototype.acceptKeyword = function (text) {
if (this.peekKeyword(text)) {
this.consumeToken();
return true;
}
return false;
};
Parser.prototype.acceptDelim = function (text) {
if (this.peekDelim(text)) {
this.consumeToken();
return true;
}
return false;
};
Parser.prototype.acceptRegexp = function (regEx) {
if (regEx.test(this.token.text)) {
this.consumeToken();
return true;
}
return false;
};
Parser.prototype._parseRegexp = function (regEx) {
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Identifier);
do { } while (this.acceptRegexp(regEx));
return this.finish(node);
};
Parser.prototype.acceptUnquotedString = function () {
var pos = this.scanner.pos();
this.scanner.goBackTo(this.token.offset);
var unquoted = this.scanner.scanUnquotedString();
if (unquoted) {
this.token = unquoted;
this.consumeToken();
return true;
}
this.scanner.goBackTo(pos);
return false;
};
Parser.prototype.resync = function (resyncTokens, resyncStopTokens) {
while (true) {
if (resyncTokens && resyncTokens.indexOf(this.token.type) !== -1) {
this.consumeToken();
return true;
}
else if (resyncStopTokens && resyncStopTokens.indexOf(this.token.type) !== -1) {
return true;
}
else {
if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF) {
return false;
}
this.token = this.scanner.scan();
}
}
};
Parser.prototype.createNode = function (nodeType) {
return new _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node(this.token.offset, this.token.len, nodeType);
};
Parser.prototype.create = function (ctor) {
return new ctor(this.token.offset, this.token.len);
};
Parser.prototype.finish = function (node, error, resyncTokens, resyncStopTokens) {
// parseNumeric misuses error for boolean flagging (however the real error mustn't be a false)
// + nodelist offsets mustn't be modified, because there is a offset hack in rulesets for smartselection
if (!(node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Nodelist)) {
if (error) {
this.markError(node, error, resyncTokens, resyncStopTokens);
}
// set the node end position
if (this.prevToken) {
// length with more elements belonging together
var prevEnd = this.prevToken.offset + this.prevToken.len;
node.length = prevEnd > node.offset ? prevEnd - node.offset : 0; // offset is taken from current token, end from previous: Use 0 for empty nodes
}
}
return node;
};
Parser.prototype.markError = function (node, error, resyncTokens, resyncStopTokens) {
if (this.token !== this.lastErrorToken) { // do not report twice on the same token
node.addIssue(new _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Marker(node, error, _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Level.Error, undefined, this.token.offset, this.token.len));
this.lastErrorToken = this.token;
}
if (resyncTokens || resyncStopTokens) {
this.resync(resyncTokens, resyncStopTokens);
}
};
Parser.prototype.parseStylesheet = function (textDocument) {
var versionId = textDocument.version;
var text = textDocument.getText();
var textProvider = function (offset, length) {
if (textDocument.version !== versionId) {
throw new Error('Underlying model has changed, AST is no longer valid');
}
return text.substr(offset, length);
};
return this.internalParse(text, this._parseStylesheet, textProvider);
};
Parser.prototype.internalParse = function (input, parseFunc, textProvider) {
this.scanner.setSource(input);
this.token = this.scanner.scan();
var node = parseFunc.bind(this)();
if (node) {
if (textProvider) {
node.textProvider = textProvider;
}
else {
node.textProvider = function (offset, length) { return input.substr(offset, length); };
}
}
return node;
};
Parser.prototype._parseStylesheet = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Stylesheet);
while (node.addChild(this._parseStylesheetStart())) {
// Parse statements only valid at the beginning of stylesheets.
}
var inRecovery = false;
do {
var hasMatch = false;
do {
hasMatch = false;
var statement = this._parseStylesheetStatement();
if (statement) {
node.addChild(statement);
hasMatch = true;
inRecovery = false;
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF) && this._needsSemicolonAfter(statement) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SemiColonExpected);
}
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon) || this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CDO) || this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CDC)) {
// accept empty statements
hasMatch = true;
inRecovery = false;
}
} while (hasMatch);
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF)) {
break;
}
if (!inRecovery) {
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.UnknownAtRule);
}
else {
this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RuleOrSelectorExpected);
}
inRecovery = true;
}
this.consumeToken();
} while (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF));
return this.finish(node);
};
Parser.prototype._parseStylesheetStart = function () {
return this._parseCharset();
};
Parser.prototype._parseStylesheetStatement = function (isNested) {
if (isNested === void 0) { isNested = false; }
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
return this._parseStylesheetAtStatement(isNested);
}
return this._parseRuleset(isNested);
};
Parser.prototype._parseStylesheetAtStatement = function (isNested) {
if (isNested === void 0) { isNested = false; }
return this._parseImport()
|| this._parseMedia(isNested)
|| this._parsePage()
|| this._parseFontFace()
|| this._parseKeyframe()
|| this._parseSupports(isNested)
|| this._parseViewPort()
|| this._parseNamespace()
|| this._parseDocument()
|| this._parseUnknownAtRule();
};
Parser.prototype._tryParseRuleset = function (isNested) {
var mark = this.mark();
if (this._parseSelector(isNested)) {
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma) && this._parseSelector(isNested)) {
// loop
}
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL)) {
this.restoreAtMark(mark);
return this._parseRuleset(isNested);
}
}
this.restoreAtMark(mark);
return null;
};
Parser.prototype._parseRuleset = function (isNested) {
if (isNested === void 0) { isNested = false; }
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.RuleSet);
var selectors = node.getSelectors();
if (!selectors.addChild(this._parseSelector(isNested))) {
return null;
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (!selectors.addChild(this._parseSelector(isNested))) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SelectorExpected);
}
}
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._parseRuleSetDeclarationAtStatement = function () {
return this._parseAtApply()
|| this._parseUnknownAtRule();
};
Parser.prototype._parseRuleSetDeclaration = function () {
// https://www.w3.org/TR/css-syntax-3/#consume-a-list-of-declarations0
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
return this._parseRuleSetDeclarationAtStatement();
}
return this._parseDeclaration();
};
/**
* Parses declarations like:
* @apply --my-theme;
*
* Follows https://tabatkins.github.io/specs/css-apply-rule/#using
*/
Parser.prototype._parseAtApply = function () {
if (!this.peekKeyword('@apply')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.AtApplyRule);
this.consumeToken();
if (!node.setIdentifier(this._parseIdent([_cssNodes__WEBPACK_IMPORTED_MODULE_1__.ReferenceType.Variable]))) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
return this.finish(node);
};
Parser.prototype._needsSemicolonAfter = function (node) {
switch (node.type) {
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Keyframe:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ViewPort:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Media:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Ruleset:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Namespace:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.If:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.For:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Each:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.While:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.MixinDeclaration:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.FunctionDeclaration:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.MixinContentDeclaration:
return false;
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ExtendsReference:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.MixinContentReference:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ReturnStatement:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.MediaQuery:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Debug:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Import:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.AtApplyRule:
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.CustomPropertyDeclaration:
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.VariableDeclaration:
return node.needsSemicolon;
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.MixinReference:
return !node.getContent();
case _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Declaration:
return !node.getNestedProperties();
}
return false;
};
Parser.prototype._parseDeclarations = function (parseDeclaration) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Declarations);
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL)) {
return null;
}
var decl = parseDeclaration();
while (node.addChild(decl)) {
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR)) {
break;
}
if (this._needsSemicolonAfter(decl) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SemiColonExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon, _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR]);
}
// We accepted semicolon token. Link it to declaration.
if (decl && this.prevToken && this.prevToken.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon) {
decl.semicolonPosition = this.prevToken.offset;
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
// accept empty statements
}
decl = parseDeclaration();
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightCurlyExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR, _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]);
}
return this.finish(node);
};
Parser.prototype._parseBody = function (node, parseDeclaration) {
if (!node.setDeclarations(this._parseDeclarations(parseDeclaration))) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftCurlyExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR, _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]);
}
return this.finish(node);
};
Parser.prototype._parseSelector = function (isNested) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Selector);
var hasContent = false;
if (isNested) {
// nested selectors can start with a combinator
hasContent = node.addChild(this._parseCombinator());
}
while (node.addChild(this._parseSimpleSelector())) {
hasContent = true;
node.addChild(this._parseCombinator()); // optional
}
return hasContent ? this.finish(node) : null;
};
Parser.prototype._parseDeclaration = function (stopTokens) {
var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens);
if (custonProperty) {
return custonProperty;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Declaration);
if (!node.setProperty(this._parseProperty())) {
return null;
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ColonExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon], stopTokens || [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]);
}
if (this.prevToken) {
node.colonPosition = this.prevToken.offset;
}
if (!node.setValue(this._parseExpr())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.PropertyValueExpected);
}
node.addChild(this._parsePrio());
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist
}
return this.finish(node);
};
Parser.prototype._tryParseCustomPropertyDeclaration = function (stopTokens) {
if (!this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^--/)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.CustomPropertyDeclaration);
if (!node.setProperty(this._parseProperty())) {
return null;
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ColonExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon]);
}
if (this.prevToken) {
node.colonPosition = this.prevToken.offset;
}
var mark = this.mark();
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL)) {
// try to parse it as nested declaration
var propertySet = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.CustomPropertySet);
var declarations = this._parseDeclarations(this._parseRuleSetDeclaration.bind(this));
if (propertySet.setDeclarations(declarations) && !declarations.isErroneous(true)) {
propertySet.addChild(this._parsePrio());
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
this.finish(propertySet);
node.setPropertySet(propertySet);
node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist
return this.finish(node);
}
}
this.restoreAtMark(mark);
}
// try tp parse as expression
var expression = this._parseExpr();
if (expression && !expression.isErroneous(true)) {
this._parsePrio();
if (this.peekOne(stopTokens || [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon])) {
node.setValue(expression);
node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist
return this.finish(node);
}
}
this.restoreAtMark(mark);
node.addChild(this._parseCustomPropertyValue(stopTokens));
node.addChild(this._parsePrio());
if ((0,_utils_objects__WEBPACK_IMPORTED_MODULE_4__.isDefined)(node.colonPosition) && this.token.offset === node.colonPosition + 1) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.PropertyValueExpected);
}
return this.finish(node);
};
/**
* Parse custom property values.
*
* Based on https://www.w3.org/TR/css-variables/#syntax
*
* This code is somewhat unusual, as the allowed syntax is incredibly broad,
* parsing almost any sequence of tokens, save for a small set of exceptions.
* Unbalanced delimitors, invalid tokens, and declaration
* terminators like semicolons and !important directives (when not inside
* of delimitors).
*/
Parser.prototype._parseCustomPropertyValue = function (stopTokens) {
var _this = this;
if (stopTokens === void 0) { stopTokens = [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR]; }
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; };
var onStopToken = function () { return stopTokens.indexOf(_this.token.type) !== -1; };
var curlyDepth = 0;
var parensDepth = 0;
var bracketsDepth = 0;
done: while (true) {
switch (this.token.type) {
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon:
// A semicolon only ends things if we're not inside a delimitor.
if (isTopLevel()) {
break done;
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Exclamation:
// An exclamation ends the value if we're not inside delims.
if (isTopLevel()) {
break done;
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL:
curlyDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR:
curlyDepth--;
if (curlyDepth < 0) {
// The property value has been terminated without a semicolon, and
// this is the last declaration in the ruleset.
if (onStopToken() && parensDepth === 0 && bracketsDepth === 0) {
break done;
}
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftCurlyExpected);
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL:
parensDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR:
parensDepth--;
if (parensDepth < 0) {
if (onStopToken() && bracketsDepth === 0 && curlyDepth === 0) {
break done;
}
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected);
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL:
bracketsDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR:
bracketsDepth--;
if (bracketsDepth < 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftSquareBracketExpected);
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BadString: // fall through
break done;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF:
// We shouldn't have reached the end of input, something is
// unterminated.
var error = _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightCurlyExpected;
if (bracketsDepth > 0) {
error = _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected;
}
else if (parensDepth > 0) {
error = _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected;
}
return this.finish(node, error);
}
this.consumeToken();
}
return this.finish(node);
};
Parser.prototype._tryToParseDeclaration = function (stopTokens) {
var mark = this.mark();
if (this._parseProperty() && this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
// looks like a declaration, go ahead
this.restoreAtMark(mark);
return this._parseDeclaration(stopTokens);
}
this.restoreAtMark(mark);
return null;
};
Parser.prototype._parseProperty = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Property);
var mark = this.mark();
if (this.acceptDelim('*') || this.acceptDelim('_')) {
// support for IE 5.x, 6 and 7 star hack: see http://en.wikipedia.org/wiki/CSS_filter#Star_hack
if (this.hasWhitespace()) {
this.restoreAtMark(mark);
return null;
}
}
if (node.setIdentifier(this._parsePropertyIdentifier())) {
return this.finish(node);
}
return null;
};
Parser.prototype._parsePropertyIdentifier = function () {
return this._parseIdent();
};
Parser.prototype._parseCharset = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Charset)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken(); // charset
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.String)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SemiColonExpected);
}
return this.finish(node);
};
Parser.prototype._parseImport = function () {
if (!this.peekKeyword('@import')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Import);
this.consumeToken(); // @import
if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.URIOrStringExpected);
}
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF)) {
node.setMedialist(this._parseMediaQueryList());
}
return this.finish(node);
};
Parser.prototype._parseNamespace = function () {
// http://www.w3.org/TR/css3-namespace/
// namespace : NAMESPACE_SYM S* [IDENT S*]? [STRING|URI] S* ';' S*
if (!this.peekKeyword('@namespace')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Namespace);
this.consumeToken(); // @namespace
if (!node.addChild(this._parseURILiteral())) { // url literal also starts with ident
node.addChild(this._parseIdent()); // optional prefix
if (!node.addChild(this._parseURILiteral()) && !node.addChild(this._parseStringLiteral())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.URIExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]);
}
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SemiColonExpected);
}
return this.finish(node);
};
Parser.prototype._parseFontFace = function () {
if (!this.peekKeyword('@font-face')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.FontFace);
this.consumeToken(); // @font-face
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._parseViewPort = function () {
if (!this.peekKeyword('@-ms-viewport') &&
!this.peekKeyword('@-o-viewport') &&
!this.peekKeyword('@viewport')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.ViewPort);
this.consumeToken(); // @-ms-viewport
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._parseKeyframe = function () {
if (!this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword, this.keyframeRegex)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Keyframe);
var atNode = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken(); // atkeyword
node.setKeyword(this.finish(atNode));
if (atNode.matches('@-ms-keyframes')) { // -ms-keyframes never existed
this.markError(atNode, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.UnknownKeyword);
}
if (!node.setIdentifier(this._parseKeyframeIdent())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR]);
}
return this._parseBody(node, this._parseKeyframeSelector.bind(this));
};
Parser.prototype._parseKeyframeIdent = function () {
return this._parseIdent([_cssNodes__WEBPACK_IMPORTED_MODULE_1__.ReferenceType.Keyframe]);
};
Parser.prototype._parseKeyframeSelector = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.KeyframeSelector);
if (!node.addChild(this._parseIdent()) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage)) {
return null;
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (!node.addChild(this._parseIdent()) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.PercentageExpected);
}
}
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._tryParseKeyframeSelector = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.KeyframeSelector);
var pos = this.mark();
if (!node.addChild(this._parseIdent()) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage)) {
return null;
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (!node.addChild(this._parseIdent()) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage)) {
this.restoreAtMark(pos);
return null;
}
}
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL)) {
this.restoreAtMark(pos);
return null;
}
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._parseSupports = function (isNested) {
if (isNested === void 0) { isNested = false; }
// SUPPORTS_SYM S* supports_condition '{' S* ruleset* '}' S*
if (!this.peekKeyword('@supports')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Supports);
this.consumeToken(); // @supports
node.addChild(this._parseSupportsCondition());
return this._parseBody(node, this._parseSupportsDeclaration.bind(this, isNested));
};
Parser.prototype._parseSupportsDeclaration = function (isNested) {
if (isNested === void 0) { isNested = false; }
if (isNested) {
// if nested, the body can contain rulesets, but also declarations
return this._tryParseRuleset(true)
|| this._tryToParseDeclaration()
|| this._parseStylesheetStatement(true);
}
return this._parseStylesheetStatement(false);
};
Parser.prototype._parseSupportsCondition = function () {
// supports_condition : supports_negation | supports_conjunction | supports_disjunction | supports_condition_in_parens ;
// supports_condition_in_parens: ( '(' S* supports_condition S* ')' ) | supports_declaration_condition | general_enclosed ;
// supports_negation: NOT S+ supports_condition_in_parens ;
// supports_conjunction: supports_condition_in_parens ( S+ AND S+ supports_condition_in_parens )+;
// supports_disjunction: supports_condition_in_parens ( S+ OR S+ supports_condition_in_parens )+;
// supports_declaration_condition: '(' S* declaration ')';
// general_enclosed: ( FUNCTION | '(' ) ( any | unused )* ')' ;
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.SupportsCondition);
if (this.acceptIdent('not')) {
node.addChild(this._parseSupportsConditionInParens());
}
else {
node.addChild(this._parseSupportsConditionInParens());
if (this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^(and|or)$/i)) {
var text = this.token.text.toLowerCase();
while (this.acceptIdent(text)) {
node.addChild(this._parseSupportsConditionInParens());
}
}
}
return this.finish(node);
};
Parser.prototype._parseSupportsConditionInParens = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.SupportsCondition);
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
if (this.prevToken) {
node.lParent = this.prevToken.offset;
}
if (!node.addChild(this._tryToParseDeclaration([_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR]))) {
if (!this._parseSupportsCondition()) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ConditionExpected);
}
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR], []);
}
if (this.prevToken) {
node.rParent = this.prevToken.offset;
}
return this.finish(node);
}
else if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) {
var pos = this.mark();
this.consumeToken();
if (!this.hasWhitespace() && this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
var openParentCount = 1;
while (this.token.type !== _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF && openParentCount !== 0) {
if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL) {
openParentCount++;
}
else if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR) {
openParentCount--;
}
this.consumeToken();
}
return this.finish(node);
}
else {
this.restoreAtMark(pos);
}
}
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected, [], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL]);
};
Parser.prototype._parseMediaDeclaration = function (isNested) {
if (isNested === void 0) { isNested = false; }
if (isNested) {
// if nested, the body can contain rulesets, but also declarations
return this._tryParseRuleset(true)
|| this._tryToParseDeclaration()
|| this._parseStylesheetStatement(true);
}
return this._parseStylesheetStatement(false);
};
Parser.prototype._parseMedia = function (isNested) {
if (isNested === void 0) { isNested = false; }
// MEDIA_SYM S* media_query_list '{' S* ruleset* '}' S*
// media_query_list : S* [media_query [ ',' S* media_query ]* ]?
if (!this.peekKeyword('@media')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Media);
this.consumeToken(); // @media
if (!node.addChild(this._parseMediaQueryList())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected);
}
return this._parseBody(node, this._parseMediaDeclaration.bind(this, isNested));
};
Parser.prototype._parseMediaQueryList = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Medialist);
if (!node.addChild(this._parseMediaQuery([_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]))) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected);
}
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (!node.addChild(this._parseMediaQuery([_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]))) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected);
}
}
return this.finish(node);
};
Parser.prototype._parseMediaQuery = function (resyncStopToken) {
// http://www.w3.org/TR/css3-mediaqueries/
// media_query : [ONLY | NOT]? S* IDENT S* [ AND S* expression ]* | expression [ AND S* expression ]*
// expression : '(' S* IDENT S* [ ':' S* expr ]? ')' S*
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.MediaQuery);
var parseExpression = true;
var hasContent = false;
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
if (this.acceptIdent('only') || this.acceptIdent('not')) {
// optional
}
if (!node.addChild(this._parseIdent())) {
return null;
}
hasContent = true;
parseExpression = this.acceptIdent('and');
}
while (parseExpression) {
// Allow short-circuting for other language constructs.
if (node.addChild(this._parseMediaContentStart())) {
parseExpression = this.acceptIdent('and');
continue;
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
if (hasContent) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected, [], resyncStopToken);
}
return null;
}
if (!node.addChild(this._parseMediaFeatureName())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected, [], resyncStopToken);
}
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
if (!node.addChild(this._parseExpr())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.TermExpected, [], resyncStopToken);
}
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected, [], resyncStopToken);
}
parseExpression = this.acceptIdent('and');
}
return this.finish(node);
};
Parser.prototype._parseMediaContentStart = function () {
return null;
};
Parser.prototype._parseMediaFeatureName = function () {
return this._parseIdent();
};
Parser.prototype._parseMedium = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
if (node.addChild(this._parseIdent())) {
return this.finish(node);
}
else {
return null;
}
};
Parser.prototype._parsePageDeclaration = function () {
return this._parsePageMarginBox() || this._parseRuleSetDeclaration();
};
Parser.prototype._parsePage = function () {
// http://www.w3.org/TR/css3-page/
// page_rule : PAGE_SYM S* page_selector_list '{' S* page_body '}' S*
// page_body : /* Can be empty */ declaration? [ ';' S* page_body ]? | page_margin_box page_body
if (!this.peekKeyword('@page')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Page);
this.consumeToken();
if (node.addChild(this._parsePageSelector())) {
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (!node.addChild(this._parsePageSelector())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
}
}
return this._parseBody(node, this._parsePageDeclaration.bind(this));
};
Parser.prototype._parsePageMarginBox = function () {
// page_margin_box : margin_sym S* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.PageBoxMarginBox);
if (!this.acceptOneKeyword(_languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__.pageBoxDirectives)) {
this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.UnknownAtRule, [], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]);
}
return this._parseBody(node, this._parseRuleSetDeclaration.bind(this));
};
Parser.prototype._parsePageSelector = function () {
// page_selector : pseudo_page+ | IDENT pseudo_page*
// pseudo_page : ':' [ "left" | "right" | "first" | "blank" ];
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
node.addChild(this._parseIdent()); // optional ident
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
if (!node.addChild(this._parseIdent())) { // optional ident
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
}
return this.finish(node);
};
Parser.prototype._parseDocument = function () {
// -moz-document is experimental but has been pushed to css4
if (!this.peekKeyword('@-moz-document')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Document);
this.consumeToken(); // @-moz-document
this.resync([], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]); // ignore all the rules
return this._parseBody(node, this._parseStylesheetStatement.bind(this));
};
// https://www.w3.org/TR/css-syntax-3/#consume-an-at-rule
Parser.prototype._parseUnknownAtRule = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.UnknownAtRule);
node.addChild(this._parseUnknownAtRuleName());
var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; };
var curlyLCount = 0;
var curlyDepth = 0;
var parensDepth = 0;
var bracketsDepth = 0;
done: while (true) {
switch (this.token.type) {
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon:
if (isTopLevel()) {
break done;
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF:
if (curlyDepth > 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightCurlyExpected);
}
else if (bracketsDepth > 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected);
}
else if (parensDepth > 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
else {
return this.finish(node);
}
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL:
curlyLCount++;
curlyDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR:
curlyDepth--;
// End of at-rule, consume CurlyR and return node
if (curlyLCount > 0 && curlyDepth === 0) {
this.consumeToken();
if (bracketsDepth > 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected);
}
else if (parensDepth > 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
break done;
}
if (curlyDepth < 0) {
// The property value has been terminated without a semicolon, and
// this is the last declaration in the ruleset.
if (parensDepth === 0 && bracketsDepth === 0) {
break done;
}
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftCurlyExpected);
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL:
parensDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR:
parensDepth--;
if (parensDepth < 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected);
}
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL:
bracketsDepth++;
break;
case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR:
bracketsDepth--;
if (bracketsDepth < 0) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftSquareBracketExpected);
}
break;
}
this.consumeToken();
}
return node;
};
Parser.prototype._parseUnknownAtRuleName = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) {
return this.finish(node);
}
return node;
};
Parser.prototype._parseOperator = function () {
// these are operators for binary expressions
if (this.peekDelim('/') ||
this.peekDelim('*') ||
this.peekDelim('+') ||
this.peekDelim('-') ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Dashmatch) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Includes) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SubstringOperator) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.PrefixOperator) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SuffixOperator) ||
this.peekDelim('=')) { // doesn't stick to the standard here
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Operator);
this.consumeToken();
return this.finish(node);
}
else {
return null;
}
};
Parser.prototype._parseUnaryOperator = function () {
if (!this.peekDelim('+') && !this.peekDelim('-')) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken();
return this.finish(node);
};
Parser.prototype._parseCombinator = function () {
if (this.peekDelim('>')) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken();
var mark = this.mark();
if (!this.hasWhitespace() && this.acceptDelim('>')) {
if (!this.hasWhitespace() && this.acceptDelim('>')) {
node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorShadowPiercingDescendant;
return this.finish(node);
}
this.restoreAtMark(mark);
}
node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorParent;
return this.finish(node);
}
else if (this.peekDelim('+')) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken();
node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorSibling;
return this.finish(node);
}
else if (this.peekDelim('~')) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken();
node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorAllSiblings;
return this.finish(node);
}
else if (this.peekDelim('/')) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken();
var mark = this.mark();
if (!this.hasWhitespace() && this.acceptIdent('deep') && !this.hasWhitespace() && this.acceptDelim('/')) {
node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorShadowPiercingDescendant;
return this.finish(node);
}
this.restoreAtMark(mark);
}
return null;
};
Parser.prototype._parseSimpleSelector = function () {
// simple_selector
// : element_name [ HASH | class | attrib | pseudo ]* | [ HASH | class | attrib | pseudo ]+ ;
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.SimpleSelector);
var c = 0;
if (node.addChild(this._parseElementName())) {
c++;
}
while ((c === 0 || !this.hasWhitespace()) && node.addChild(this._parseSimpleSelectorBody())) {
c++;
}
return c > 0 ? this.finish(node) : null;
};
Parser.prototype._parseSimpleSelectorBody = function () {
return this._parsePseudo() || this._parseHash() || this._parseClass() || this._parseAttrib();
};
Parser.prototype._parseSelectorIdent = function () {
return this._parseIdent();
};
Parser.prototype._parseHash = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Hash) && !this.peekDelim('#')) {
return null;
}
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.IdentifierSelector);
if (this.acceptDelim('#')) {
if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
}
else {
this.consumeToken(); // TokenType.Hash
}
return this.finish(node);
};
Parser.prototype._parseClass = function () {
// class: '.' IDENT ;
if (!this.peekDelim('.')) {
return null;
}
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ClassSelector);
this.consumeToken(); // '.'
if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
return this.finish(node);
};
Parser.prototype._parseElementName = function () {
// element_name: (ns? '|')? IDENT | '*';
var pos = this.mark();
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ElementNameSelector);
node.addChild(this._parseNamespacePrefix());
if (!node.addChild(this._parseSelectorIdent()) && !this.acceptDelim('*')) {
this.restoreAtMark(pos);
return null;
}
return this.finish(node);
};
Parser.prototype._parseNamespacePrefix = function () {
var pos = this.mark();
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.NamespacePrefix);
if (!node.addChild(this._parseIdent()) && !this.acceptDelim('*')) {
// ns is optional
}
if (!this.acceptDelim('|')) {
this.restoreAtMark(pos);
return null;
}
return this.finish(node);
};
Parser.prototype._parseAttrib = function () {
// attrib : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* [ IDENT | STRING ] S* ]? ']'
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.AttributeSelector);
this.consumeToken(); // BracketL
// Optional attrib namespace
node.setNamespacePrefix(this._parseNamespacePrefix());
if (!node.setIdentifier(this._parseIdent())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
if (node.setOperator(this._parseOperator())) {
node.setValue(this._parseBinaryExpr());
this.acceptIdent('i'); // case insensitive matching
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected);
}
return this.finish(node);
};
Parser.prototype._parsePseudo = function () {
var _this = this;
// pseudo: ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ]
var node = this._tryParsePseudoIdentifier();
if (node) {
if (!this.hasWhitespace() && this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
var tryAsSelector = function () {
var selectors = _this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
if (!selectors.addChild(_this._parseSelector(false))) {
return null;
}
while (_this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma) && selectors.addChild(_this._parseSelector(false))) {
// loop
}
if (_this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return _this.finish(selectors);
}
return null;
};
node.addChild(this.try(tryAsSelector) || this._parseBinaryExpr());
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
}
return this.finish(node);
}
return null;
};
Parser.prototype._tryParsePseudoIdentifier = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
return null;
}
var pos = this.mark();
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.PseudoSelector);
this.consumeToken(); // Colon
if (this.hasWhitespace()) {
this.restoreAtMark(pos);
return null;
}
// optional, support ::
this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon);
if (this.hasWhitespace() || !node.addChild(this._parseIdent())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected);
}
return this.finish(node);
};
Parser.prototype._tryParsePrio = function () {
var mark = this.mark();
var prio = this._parsePrio();
if (prio) {
return prio;
}
this.restoreAtMark(mark);
return null;
};
Parser.prototype._parsePrio = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Exclamation)) {
return null;
}
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Prio);
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Exclamation) && this.acceptIdent('important')) {
return this.finish(node);
}
return null;
};
Parser.prototype._parseExpr = function (stopOnComma) {
if (stopOnComma === void 0) { stopOnComma = false; }
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Expression);
if (!node.addChild(this._parseBinaryExpr())) {
return null;
}
while (true) {
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) { // optional
if (stopOnComma) {
return this.finish(node);
}
this.consumeToken();
}
if (!node.addChild(this._parseBinaryExpr())) {
break;
}
}
return this.finish(node);
};
Parser.prototype._parseNamedLine = function () {
// https://www.w3.org/TR/css-grid-1/#named-lines
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL)) {
return null;
}
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.GridLine);
this.consumeToken();
while (node.addChild(this._parseIdent())) {
// repeat
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected);
}
return this.finish(node);
};
Parser.prototype._parseBinaryExpr = function (preparsedLeft, preparsedOper) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.BinaryExpression);
if (!node.setLeft((preparsedLeft || this._parseTerm()))) {
return null;
}
if (!node.setOperator(preparsedOper || this._parseOperator())) {
return this.finish(node);
}
if (!node.setRight(this._parseTerm())) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.TermExpected);
}
// things needed for multiple binary expressions
node = this.finish(node);
var operator = this._parseOperator();
if (operator) {
node = this._parseBinaryExpr(node, operator);
}
return this.finish(node);
};
Parser.prototype._parseTerm = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Term);
node.setOperator(this._parseUnaryOperator()); // optional
if (node.setExpression(this._parseTermExpression())) {
return this.finish(node);
}
return null;
};
Parser.prototype._parseTermExpression = function () {
return this._parseURILiteral() || // url before function
this._parseFunction() || // function before ident
this._parseIdent() ||
this._parseStringLiteral() ||
this._parseNumeric() ||
this._parseHexColor() ||
this._parseOperation() ||
this._parseNamedLine();
};
Parser.prototype._parseOperation = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
this.consumeToken(); // ParenthesisL
node.addChild(this._parseExpr());
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
return this.finish(node);
};
Parser.prototype._parseNumeric = function () {
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Num) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Resolution) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Length) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EMS) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EXS) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Angle) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Time) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Dimension) ||
this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Freq)) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NumericValue);
this.consumeToken();
return this.finish(node);
}
return null;
};
Parser.prototype._parseStringLiteral = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.String) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BadString)) {
return null;
}
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.StringLiteral);
this.consumeToken();
return this.finish(node);
};
Parser.prototype._parseURILiteral = function () {
if (!this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^url(-prefix)?$/i)) {
return null;
}
var pos = this.mark();
var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.URILiteral);
this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident);
if (this.hasWhitespace() || !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
this.restoreAtMark(pos);
return null;
}
this.scanner.inURL = true;
this.consumeToken(); // consume ()
node.addChild(this._parseURLArgument()); // argument is optional
this.scanner.inURL = false;
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
return this.finish(node);
};
Parser.prototype._parseURLArgument = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node);
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.String) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BadString) && !this.acceptUnquotedString()) {
return null;
}
return this.finish(node);
};
Parser.prototype._parseIdent = function (referenceTypes) {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Identifier);
if (referenceTypes) {
node.referenceTypes = referenceTypes;
}
node.isCustomProperty = this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^--/);
this.consumeToken();
return this.finish(node);
};
Parser.prototype._parseFunction = function () {
var pos = this.mark();
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Function);
if (!node.setIdentifier(this._parseFunctionIdentifier())) {
return null;
}
if (this.hasWhitespace() || !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) {
this.restoreAtMark(pos);
return null;
}
if (node.getArguments().addChild(this._parseFunctionArgument())) {
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) {
if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
break;
}
if (!node.getArguments().addChild(this._parseFunctionArgument())) {
this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ExpressionExpected);
}
}
}
if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) {
return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected);
}
return this.finish(node);
};
Parser.prototype._parseFunctionIdentifier = function () {
if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) {
return null;
}
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Identifier);
node.referenceTypes = [_cssNodes__WEBPACK_IMPORTED_MODULE_1__.ReferenceType.Function];
if (this.acceptIdent('progid')) {
// support for IE7 specific filters: 'progid:DXImageTransform.Microsoft.MotionBlur(strength=13, direction=310)'
if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) {
while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident) && this.acceptDelim('.')) {
// loop
}
}
return this.finish(node);
}
this.consumeToken();
return this.finish(node);
};
Parser.prototype._parseFunctionArgument = function () {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.FunctionArgument);
if (node.setValue(this._parseExpr(true))) {
return this.finish(node);
}
return null;
};
Parser.prototype._parseHexColor = function () {
if (this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Hash, /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/g)) {
var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.HexColorValue);
this.consumeToken();
return this.finish(node);
}
else {
return null;
}
};
return Parser;
}());
/***/ }),
/* 73 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "TokenType": () => /* binding */ TokenType,
/* harmony export */ "MultiLineStream": () => /* binding */ MultiLineStream,
/* harmony export */ "Scanner": () => /* binding */ Scanner
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var TokenType;
(function (TokenType) {
TokenType[TokenType["Ident"] = 0] = "Ident";
TokenType[TokenType["AtKeyword"] = 1] = "AtKeyword";
TokenType[TokenType["String"] = 2] = "String";
TokenType[TokenType["BadString"] = 3] = "BadString";
TokenType[TokenType["UnquotedString"] = 4] = "UnquotedString";
TokenType[TokenType["Hash"] = 5] = "Hash";
TokenType[TokenType["Num"] = 6] = "Num";
TokenType[TokenType["Percentage"] = 7] = "Percentage";
TokenType[TokenType["Dimension"] = 8] = "Dimension";
TokenType[TokenType["UnicodeRange"] = 9] = "UnicodeRange";
TokenType[TokenType["CDO"] = 10] = "CDO";
TokenType[TokenType["CDC"] = 11] = "CDC";
TokenType[TokenType["Colon"] = 12] = "Colon";
TokenType[TokenType["SemiColon"] = 13] = "SemiColon";
TokenType[TokenType["CurlyL"] = 14] = "CurlyL";
TokenType[TokenType["CurlyR"] = 15] = "CurlyR";
TokenType[TokenType["ParenthesisL"] = 16] = "ParenthesisL";
TokenType[TokenType["ParenthesisR"] = 17] = "ParenthesisR";
TokenType[TokenType["BracketL"] = 18] = "BracketL";
TokenType[TokenType["BracketR"] = 19] = "BracketR";
TokenType[TokenType["Whitespace"] = 20] = "Whitespace";
TokenType[TokenType["Includes"] = 21] = "Includes";
TokenType[TokenType["Dashmatch"] = 22] = "Dashmatch";
TokenType[TokenType["SubstringOperator"] = 23] = "SubstringOperator";
TokenType[TokenType["PrefixOperator"] = 24] = "PrefixOperator";
TokenType[TokenType["SuffixOperator"] = 25] = "SuffixOperator";
TokenType[TokenType["Delim"] = 26] = "Delim";
TokenType[TokenType["EMS"] = 27] = "EMS";
TokenType[TokenType["EXS"] = 28] = "EXS";
TokenType[TokenType["Length"] = 29] = "Length";
TokenType[TokenType["Angle"] = 30] = "Angle";
TokenType[TokenType["Time"] = 31] = "Time";
TokenType[TokenType["Freq"] = 32] = "Freq";
TokenType[TokenType["Exclamation"] = 33] = "Exclamation";
TokenType[TokenType["Resolution"] = 34] = "Resolution";
TokenType[TokenType["Comma"] = 35] = "Comma";
TokenType[TokenType["Charset"] = 36] = "Charset";
TokenType[TokenType["EscapedJavaScript"] = 37] = "EscapedJavaScript";
TokenType[TokenType["BadEscapedJavaScript"] = 38] = "BadEscapedJavaScript";
TokenType[TokenType["Comment"] = 39] = "Comment";
TokenType[TokenType["SingleLineComment"] = 40] = "SingleLineComment";
TokenType[TokenType["EOF"] = 41] = "EOF";
TokenType[TokenType["CustomToken"] = 42] = "CustomToken";
})(TokenType || (TokenType = {}));
var MultiLineStream = /** @class */ (function () {
function MultiLineStream(source) {
this.source = source;
this.len = source.length;
this.position = 0;
}
MultiLineStream.prototype.substring = function (from, to) {
if (to === void 0) { to = this.position; }
return this.source.substring(from, to);
};
MultiLineStream.prototype.eos = function () {
return this.len <= this.position;
};
MultiLineStream.prototype.pos = function () {
return this.position;
};
MultiLineStream.prototype.goBackTo = function (pos) {
this.position = pos;
};
MultiLineStream.prototype.goBack = function (n) {
this.position -= n;
};
MultiLineStream.prototype.advance = function (n) {
this.position += n;
};
MultiLineStream.prototype.nextChar = function () {
return this.source.charCodeAt(this.position++) || 0;
};
MultiLineStream.prototype.peekChar = function (n) {
if (n === void 0) { n = 0; }
return this.source.charCodeAt(this.position + n) || 0;
};
MultiLineStream.prototype.lookbackChar = function (n) {
if (n === void 0) { n = 0; }
return this.source.charCodeAt(this.position - n) || 0;
};
MultiLineStream.prototype.advanceIfChar = function (ch) {
if (ch === this.source.charCodeAt(this.position)) {
this.position++;
return true;
}
return false;
};
MultiLineStream.prototype.advanceIfChars = function (ch) {
if (this.position + ch.length > this.source.length) {
return false;
}
var i = 0;
for (; i < ch.length; i++) {
if (this.source.charCodeAt(this.position + i) !== ch[i]) {
return false;
}
}
this.advance(i);
return true;
};
MultiLineStream.prototype.advanceWhileChar = function (condition) {
var posNow = this.position;
while (this.position < this.len && condition(this.source.charCodeAt(this.position))) {
this.position++;
}
return this.position - posNow;
};
return MultiLineStream;
}());
var _a = 'a'.charCodeAt(0);
var _f = 'f'.charCodeAt(0);
var _z = 'z'.charCodeAt(0);
var _A = 'A'.charCodeAt(0);
var _F = 'F'.charCodeAt(0);
var _Z = 'Z'.charCodeAt(0);
var _0 = '0'.charCodeAt(0);
var _9 = '9'.charCodeAt(0);
var _TLD = '~'.charCodeAt(0);
var _HAT = '^'.charCodeAt(0);
var _EQS = '='.charCodeAt(0);
var _PIP = '|'.charCodeAt(0);
var _MIN = '-'.charCodeAt(0);
var _USC = '_'.charCodeAt(0);
var _PRC = '%'.charCodeAt(0);
var _MUL = '*'.charCodeAt(0);
var _LPA = '('.charCodeAt(0);
var _RPA = ')'.charCodeAt(0);
var _LAN = '<'.charCodeAt(0);
var _RAN = '>'.charCodeAt(0);
var _ATS = '@'.charCodeAt(0);
var _HSH = '#'.charCodeAt(0);
var _DLR = '$'.charCodeAt(0);
var _BSL = '\\'.charCodeAt(0);
var _FSL = '/'.charCodeAt(0);
var _NWL = '\n'.charCodeAt(0);
var _CAR = '\r'.charCodeAt(0);
var _LFD = '\f'.charCodeAt(0);
var _DQO = '"'.charCodeAt(0);
var _SQO = '\''.charCodeAt(0);
var _WSP = ' '.charCodeAt(0);
var _TAB = '\t'.charCodeAt(0);
var _SEM = ';'.charCodeAt(0);
var _COL = ':'.charCodeAt(0);
var _CUL = '{'.charCodeAt(0);
var _CUR = '}'.charCodeAt(0);
var _BRL = '['.charCodeAt(0);
var _BRR = ']'.charCodeAt(0);
var _CMA = ','.charCodeAt(0);
var _DOT = '.'.charCodeAt(0);
var _BNG = '!'.charCodeAt(0);
var staticTokenTable = {};
staticTokenTable[_SEM] = TokenType.SemiColon;
staticTokenTable[_COL] = TokenType.Colon;
staticTokenTable[_CUL] = TokenType.CurlyL;
staticTokenTable[_CUR] = TokenType.CurlyR;
staticTokenTable[_BRR] = TokenType.BracketR;
staticTokenTable[_BRL] = TokenType.BracketL;
staticTokenTable[_LPA] = TokenType.ParenthesisL;
staticTokenTable[_RPA] = TokenType.ParenthesisR;
staticTokenTable[_CMA] = TokenType.Comma;
var staticUnitTable = {};
staticUnitTable['em'] = TokenType.EMS;
staticUnitTable['ex'] = TokenType.EXS;
staticUnitTable['px'] = TokenType.Length;
staticUnitTable['cm'] = TokenType.Length;
staticUnitTable['mm'] = TokenType.Length;
staticUnitTable['in'] = TokenType.Length;
staticUnitTable['pt'] = TokenType.Length;
staticUnitTable['pc'] = TokenType.Length;
staticUnitTable['deg'] = TokenType.Angle;
staticUnitTable['rad'] = TokenType.Angle;
staticUnitTable['grad'] = TokenType.Angle;
staticUnitTable['ms'] = TokenType.Time;
staticUnitTable['s'] = TokenType.Time;
staticUnitTable['hz'] = TokenType.Freq;
staticUnitTable['khz'] = TokenType.Freq;
staticUnitTable['%'] = TokenType.Percentage;
staticUnitTable['fr'] = TokenType.Percentage;
staticUnitTable['dpi'] = TokenType.Resolution;
staticUnitTable['dpcm'] = TokenType.Resolution;
var Scanner = /** @class */ (function () {
function Scanner() {
this.stream = new MultiLineStream('');
this.ignoreComment = true;
this.ignoreWhitespace = true;
this.inURL = false;
}
Scanner.prototype.setSource = function (input) {
this.stream = new MultiLineStream(input);
};
Scanner.prototype.finishToken = function (offset, type, text) {
return {
offset: offset,
len: this.stream.pos() - offset,
type: type,
text: text || this.stream.substring(offset)
};
};
Scanner.prototype.substring = function (offset, len) {
return this.stream.substring(offset, offset + len);
};
Scanner.prototype.pos = function () {
return this.stream.pos();
};
Scanner.prototype.goBackTo = function (pos) {
this.stream.goBackTo(pos);
};
Scanner.prototype.scanUnquotedString = function () {
var offset = this.stream.pos();
var content = [];
if (this._unquotedString(content)) {
return this.finishToken(offset, TokenType.UnquotedString, content.join(''));
}
return null;
};
Scanner.prototype.scan = function () {
// processes all whitespaces and comments
var triviaToken = this.trivia();
if (triviaToken !== null) {
return triviaToken;
}
var offset = this.stream.pos();
// End of file/input
if (this.stream.eos()) {
return this.finishToken(offset, TokenType.EOF);
}
return this.scanNext(offset);
};
Scanner.prototype.scanNext = function (offset) {
// CDO
if (this.stream.advanceIfChars([_MIN, _MIN, _RAN])) {
return this.finishToken(offset, TokenType.CDC);
}
var content = [];
if (this.ident(content)) {
return this.finishToken(offset, TokenType.Ident, content.join(''));
}
// at-keyword
if (this.stream.advanceIfChar(_ATS)) {
content = ['@'];
if (this._name(content)) {
var keywordText = content.join('');
if (keywordText === '@charset') {
return this.finishToken(offset, TokenType.Charset, keywordText);
}
return this.finishToken(offset, TokenType.AtKeyword, keywordText);
}
else {
return this.finishToken(offset, TokenType.Delim);
}
}
// hash
if (this.stream.advanceIfChar(_HSH)) {
content = ['#'];
if (this._name(content)) {
return this.finishToken(offset, TokenType.Hash, content.join(''));
}
else {
return this.finishToken(offset, TokenType.Delim);
}
}
// Important
if (this.stream.advanceIfChar(_BNG)) {
return this.finishToken(offset, TokenType.Exclamation);
}
// Numbers
if (this._number()) {
var pos = this.stream.pos();
content = [this.stream.substring(offset, pos)];
if (this.stream.advanceIfChar(_PRC)) {
// Percentage 43%
return this.finishToken(offset, TokenType.Percentage);
}
else if (this.ident(content)) {
var dim = this.stream.substring(pos).toLowerCase();
var tokenType_1 = staticUnitTable[dim];
if (typeof tokenType_1 !== 'undefined') {
// Known dimension 43px
return this.finishToken(offset, tokenType_1, content.join(''));
}
else {
// Unknown dimension 43ft
return this.finishToken(offset, TokenType.Dimension, content.join(''));
}
}
return this.finishToken(offset, TokenType.Num);
}
// String, BadString
content = [];
var tokenType = this._string(content);
if (tokenType !== null) {
return this.finishToken(offset, tokenType, content.join(''));
}
// single character tokens
tokenType = staticTokenTable[this.stream.peekChar()];
if (typeof tokenType !== 'undefined') {
this.stream.advance(1);
return this.finishToken(offset, tokenType);
}
// includes ~=
if (this.stream.peekChar(0) === _TLD && this.stream.peekChar(1) === _EQS) {
this.stream.advance(2);
return this.finishToken(offset, TokenType.Includes);
}
// DashMatch |=
if (this.stream.peekChar(0) === _PIP && this.stream.peekChar(1) === _EQS) {
this.stream.advance(2);
return this.finishToken(offset, TokenType.Dashmatch);
}
// Substring operator *=
if (this.stream.peekChar(0) === _MUL && this.stream.peekChar(1) === _EQS) {
this.stream.advance(2);
return this.finishToken(offset, TokenType.SubstringOperator);
}
// Substring operator ^=
if (this.stream.peekChar(0) === _HAT && this.stream.peekChar(1) === _EQS) {
this.stream.advance(2);
return this.finishToken(offset, TokenType.PrefixOperator);
}
// Substring operator $=
if (this.stream.peekChar(0) === _DLR && this.stream.peekChar(1) === _EQS) {
this.stream.advance(2);
return this.finishToken(offset, TokenType.SuffixOperator);
}
// Delim
this.stream.nextChar();
return this.finishToken(offset, TokenType.Delim);
};
Scanner.prototype.trivia = function () {
while (true) {
var offset = this.stream.pos();
if (this._whitespace()) {
if (!this.ignoreWhitespace) {
return this.finishToken(offset, TokenType.Whitespace);
}
}
else if (this.comment()) {
if (!this.ignoreComment) {
return this.finishToken(offset, TokenType.Comment);
}
}
else {
return null;
}
}
};
Scanner.prototype.comment = function () {
if (this.stream.advanceIfChars([_FSL, _MUL])) {
var success_1 = false, hot_1 = false;
this.stream.advanceWhileChar(function (ch) {
if (hot_1 && ch === _FSL) {
success_1 = true;
return false;
}
hot_1 = ch === _MUL;
return true;
});
if (success_1) {
this.stream.advance(1);
}
return true;
}
return false;
};
Scanner.prototype._number = function () {
var npeek = 0, ch;
if (this.stream.peekChar() === _DOT) {
npeek = 1;
}
ch = this.stream.peekChar(npeek);
if (ch >= _0 && ch <= _9) {
this.stream.advance(npeek + 1);
this.stream.advanceWhileChar(function (ch) {
return ch >= _0 && ch <= _9 || npeek === 0 && ch === _DOT;
});
return true;
}
return false;
};
Scanner.prototype._newline = function (result) {
var ch = this.stream.peekChar();
switch (ch) {
case _CAR:
case _LFD:
case _NWL:
this.stream.advance(1);
result.push(String.fromCharCode(ch));
if (ch === _CAR && this.stream.advanceIfChar(_NWL)) {
result.push('\n');
}
return true;
}
return false;
};
Scanner.prototype._escape = function (result, includeNewLines) {
var ch = this.stream.peekChar();
if (ch === _BSL) {
this.stream.advance(1);
ch = this.stream.peekChar();
var hexNumCount = 0;
while (hexNumCount < 6 && (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F)) {
this.stream.advance(1);
ch = this.stream.peekChar();
hexNumCount++;
}
if (hexNumCount > 0) {
try {
var hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16);
if (hexVal) {
result.push(String.fromCharCode(hexVal));
}
}
catch (e) {
// ignore
}
// optional whitespace or new line, not part of result text
if (ch === _WSP || ch === _TAB) {
this.stream.advance(1);
}
else {
this._newline([]);
}
return true;
}
if (ch !== _CAR && ch !== _LFD && ch !== _NWL) {
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
else if (includeNewLines) {
return this._newline(result);
}
}
return false;
};
Scanner.prototype._stringChar = function (closeQuote, result) {
// not closeQuote, not backslash, not newline
var ch = this.stream.peekChar();
if (ch !== 0 && ch !== closeQuote && ch !== _BSL && ch !== _CAR && ch !== _LFD && ch !== _NWL) {
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
return false;
};
Scanner.prototype._string = function (result) {
if (this.stream.peekChar() === _SQO || this.stream.peekChar() === _DQO) {
var closeQuote = this.stream.nextChar();
result.push(String.fromCharCode(closeQuote));
while (this._stringChar(closeQuote, result) || this._escape(result, true)) {
// loop
}
if (this.stream.peekChar() === closeQuote) {
this.stream.nextChar();
result.push(String.fromCharCode(closeQuote));
return TokenType.String;
}
else {
return TokenType.BadString;
}
}
return null;
};
Scanner.prototype._unquotedChar = function (result) {
// not closeQuote, not backslash, not newline
var ch = this.stream.peekChar();
if (ch !== 0 && ch !== _BSL && ch !== _SQO && ch !== _DQO && ch !== _LPA && ch !== _RPA && ch !== _WSP && ch !== _TAB && ch !== _NWL && ch !== _LFD && ch !== _CAR) {
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
return false;
};
Scanner.prototype._unquotedString = function (result) {
var hasContent = false;
while (this._unquotedChar(result) || this._escape(result)) {
hasContent = true;
}
return hasContent;
};
Scanner.prototype._whitespace = function () {
var n = this.stream.advanceWhileChar(function (ch) {
return ch === _WSP || ch === _TAB || ch === _NWL || ch === _LFD || ch === _CAR;
});
return n > 0;
};
Scanner.prototype._name = function (result) {
var matched = false;
while (this._identChar(result) || this._escape(result)) {
matched = true;
}
return matched;
};
Scanner.prototype.ident = function (result) {
var pos = this.stream.pos();
var hasMinus = this._minus(result);
if (hasMinus && this._minus(result) /* -- */) {
if (this._identFirstChar(result) || this._escape(result)) {
while (this._identChar(result) || this._escape(result)) {
// loop
}
return true;
}
}
else if (this._identFirstChar(result) || this._escape(result)) {
while (this._identChar(result) || this._escape(result)) {
// loop
}
return true;
}
this.stream.goBackTo(pos);
return false;
};
Scanner.prototype._identFirstChar = function (result) {
var ch = this.stream.peekChar();
if (ch === _USC || // _
ch >= _a && ch <= _z || // a-z
ch >= _A && ch <= _Z || // A-Z
ch >= 0x80 && ch <= 0xFFFF) { // nonascii
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
return false;
};
Scanner.prototype._minus = function (result) {
var ch = this.stream.peekChar();
if (ch === _MIN) {
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
return false;
};
Scanner.prototype._identChar = function (result) {
var ch = this.stream.peekChar();
if (ch === _USC || // _
ch === _MIN || // -
ch >= _a && ch <= _z || // a-z
ch >= _A && ch <= _Z || // A-Z
ch >= _0 && ch <= _9 || // 0/9
ch >= 0x80 && ch <= 0xFFFF) { // nonascii
this.stream.advance(1);
result.push(String.fromCharCode(ch));
return true;
}
return false;
};
return Scanner;
}());
/***/ }),
/* 74 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "NodeType": () => /* binding */ NodeType,
/* harmony export */ "ReferenceType": () => /* binding */ ReferenceType,
/* harmony export */ "getNodeAtOffset": () => /* binding */ getNodeAtOffset,
/* harmony export */ "getNodePath": () => /* binding */ getNodePath,
/* harmony export */ "getParentDeclaration": () => /* binding */ getParentDeclaration,
/* harmony export */ "Node": () => /* binding */ Node,
/* harmony export */ "Nodelist": () => /* binding */ Nodelist,
/* harmony export */ "Identifier": () => /* binding */ Identifier,
/* harmony export */ "Stylesheet": () => /* binding */ Stylesheet,
/* harmony export */ "Declarations": () => /* binding */ Declarations,
/* harmony export */ "BodyDeclaration": () => /* binding */ BodyDeclaration,
/* harmony export */ "RuleSet": () => /* binding */ RuleSet,
/* harmony export */ "Selector": () => /* binding */ Selector,
/* harmony export */ "SimpleSelector": () => /* binding */ SimpleSelector,
/* harmony export */ "AtApplyRule": () => /* binding */ AtApplyRule,
/* harmony export */ "AbstractDeclaration": () => /* binding */ AbstractDeclaration,
/* harmony export */ "CustomPropertySet": () => /* binding */ CustomPropertySet,
/* harmony export */ "Declaration": () => /* binding */ Declaration,
/* harmony export */ "CustomPropertyDeclaration": () => /* binding */ CustomPropertyDeclaration,
/* harmony export */ "Property": () => /* binding */ Property,
/* harmony export */ "Invocation": () => /* binding */ Invocation,
/* harmony export */ "Function": () => /* binding */ Function,
/* harmony export */ "FunctionParameter": () => /* binding */ FunctionParameter,
/* harmony export */ "FunctionArgument": () => /* binding */ FunctionArgument,
/* harmony export */ "IfStatement": () => /* binding */ IfStatement,
/* harmony export */ "ForStatement": () => /* binding */ ForStatement,
/* harmony export */ "EachStatement": () => /* binding */ EachStatement,
/* harmony export */ "WhileStatement": () => /* binding */ WhileStatement,
/* harmony export */ "ElseStatement": () => /* binding */ ElseStatement,
/* harmony export */ "FunctionDeclaration": () => /* binding */ FunctionDeclaration,
/* harmony export */ "ViewPort": () => /* binding */ ViewPort,
/* harmony export */ "FontFace": () => /* binding */ FontFace,
/* harmony export */ "NestedProperties": () => /* binding */ NestedProperties,
/* harmony export */ "Keyframe": () => /* binding */ Keyframe,
/* harmony export */ "KeyframeSelector": () => /* binding */ KeyframeSelector,
/* harmony export */ "Import": () => /* binding */ Import,
/* harmony export */ "Use": () => /* binding */ Use,
/* harmony export */ "ModuleConfiguration": () => /* binding */ ModuleConfiguration,
/* harmony export */ "Forward": () => /* binding */ Forward,
/* harmony export */ "ForwardVisibility": () => /* binding */ ForwardVisibility,
/* harmony export */ "Namespace": () => /* binding */ Namespace,
/* harmony export */ "Media": () => /* binding */ Media,
/* harmony export */ "Supports": () => /* binding */ Supports,
/* harmony export */ "Document": () => /* binding */ Document,
/* harmony export */ "Medialist": () => /* binding */ Medialist,
/* harmony export */ "MediaQuery": () => /* binding */ MediaQuery,
/* harmony export */ "SupportsCondition": () => /* binding */ SupportsCondition,
/* harmony export */ "Page": () => /* binding */ Page,
/* harmony export */ "PageBoxMarginBox": () => /* binding */ PageBoxMarginBox,
/* harmony export */ "Expression": () => /* binding */ Expression,
/* harmony export */ "BinaryExpression": () => /* binding */ BinaryExpression,
/* harmony export */ "Term": () => /* binding */ Term,
/* harmony export */ "AttributeSelector": () => /* binding */ AttributeSelector,
/* harmony export */ "Operator": () => /* binding */ Operator,
/* harmony export */ "HexColorValue": () => /* binding */ HexColorValue,
/* harmony export */ "NumericValue": () => /* binding */ NumericValue,
/* harmony export */ "VariableDeclaration": () => /* binding */ VariableDeclaration,
/* harmony export */ "Interpolation": () => /* binding */ Interpolation,
/* harmony export */ "Variable": () => /* binding */ Variable,
/* harmony export */ "ExtendsReference": () => /* binding */ ExtendsReference,
/* harmony export */ "MixinContentReference": () => /* binding */ MixinContentReference,
/* harmony export */ "MixinContentDeclaration": () => /* binding */ MixinContentDeclaration,
/* harmony export */ "MixinReference": () => /* binding */ MixinReference,
/* harmony export */ "MixinDeclaration": () => /* binding */ MixinDeclaration,
/* harmony export */ "UnknownAtRule": () => /* binding */ UnknownAtRule,
/* harmony export */ "ListEntry": () => /* binding */ ListEntry,
/* harmony export */ "LessGuard": () => /* binding */ LessGuard,
/* harmony export */ "GuardCondition": () => /* binding */ GuardCondition,
/* harmony export */ "Module": () => /* binding */ Module,
/* harmony export */ "Level": () => /* binding */ Level,
/* harmony export */ "Marker": () => /* binding */ Marker,
/* harmony export */ "ParseErrorCollector": () => /* binding */ ParseErrorCollector
/* harmony export */ });
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(75);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
///
/// Nodes for the css 2.1 specification. See for reference:
/// http://www.w3.org/TR/CSS21/grammar.html#grammar
///
var NodeType;
(function (NodeType) {
NodeType[NodeType["Undefined"] = 0] = "Undefined";
NodeType[NodeType["Identifier"] = 1] = "Identifier";
NodeType[NodeType["Stylesheet"] = 2] = "Stylesheet";
NodeType[NodeType["Ruleset"] = 3] = "Ruleset";
NodeType[NodeType["Selector"] = 4] = "Selector";
NodeType[NodeType["SimpleSelector"] = 5] = "SimpleSelector";
NodeType[NodeType["SelectorInterpolation"] = 6] = "SelectorInterpolation";
NodeType[NodeType["SelectorCombinator"] = 7] = "SelectorCombinator";
NodeType[NodeType["SelectorCombinatorParent"] = 8] = "SelectorCombinatorParent";
NodeType[NodeType["SelectorCombinatorSibling"] = 9] = "SelectorCombinatorSibling";
NodeType[NodeType["SelectorCombinatorAllSiblings"] = 10] = "SelectorCombinatorAllSiblings";
NodeType[NodeType["SelectorCombinatorShadowPiercingDescendant"] = 11] = "SelectorCombinatorShadowPiercingDescendant";
NodeType[NodeType["Page"] = 12] = "Page";
NodeType[NodeType["PageBoxMarginBox"] = 13] = "PageBoxMarginBox";
NodeType[NodeType["ClassSelector"] = 14] = "ClassSelector";
NodeType[NodeType["IdentifierSelector"] = 15] = "IdentifierSelector";
NodeType[NodeType["ElementNameSelector"] = 16] = "ElementNameSelector";
NodeType[NodeType["PseudoSelector"] = 17] = "PseudoSelector";
NodeType[NodeType["AttributeSelector"] = 18] = "AttributeSelector";
NodeType[NodeType["Declaration"] = 19] = "Declaration";
NodeType[NodeType["Declarations"] = 20] = "Declarations";
NodeType[NodeType["Property"] = 21] = "Property";
NodeType[NodeType["Expression"] = 22] = "Expression";
NodeType[NodeType["BinaryExpression"] = 23] = "BinaryExpression";
NodeType[NodeType["Term"] = 24] = "Term";
NodeType[NodeType["Operator"] = 25] = "Operator";
NodeType[NodeType["Value"] = 26] = "Value";
NodeType[NodeType["StringLiteral"] = 27] = "StringLiteral";
NodeType[NodeType["URILiteral"] = 28] = "URILiteral";
NodeType[NodeType["EscapedValue"] = 29] = "EscapedValue";
NodeType[NodeType["Function"] = 30] = "Function";
NodeType[NodeType["NumericValue"] = 31] = "NumericValue";
NodeType[NodeType["HexColorValue"] = 32] = "HexColorValue";
NodeType[NodeType["MixinDeclaration"] = 33] = "MixinDeclaration";
NodeType[NodeType["MixinReference"] = 34] = "MixinReference";
NodeType[NodeType["VariableName"] = 35] = "VariableName";
NodeType[NodeType["VariableDeclaration"] = 36] = "VariableDeclaration";
NodeType[NodeType["Prio"] = 37] = "Prio";
NodeType[NodeType["Interpolation"] = 38] = "Interpolation";
NodeType[NodeType["NestedProperties"] = 39] = "NestedProperties";
NodeType[NodeType["ExtendsReference"] = 40] = "ExtendsReference";
NodeType[NodeType["SelectorPlaceholder"] = 41] = "SelectorPlaceholder";
NodeType[NodeType["Debug"] = 42] = "Debug";
NodeType[NodeType["If"] = 43] = "If";
NodeType[NodeType["Else"] = 44] = "Else";
NodeType[NodeType["For"] = 45] = "For";
NodeType[NodeType["Each"] = 46] = "Each";
NodeType[NodeType["While"] = 47] = "While";
NodeType[NodeType["MixinContentReference"] = 48] = "MixinContentReference";
NodeType[NodeType["MixinContentDeclaration"] = 49] = "MixinContentDeclaration";
NodeType[NodeType["Media"] = 50] = "Media";
NodeType[NodeType["Keyframe"] = 51] = "Keyframe";
NodeType[NodeType["FontFace"] = 52] = "FontFace";
NodeType[NodeType["Import"] = 53] = "Import";
NodeType[NodeType["Namespace"] = 54] = "Namespace";
NodeType[NodeType["Invocation"] = 55] = "Invocation";
NodeType[NodeType["FunctionDeclaration"] = 56] = "FunctionDeclaration";
NodeType[NodeType["ReturnStatement"] = 57] = "ReturnStatement";
NodeType[NodeType["MediaQuery"] = 58] = "MediaQuery";
NodeType[NodeType["FunctionParameter"] = 59] = "FunctionParameter";
NodeType[NodeType["FunctionArgument"] = 60] = "FunctionArgument";
NodeType[NodeType["KeyframeSelector"] = 61] = "KeyframeSelector";
NodeType[NodeType["ViewPort"] = 62] = "ViewPort";
NodeType[NodeType["Document"] = 63] = "Document";
NodeType[NodeType["AtApplyRule"] = 64] = "AtApplyRule";
NodeType[NodeType["CustomPropertyDeclaration"] = 65] = "CustomPropertyDeclaration";
NodeType[NodeType["CustomPropertySet"] = 66] = "CustomPropertySet";
NodeType[NodeType["ListEntry"] = 67] = "ListEntry";
NodeType[NodeType["Supports"] = 68] = "Supports";
NodeType[NodeType["SupportsCondition"] = 69] = "SupportsCondition";
NodeType[NodeType["NamespacePrefix"] = 70] = "NamespacePrefix";
NodeType[NodeType["GridLine"] = 71] = "GridLine";
NodeType[NodeType["Plugin"] = 72] = "Plugin";
NodeType[NodeType["UnknownAtRule"] = 73] = "UnknownAtRule";
NodeType[NodeType["Use"] = 74] = "Use";
NodeType[NodeType["ModuleConfiguration"] = 75] = "ModuleConfiguration";
NodeType[NodeType["Forward"] = 76] = "Forward";
NodeType[NodeType["ForwardVisibility"] = 77] = "ForwardVisibility";
NodeType[NodeType["Module"] = 78] = "Module";
})(NodeType || (NodeType = {}));
var ReferenceType;
(function (ReferenceType) {
ReferenceType[ReferenceType["Mixin"] = 0] = "Mixin";
ReferenceType[ReferenceType["Rule"] = 1] = "Rule";
ReferenceType[ReferenceType["Variable"] = 2] = "Variable";
ReferenceType[ReferenceType["Function"] = 3] = "Function";
ReferenceType[ReferenceType["Keyframe"] = 4] = "Keyframe";
ReferenceType[ReferenceType["Unknown"] = 5] = "Unknown";
ReferenceType[ReferenceType["Module"] = 6] = "Module";
ReferenceType[ReferenceType["Forward"] = 7] = "Forward";
ReferenceType[ReferenceType["ForwardVisibility"] = 8] = "ForwardVisibility";
})(ReferenceType || (ReferenceType = {}));
function getNodeAtOffset(node, offset) {
var candidate = null;
if (!node || offset < node.offset || offset > node.end) {
return null;
}
// Find the shortest node at the position
node.accept(function (node) {
if (node.offset === -1 && node.length === -1) {
return true;
}
if (node.offset <= offset && node.end >= offset) {
if (!candidate) {
candidate = node;
}
else if (node.length <= candidate.length) {
candidate = node;
}
return true;
}
return false;
});
return candidate;
}
function getNodePath(node, offset) {
var candidate = getNodeAtOffset(node, offset);
var path = [];
while (candidate) {
path.unshift(candidate);
candidate = candidate.parent;
}
return path;
}
function getParentDeclaration(node) {
var decl = node.findParent(NodeType.Declaration);
var value = decl && decl.getValue();
if (value && value.encloses(node)) {
return decl;
}
return null;
}
var Node = /** @class */ (function () {
function Node(offset, len, nodeType) {
if (offset === void 0) { offset = -1; }
if (len === void 0) { len = -1; }
this.parent = null;
this.offset = offset;
this.length = len;
if (nodeType) {
this.nodeType = nodeType;
}
}
Object.defineProperty(Node.prototype, "end", {
get: function () { return this.offset + this.length; },
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "type", {
get: function () {
return this.nodeType || NodeType.Undefined;
},
set: function (type) {
this.nodeType = type;
},
enumerable: false,
configurable: true
});
Node.prototype.getTextProvider = function () {
var node = this;
while (node && !node.textProvider) {
node = node.parent;
}
if (node) {
return node.textProvider;
}
return function () { return 'unknown'; };
};
Node.prototype.getText = function () {
return this.getTextProvider()(this.offset, this.length);
};
Node.prototype.matches = function (str) {
return this.length === str.length && this.getTextProvider()(this.offset, this.length) === str;
};
Node.prototype.startsWith = function (str) {
return this.length >= str.length && this.getTextProvider()(this.offset, str.length) === str;
};
Node.prototype.endsWith = function (str) {
return this.length >= str.length && this.getTextProvider()(this.end - str.length, str.length) === str;
};
Node.prototype.accept = function (visitor) {
if (visitor(this) && this.children) {
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
var child = _a[_i];
child.accept(visitor);
}
}
};
Node.prototype.acceptVisitor = function (visitor) {
this.accept(visitor.visitNode.bind(visitor));
};
Node.prototype.adoptChild = function (node, index) {
if (index === void 0) { index = -1; }
if (node.parent && node.parent.children) {
var idx = node.parent.children.indexOf(node);
if (idx >= 0) {
node.parent.children.splice(idx, 1);
}
}
node.parent = this;
var children = this.children;
if (!children) {
children = this.children = [];
}
if (index !== -1) {
children.splice(index, 0, node);
}
else {
children.push(node);
}
return node;
};
Node.prototype.attachTo = function (parent, index) {
if (index === void 0) { index = -1; }
if (parent) {
parent.adoptChild(this, index);
}
return this;
};
Node.prototype.collectIssues = function (results) {
if (this.issues) {
results.push.apply(results, this.issues);
}
};
Node.prototype.addIssue = function (issue) {
if (!this.issues) {
this.issues = [];
}
this.issues.push(issue);
};
Node.prototype.hasIssue = function (rule) {
return Array.isArray(this.issues) && this.issues.some(function (i) { return i.getRule() === rule; });
};
Node.prototype.isErroneous = function (recursive) {
if (recursive === void 0) { recursive = false; }
if (this.issues && this.issues.length > 0) {
return true;
}
return recursive && Array.isArray(this.children) && this.children.some(function (c) { return c.isErroneous(true); });
};
Node.prototype.setNode = function (field, node, index) {
if (index === void 0) { index = -1; }
if (node) {
node.attachTo(this, index);
this[field] = node;
return true;
}
return false;
};
Node.prototype.addChild = function (node) {
if (node) {
if (!this.children) {
this.children = [];
}
node.attachTo(this);
this.updateOffsetAndLength(node);
return true;
}
return false;
};
Node.prototype.updateOffsetAndLength = function (node) {
if (node.offset < this.offset || this.offset === -1) {
this.offset = node.offset;
}
var nodeEnd = node.end;
if ((nodeEnd > this.end) || this.length === -1) {
this.length = nodeEnd - this.offset;
}
};
Node.prototype.hasChildren = function () {
return !!this.children && this.children.length > 0;
};
Node.prototype.getChildren = function () {
return this.children ? this.children.slice(0) : [];
};
Node.prototype.getChild = function (index) {
if (this.children && index < this.children.length) {
return this.children[index];
}
return null;
};
Node.prototype.addChildren = function (nodes) {
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
this.addChild(node);
}
};
Node.prototype.findFirstChildBeforeOffset = function (offset) {
if (this.children) {
var current = null;
for (var i = this.children.length - 1; i >= 0; i--) {
// iterate until we find a child that has a start offset smaller than the input offset
current = this.children[i];
if (current.offset <= offset) {
return current;
}
}
}
return null;
};
Node.prototype.findChildAtOffset = function (offset, goDeep) {
var current = this.findFirstChildBeforeOffset(offset);
if (current && current.end >= offset) {
if (goDeep) {
return current.findChildAtOffset(offset, true) || current;
}
return current;
}
return null;
};
Node.prototype.encloses = function (candidate) {
return this.offset <= candidate.offset && this.offset + this.length >= candidate.offset + candidate.length;
};
Node.prototype.getParent = function () {
var result = this.parent;
while (result instanceof Nodelist) {
result = result.parent;
}
return result;
};
Node.prototype.findParent = function (type) {
var result = this;
while (result && result.type !== type) {
result = result.parent;
}
return result;
};
Node.prototype.findAParent = function () {
var types = [];
for (var _i = 0; _i < arguments.length; _i++) {
types[_i] = arguments[_i];
}
var result = this;
while (result && !types.some(function (t) { return result.type === t; })) {
result = result.parent;
}
return result;
};
Node.prototype.setData = function (key, value) {
if (!this.options) {
this.options = {};
}
this.options[key] = value;
};
Node.prototype.getData = function (key) {
if (!this.options || !this.options.hasOwnProperty(key)) {
return null;
}
return this.options[key];
};
return Node;
}());
var Nodelist = /** @class */ (function (_super) {
__extends(Nodelist, _super);
function Nodelist(parent, index) {
if (index === void 0) { index = -1; }
var _this = _super.call(this, -1, -1) || this;
_this.attachTo(parent, index);
_this.offset = -1;
_this.length = -1;
return _this;
}
return Nodelist;
}(Node));
var Identifier = /** @class */ (function (_super) {
__extends(Identifier, _super);
function Identifier(offset, length) {
var _this = _super.call(this, offset, length) || this;
_this.isCustomProperty = false;
return _this;
}
Object.defineProperty(Identifier.prototype, "type", {
get: function () {
return NodeType.Identifier;
},
enumerable: false,
configurable: true
});
Identifier.prototype.containsInterpolation = function () {
return this.hasChildren();
};
return Identifier;
}(Node));
var Stylesheet = /** @class */ (function (_super) {
__extends(Stylesheet, _super);
function Stylesheet(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Stylesheet.prototype, "type", {
get: function () {
return NodeType.Stylesheet;
},
enumerable: false,
configurable: true
});
return Stylesheet;
}(Node));
var Declarations = /** @class */ (function (_super) {
__extends(Declarations, _super);
function Declarations(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Declarations.prototype, "type", {
get: function () {
return NodeType.Declarations;
},
enumerable: false,
configurable: true
});
return Declarations;
}(Node));
var BodyDeclaration = /** @class */ (function (_super) {
__extends(BodyDeclaration, _super);
function BodyDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
BodyDeclaration.prototype.getDeclarations = function () {
return this.declarations;
};
BodyDeclaration.prototype.setDeclarations = function (decls) {
return this.setNode('declarations', decls);
};
return BodyDeclaration;
}(Node));
var RuleSet = /** @class */ (function (_super) {
__extends(RuleSet, _super);
function RuleSet(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(RuleSet.prototype, "type", {
get: function () {
return NodeType.Ruleset;
},
enumerable: false,
configurable: true
});
RuleSet.prototype.getSelectors = function () {
if (!this.selectors) {
this.selectors = new Nodelist(this);
}
return this.selectors;
};
RuleSet.prototype.isNested = function () {
return !!this.parent && this.parent.findParent(NodeType.Declarations) !== null;
};
return RuleSet;
}(BodyDeclaration));
var Selector = /** @class */ (function (_super) {
__extends(Selector, _super);
function Selector(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Selector.prototype, "type", {
get: function () {
return NodeType.Selector;
},
enumerable: false,
configurable: true
});
return Selector;
}(Node));
var SimpleSelector = /** @class */ (function (_super) {
__extends(SimpleSelector, _super);
function SimpleSelector(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(SimpleSelector.prototype, "type", {
get: function () {
return NodeType.SimpleSelector;
},
enumerable: false,
configurable: true
});
return SimpleSelector;
}(Node));
var AtApplyRule = /** @class */ (function (_super) {
__extends(AtApplyRule, _super);
function AtApplyRule(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(AtApplyRule.prototype, "type", {
get: function () {
return NodeType.AtApplyRule;
},
enumerable: false,
configurable: true
});
AtApplyRule.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
AtApplyRule.prototype.getIdentifier = function () {
return this.identifier;
};
AtApplyRule.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
return AtApplyRule;
}(Node));
var AbstractDeclaration = /** @class */ (function (_super) {
__extends(AbstractDeclaration, _super);
function AbstractDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
return AbstractDeclaration;
}(Node));
var CustomPropertySet = /** @class */ (function (_super) {
__extends(CustomPropertySet, _super);
function CustomPropertySet(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(CustomPropertySet.prototype, "type", {
get: function () {
return NodeType.CustomPropertySet;
},
enumerable: false,
configurable: true
});
return CustomPropertySet;
}(BodyDeclaration));
var Declaration = /** @class */ (function (_super) {
__extends(Declaration, _super);
function Declaration(offset, length) {
var _this = _super.call(this, offset, length) || this;
_this.property = null;
return _this;
}
Object.defineProperty(Declaration.prototype, "type", {
get: function () {
return NodeType.Declaration;
},
enumerable: false,
configurable: true
});
Declaration.prototype.setProperty = function (node) {
return this.setNode('property', node);
};
Declaration.prototype.getProperty = function () {
return this.property;
};
Declaration.prototype.getFullPropertyName = function () {
var propertyName = this.property ? this.property.getName() : 'unknown';
if (this.parent instanceof Declarations && this.parent.getParent() instanceof NestedProperties) {
var parentDecl = this.parent.getParent().getParent();
if (parentDecl instanceof Declaration) {
return parentDecl.getFullPropertyName() + propertyName;
}
}
return propertyName;
};
Declaration.prototype.getNonPrefixedPropertyName = function () {
var propertyName = this.getFullPropertyName();
if (propertyName && propertyName.charAt(0) === '-') {
var vendorPrefixEnd = propertyName.indexOf('-', 1);
if (vendorPrefixEnd !== -1) {
return propertyName.substring(vendorPrefixEnd + 1);
}
}
return propertyName;
};
Declaration.prototype.setValue = function (value) {
return this.setNode('value', value);
};
Declaration.prototype.getValue = function () {
return this.value;
};
Declaration.prototype.setNestedProperties = function (value) {
return this.setNode('nestedProperties', value);
};
Declaration.prototype.getNestedProperties = function () {
return this.nestedProperties;
};
return Declaration;
}(AbstractDeclaration));
var CustomPropertyDeclaration = /** @class */ (function (_super) {
__extends(CustomPropertyDeclaration, _super);
function CustomPropertyDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(CustomPropertyDeclaration.prototype, "type", {
get: function () {
return NodeType.CustomPropertyDeclaration;
},
enumerable: false,
configurable: true
});
CustomPropertyDeclaration.prototype.setPropertySet = function (value) {
return this.setNode('propertySet', value);
};
CustomPropertyDeclaration.prototype.getPropertySet = function () {
return this.propertySet;
};
return CustomPropertyDeclaration;
}(Declaration));
var Property = /** @class */ (function (_super) {
__extends(Property, _super);
function Property(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Property.prototype, "type", {
get: function () {
return NodeType.Property;
},
enumerable: false,
configurable: true
});
Property.prototype.setIdentifier = function (value) {
return this.setNode('identifier', value);
};
Property.prototype.getIdentifier = function () {
return this.identifier;
};
Property.prototype.getName = function () {
return (0,_utils_strings__WEBPACK_IMPORTED_MODULE_0__.trim)(this.getText(), /[_\+]+$/); /* +_: less merge */
};
Property.prototype.isCustomProperty = function () {
return !!this.identifier && this.identifier.isCustomProperty;
};
return Property;
}(Node));
var Invocation = /** @class */ (function (_super) {
__extends(Invocation, _super);
function Invocation(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Invocation.prototype, "type", {
get: function () {
return NodeType.Invocation;
},
enumerable: false,
configurable: true
});
Invocation.prototype.getArguments = function () {
if (!this.arguments) {
this.arguments = new Nodelist(this);
}
return this.arguments;
};
return Invocation;
}(Node));
var Function = /** @class */ (function (_super) {
__extends(Function, _super);
function Function(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Function.prototype, "type", {
get: function () {
return NodeType.Function;
},
enumerable: false,
configurable: true
});
Function.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
Function.prototype.getIdentifier = function () {
return this.identifier;
};
Function.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
return Function;
}(Invocation));
var FunctionParameter = /** @class */ (function (_super) {
__extends(FunctionParameter, _super);
function FunctionParameter(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(FunctionParameter.prototype, "type", {
get: function () {
return NodeType.FunctionParameter;
},
enumerable: false,
configurable: true
});
FunctionParameter.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
FunctionParameter.prototype.getIdentifier = function () {
return this.identifier;
};
FunctionParameter.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
FunctionParameter.prototype.setDefaultValue = function (node) {
return this.setNode('defaultValue', node, 0);
};
FunctionParameter.prototype.getDefaultValue = function () {
return this.defaultValue;
};
return FunctionParameter;
}(Node));
var FunctionArgument = /** @class */ (function (_super) {
__extends(FunctionArgument, _super);
function FunctionArgument(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(FunctionArgument.prototype, "type", {
get: function () {
return NodeType.FunctionArgument;
},
enumerable: false,
configurable: true
});
FunctionArgument.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
FunctionArgument.prototype.getIdentifier = function () {
return this.identifier;
};
FunctionArgument.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
FunctionArgument.prototype.setValue = function (node) {
return this.setNode('value', node, 0);
};
FunctionArgument.prototype.getValue = function () {
return this.value;
};
return FunctionArgument;
}(Node));
var IfStatement = /** @class */ (function (_super) {
__extends(IfStatement, _super);
function IfStatement(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(IfStatement.prototype, "type", {
get: function () {
return NodeType.If;
},
enumerable: false,
configurable: true
});
IfStatement.prototype.setExpression = function (node) {
return this.setNode('expression', node, 0);
};
IfStatement.prototype.setElseClause = function (elseClause) {
return this.setNode('elseClause', elseClause);
};
return IfStatement;
}(BodyDeclaration));
var ForStatement = /** @class */ (function (_super) {
__extends(ForStatement, _super);
function ForStatement(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(ForStatement.prototype, "type", {
get: function () {
return NodeType.For;
},
enumerable: false,
configurable: true
});
ForStatement.prototype.setVariable = function (node) {
return this.setNode('variable', node, 0);
};
return ForStatement;
}(BodyDeclaration));
var EachStatement = /** @class */ (function (_super) {
__extends(EachStatement, _super);
function EachStatement(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(EachStatement.prototype, "type", {
get: function () {
return NodeType.Each;
},
enumerable: false,
configurable: true
});
EachStatement.prototype.getVariables = function () {
if (!this.variables) {
this.variables = new Nodelist(this);
}
return this.variables;
};
return EachStatement;
}(BodyDeclaration));
var WhileStatement = /** @class */ (function (_super) {
__extends(WhileStatement, _super);
function WhileStatement(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(WhileStatement.prototype, "type", {
get: function () {
return NodeType.While;
},
enumerable: false,
configurable: true
});
return WhileStatement;
}(BodyDeclaration));
var ElseStatement = /** @class */ (function (_super) {
__extends(ElseStatement, _super);
function ElseStatement(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(ElseStatement.prototype, "type", {
get: function () {
return NodeType.Else;
},
enumerable: false,
configurable: true
});
return ElseStatement;
}(BodyDeclaration));
var FunctionDeclaration = /** @class */ (function (_super) {
__extends(FunctionDeclaration, _super);
function FunctionDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(FunctionDeclaration.prototype, "type", {
get: function () {
return NodeType.FunctionDeclaration;
},
enumerable: false,
configurable: true
});
FunctionDeclaration.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
FunctionDeclaration.prototype.getIdentifier = function () {
return this.identifier;
};
FunctionDeclaration.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
FunctionDeclaration.prototype.getParameters = function () {
if (!this.parameters) {
this.parameters = new Nodelist(this);
}
return this.parameters;
};
return FunctionDeclaration;
}(BodyDeclaration));
var ViewPort = /** @class */ (function (_super) {
__extends(ViewPort, _super);
function ViewPort(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(ViewPort.prototype, "type", {
get: function () {
return NodeType.ViewPort;
},
enumerable: false,
configurable: true
});
return ViewPort;
}(BodyDeclaration));
var FontFace = /** @class */ (function (_super) {
__extends(FontFace, _super);
function FontFace(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(FontFace.prototype, "type", {
get: function () {
return NodeType.FontFace;
},
enumerable: false,
configurable: true
});
return FontFace;
}(BodyDeclaration));
var NestedProperties = /** @class */ (function (_super) {
__extends(NestedProperties, _super);
function NestedProperties(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(NestedProperties.prototype, "type", {
get: function () {
return NodeType.NestedProperties;
},
enumerable: false,
configurable: true
});
return NestedProperties;
}(BodyDeclaration));
var Keyframe = /** @class */ (function (_super) {
__extends(Keyframe, _super);
function Keyframe(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Keyframe.prototype, "type", {
get: function () {
return NodeType.Keyframe;
},
enumerable: false,
configurable: true
});
Keyframe.prototype.setKeyword = function (keyword) {
return this.setNode('keyword', keyword, 0);
};
Keyframe.prototype.getKeyword = function () {
return this.keyword;
};
Keyframe.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
Keyframe.prototype.getIdentifier = function () {
return this.identifier;
};
Keyframe.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
return Keyframe;
}(BodyDeclaration));
var KeyframeSelector = /** @class */ (function (_super) {
__extends(KeyframeSelector, _super);
function KeyframeSelector(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(KeyframeSelector.prototype, "type", {
get: function () {
return NodeType.KeyframeSelector;
},
enumerable: false,
configurable: true
});
return KeyframeSelector;
}(BodyDeclaration));
var Import = /** @class */ (function (_super) {
__extends(Import, _super);
function Import(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Import.prototype, "type", {
get: function () {
return NodeType.Import;
},
enumerable: false,
configurable: true
});
Import.prototype.setMedialist = function (node) {
if (node) {
node.attachTo(this);
return true;
}
return false;
};
return Import;
}(Node));
var Use = /** @class */ (function (_super) {
__extends(Use, _super);
function Use() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Use.prototype, "type", {
get: function () {
return NodeType.Use;
},
enumerable: false,
configurable: true
});
Use.prototype.getParameters = function () {
if (!this.parameters) {
this.parameters = new Nodelist(this);
}
return this.parameters;
};
Use.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
Use.prototype.getIdentifier = function () {
return this.identifier;
};
return Use;
}(Node));
var ModuleConfiguration = /** @class */ (function (_super) {
__extends(ModuleConfiguration, _super);
function ModuleConfiguration() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ModuleConfiguration.prototype, "type", {
get: function () {
return NodeType.ModuleConfiguration;
},
enumerable: false,
configurable: true
});
ModuleConfiguration.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
ModuleConfiguration.prototype.getIdentifier = function () {
return this.identifier;
};
ModuleConfiguration.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
ModuleConfiguration.prototype.setValue = function (node) {
return this.setNode('value', node, 0);
};
ModuleConfiguration.prototype.getValue = function () {
return this.value;
};
return ModuleConfiguration;
}(Node));
var Forward = /** @class */ (function (_super) {
__extends(Forward, _super);
function Forward() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Forward.prototype, "type", {
get: function () {
return NodeType.Forward;
},
enumerable: false,
configurable: true
});
Forward.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
Forward.prototype.getIdentifier = function () {
return this.identifier;
};
Forward.prototype.getMembers = function () {
if (!this.members) {
this.members = new Nodelist(this);
}
return this.members;
};
Forward.prototype.getParameters = function () {
if (!this.parameters) {
this.parameters = new Nodelist(this);
}
return this.parameters;
};
return Forward;
}(Node));
var ForwardVisibility = /** @class */ (function (_super) {
__extends(ForwardVisibility, _super);
function ForwardVisibility() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ForwardVisibility.prototype, "type", {
get: function () {
return NodeType.ForwardVisibility;
},
enumerable: false,
configurable: true
});
ForwardVisibility.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
ForwardVisibility.prototype.getIdentifier = function () {
return this.identifier;
};
return ForwardVisibility;
}(Node));
var Namespace = /** @class */ (function (_super) {
__extends(Namespace, _super);
function Namespace(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Namespace.prototype, "type", {
get: function () {
return NodeType.Namespace;
},
enumerable: false,
configurable: true
});
return Namespace;
}(Node));
var Media = /** @class */ (function (_super) {
__extends(Media, _super);
function Media(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Media.prototype, "type", {
get: function () {
return NodeType.Media;
},
enumerable: false,
configurable: true
});
return Media;
}(BodyDeclaration));
var Supports = /** @class */ (function (_super) {
__extends(Supports, _super);
function Supports(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Supports.prototype, "type", {
get: function () {
return NodeType.Supports;
},
enumerable: false,
configurable: true
});
return Supports;
}(BodyDeclaration));
var Document = /** @class */ (function (_super) {
__extends(Document, _super);
function Document(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Document.prototype, "type", {
get: function () {
return NodeType.Document;
},
enumerable: false,
configurable: true
});
return Document;
}(BodyDeclaration));
var Medialist = /** @class */ (function (_super) {
__extends(Medialist, _super);
function Medialist(offset, length) {
return _super.call(this, offset, length) || this;
}
Medialist.prototype.getMediums = function () {
if (!this.mediums) {
this.mediums = new Nodelist(this);
}
return this.mediums;
};
return Medialist;
}(Node));
var MediaQuery = /** @class */ (function (_super) {
__extends(MediaQuery, _super);
function MediaQuery(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(MediaQuery.prototype, "type", {
get: function () {
return NodeType.MediaQuery;
},
enumerable: false,
configurable: true
});
return MediaQuery;
}(Node));
var SupportsCondition = /** @class */ (function (_super) {
__extends(SupportsCondition, _super);
function SupportsCondition(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(SupportsCondition.prototype, "type", {
get: function () {
return NodeType.SupportsCondition;
},
enumerable: false,
configurable: true
});
return SupportsCondition;
}(Node));
var Page = /** @class */ (function (_super) {
__extends(Page, _super);
function Page(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Page.prototype, "type", {
get: function () {
return NodeType.Page;
},
enumerable: false,
configurable: true
});
return Page;
}(BodyDeclaration));
var PageBoxMarginBox = /** @class */ (function (_super) {
__extends(PageBoxMarginBox, _super);
function PageBoxMarginBox(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(PageBoxMarginBox.prototype, "type", {
get: function () {
return NodeType.PageBoxMarginBox;
},
enumerable: false,
configurable: true
});
return PageBoxMarginBox;
}(BodyDeclaration));
var Expression = /** @class */ (function (_super) {
__extends(Expression, _super);
function Expression(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Expression.prototype, "type", {
get: function () {
return NodeType.Expression;
},
enumerable: false,
configurable: true
});
return Expression;
}(Node));
var BinaryExpression = /** @class */ (function (_super) {
__extends(BinaryExpression, _super);
function BinaryExpression(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(BinaryExpression.prototype, "type", {
get: function () {
return NodeType.BinaryExpression;
},
enumerable: false,
configurable: true
});
BinaryExpression.prototype.setLeft = function (left) {
return this.setNode('left', left);
};
BinaryExpression.prototype.getLeft = function () {
return this.left;
};
BinaryExpression.prototype.setRight = function (right) {
return this.setNode('right', right);
};
BinaryExpression.prototype.getRight = function () {
return this.right;
};
BinaryExpression.prototype.setOperator = function (value) {
return this.setNode('operator', value);
};
BinaryExpression.prototype.getOperator = function () {
return this.operator;
};
return BinaryExpression;
}(Node));
var Term = /** @class */ (function (_super) {
__extends(Term, _super);
function Term(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Term.prototype, "type", {
get: function () {
return NodeType.Term;
},
enumerable: false,
configurable: true
});
Term.prototype.setOperator = function (value) {
return this.setNode('operator', value);
};
Term.prototype.getOperator = function () {
return this.operator;
};
Term.prototype.setExpression = function (value) {
return this.setNode('expression', value);
};
Term.prototype.getExpression = function () {
return this.expression;
};
return Term;
}(Node));
var AttributeSelector = /** @class */ (function (_super) {
__extends(AttributeSelector, _super);
function AttributeSelector(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(AttributeSelector.prototype, "type", {
get: function () {
return NodeType.AttributeSelector;
},
enumerable: false,
configurable: true
});
AttributeSelector.prototype.setNamespacePrefix = function (value) {
return this.setNode('namespacePrefix', value);
};
AttributeSelector.prototype.getNamespacePrefix = function () {
return this.namespacePrefix;
};
AttributeSelector.prototype.setIdentifier = function (value) {
return this.setNode('identifier', value);
};
AttributeSelector.prototype.getIdentifier = function () {
return this.identifier;
};
AttributeSelector.prototype.setOperator = function (operator) {
return this.setNode('operator', operator);
};
AttributeSelector.prototype.getOperator = function () {
return this.operator;
};
AttributeSelector.prototype.setValue = function (value) {
return this.setNode('value', value);
};
AttributeSelector.prototype.getValue = function () {
return this.value;
};
return AttributeSelector;
}(Node));
var Operator = /** @class */ (function (_super) {
__extends(Operator, _super);
function Operator(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Operator.prototype, "type", {
get: function () {
return NodeType.Operator;
},
enumerable: false,
configurable: true
});
return Operator;
}(Node));
var HexColorValue = /** @class */ (function (_super) {
__extends(HexColorValue, _super);
function HexColorValue(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(HexColorValue.prototype, "type", {
get: function () {
return NodeType.HexColorValue;
},
enumerable: false,
configurable: true
});
return HexColorValue;
}(Node));
var _dot = '.'.charCodeAt(0), _0 = '0'.charCodeAt(0), _9 = '9'.charCodeAt(0);
var NumericValue = /** @class */ (function (_super) {
__extends(NumericValue, _super);
function NumericValue(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(NumericValue.prototype, "type", {
get: function () {
return NodeType.NumericValue;
},
enumerable: false,
configurable: true
});
NumericValue.prototype.getValue = function () {
var raw = this.getText();
var unitIdx = 0;
var code;
for (var i = 0, len = raw.length; i < len; i++) {
code = raw.charCodeAt(i);
if (!(_0 <= code && code <= _9 || code === _dot)) {
break;
}
unitIdx += 1;
}
return {
value: raw.substring(0, unitIdx),
unit: unitIdx < raw.length ? raw.substring(unitIdx) : undefined
};
};
return NumericValue;
}(Node));
var VariableDeclaration = /** @class */ (function (_super) {
__extends(VariableDeclaration, _super);
function VariableDeclaration(offset, length) {
var _this = _super.call(this, offset, length) || this;
_this.variable = null;
_this.value = null;
_this.needsSemicolon = true;
return _this;
}
Object.defineProperty(VariableDeclaration.prototype, "type", {
get: function () {
return NodeType.VariableDeclaration;
},
enumerable: false,
configurable: true
});
VariableDeclaration.prototype.setVariable = function (node) {
if (node) {
node.attachTo(this);
this.variable = node;
return true;
}
return false;
};
VariableDeclaration.prototype.getVariable = function () {
return this.variable;
};
VariableDeclaration.prototype.getName = function () {
return this.variable ? this.variable.getName() : '';
};
VariableDeclaration.prototype.setValue = function (node) {
if (node) {
node.attachTo(this);
this.value = node;
return true;
}
return false;
};
VariableDeclaration.prototype.getValue = function () {
return this.value;
};
return VariableDeclaration;
}(AbstractDeclaration));
var Interpolation = /** @class */ (function (_super) {
__extends(Interpolation, _super);
// private _interpolations: void; // workaround for https://github.com/Microsoft/TypeScript/issues/18276
function Interpolation(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Interpolation.prototype, "type", {
get: function () {
return NodeType.Interpolation;
},
enumerable: false,
configurable: true
});
return Interpolation;
}(Node));
var Variable = /** @class */ (function (_super) {
__extends(Variable, _super);
function Variable(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(Variable.prototype, "type", {
get: function () {
return NodeType.VariableName;
},
enumerable: false,
configurable: true
});
Variable.prototype.getName = function () {
return this.getText();
};
return Variable;
}(Node));
var ExtendsReference = /** @class */ (function (_super) {
__extends(ExtendsReference, _super);
function ExtendsReference(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(ExtendsReference.prototype, "type", {
get: function () {
return NodeType.ExtendsReference;
},
enumerable: false,
configurable: true
});
ExtendsReference.prototype.getSelectors = function () {
if (!this.selectors) {
this.selectors = new Nodelist(this);
}
return this.selectors;
};
return ExtendsReference;
}(Node));
var MixinContentReference = /** @class */ (function (_super) {
__extends(MixinContentReference, _super);
function MixinContentReference(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(MixinContentReference.prototype, "type", {
get: function () {
return NodeType.MixinContentReference;
},
enumerable: false,
configurable: true
});
MixinContentReference.prototype.getArguments = function () {
if (!this.arguments) {
this.arguments = new Nodelist(this);
}
return this.arguments;
};
return MixinContentReference;
}(Node));
var MixinContentDeclaration = /** @class */ (function (_super) {
__extends(MixinContentDeclaration, _super);
function MixinContentDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(MixinContentDeclaration.prototype, "type", {
get: function () {
return NodeType.MixinContentReference;
},
enumerable: false,
configurable: true
});
MixinContentDeclaration.prototype.getParameters = function () {
if (!this.parameters) {
this.parameters = new Nodelist(this);
}
return this.parameters;
};
return MixinContentDeclaration;
}(BodyDeclaration));
var MixinReference = /** @class */ (function (_super) {
__extends(MixinReference, _super);
function MixinReference(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(MixinReference.prototype, "type", {
get: function () {
return NodeType.MixinReference;
},
enumerable: false,
configurable: true
});
MixinReference.prototype.getNamespaces = function () {
if (!this.namespaces) {
this.namespaces = new Nodelist(this);
}
return this.namespaces;
};
MixinReference.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
MixinReference.prototype.getIdentifier = function () {
return this.identifier;
};
MixinReference.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
MixinReference.prototype.getArguments = function () {
if (!this.arguments) {
this.arguments = new Nodelist(this);
}
return this.arguments;
};
MixinReference.prototype.setContent = function (node) {
return this.setNode('content', node);
};
MixinReference.prototype.getContent = function () {
return this.content;
};
return MixinReference;
}(Node));
var MixinDeclaration = /** @class */ (function (_super) {
__extends(MixinDeclaration, _super);
function MixinDeclaration(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(MixinDeclaration.prototype, "type", {
get: function () {
return NodeType.MixinDeclaration;
},
enumerable: false,
configurable: true
});
MixinDeclaration.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
MixinDeclaration.prototype.getIdentifier = function () {
return this.identifier;
};
MixinDeclaration.prototype.getName = function () {
return this.identifier ? this.identifier.getText() : '';
};
MixinDeclaration.prototype.getParameters = function () {
if (!this.parameters) {
this.parameters = new Nodelist(this);
}
return this.parameters;
};
MixinDeclaration.prototype.setGuard = function (node) {
if (node) {
node.attachTo(this);
this.guard = node;
}
return false;
};
return MixinDeclaration;
}(BodyDeclaration));
var UnknownAtRule = /** @class */ (function (_super) {
__extends(UnknownAtRule, _super);
function UnknownAtRule(offset, length) {
return _super.call(this, offset, length) || this;
}
Object.defineProperty(UnknownAtRule.prototype, "type", {
get: function () {
return NodeType.UnknownAtRule;
},
enumerable: false,
configurable: true
});
UnknownAtRule.prototype.setAtRuleName = function (atRuleName) {
this.atRuleName = atRuleName;
};
UnknownAtRule.prototype.getAtRuleName = function () {
return this.atRuleName;
};
return UnknownAtRule;
}(BodyDeclaration));
var ListEntry = /** @class */ (function (_super) {
__extends(ListEntry, _super);
function ListEntry() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ListEntry.prototype, "type", {
get: function () {
return NodeType.ListEntry;
},
enumerable: false,
configurable: true
});
ListEntry.prototype.setKey = function (node) {
return this.setNode('key', node, 0);
};
ListEntry.prototype.setValue = function (node) {
return this.setNode('value', node, 1);
};
return ListEntry;
}(Node));
var LessGuard = /** @class */ (function (_super) {
__extends(LessGuard, _super);
function LessGuard() {
return _super !== null && _super.apply(this, arguments) || this;
}
LessGuard.prototype.getConditions = function () {
if (!this.conditions) {
this.conditions = new Nodelist(this);
}
return this.conditions;
};
return LessGuard;
}(Node));
var GuardCondition = /** @class */ (function (_super) {
__extends(GuardCondition, _super);
function GuardCondition() {
return _super !== null && _super.apply(this, arguments) || this;
}
GuardCondition.prototype.setVariable = function (node) {
return this.setNode('variable', node);
};
return GuardCondition;
}(Node));
var Module = /** @class */ (function (_super) {
__extends(Module, _super);
function Module() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Module.prototype, "type", {
get: function () {
return NodeType.Module;
},
enumerable: false,
configurable: true
});
Module.prototype.setIdentifier = function (node) {
return this.setNode('identifier', node, 0);
};
Module.prototype.getIdentifier = function () {
return this.identifier;
};
return Module;
}(Node));
var Level;
(function (Level) {
Level[Level["Ignore"] = 1] = "Ignore";
Level[Level["Warning"] = 2] = "Warning";
Level[Level["Error"] = 4] = "Error";
})(Level || (Level = {}));
var Marker = /** @class */ (function () {
function Marker(node, rule, level, message, offset, length) {
if (offset === void 0) { offset = node.offset; }
if (length === void 0) { length = node.length; }
this.node = node;
this.rule = rule;
this.level = level;
this.message = message || rule.message;
this.offset = offset;
this.length = length;
}
Marker.prototype.getRule = function () {
return this.rule;
};
Marker.prototype.getLevel = function () {
return this.level;
};
Marker.prototype.getOffset = function () {
return this.offset;
};
Marker.prototype.getLength = function () {
return this.length;
};
Marker.prototype.getNode = function () {
return this.node;
};
Marker.prototype.getMessage = function () {
return this.message;
};
return Marker;
}());
/*
export class DefaultVisitor implements IVisitor {
public visitNode(node:Node):boolean {
switch (node.type) {
case NodeType.Stylesheet:
return this.visitStylesheet( node);
case NodeType.FontFace:
return this.visitFontFace( node);
case NodeType.Ruleset:
return this.visitRuleSet( node);
case NodeType.Selector:
return this.visitSelector( node);
case NodeType.SimpleSelector:
return this.visitSimpleSelector( node);
case NodeType.Declaration:
return this.visitDeclaration( node);
case NodeType.Function:
return this.visitFunction( node);
case NodeType.FunctionDeclaration:
return this.visitFunctionDeclaration( node);
case NodeType.FunctionParameter:
return this.visitFunctionParameter( node);
case NodeType.FunctionArgument:
return this.visitFunctionArgument( node);
case NodeType.Term:
return this.visitTerm( node);
case NodeType.Declaration:
return this.visitExpression( node);
case NodeType.NumericValue:
return this.visitNumericValue( node);
case NodeType.Page:
return this.visitPage( node);
case NodeType.PageBoxMarginBox:
return this.visitPageBoxMarginBox( node);
case NodeType.Property:
return this.visitProperty( node);
case NodeType.NumericValue:
return this.visitNodelist( node);
case NodeType.Import:
return this.visitImport( node);
case NodeType.Namespace:
return this.visitNamespace( node);
case NodeType.Keyframe:
return this.visitKeyframe( node);
case NodeType.KeyframeSelector:
return this.visitKeyframeSelector( node);
case NodeType.MixinDeclaration:
return this.visitMixinDeclaration( node);
case NodeType.MixinReference:
return this.visitMixinReference( node);
case NodeType.Variable:
return this.visitVariable( node);
case NodeType.VariableDeclaration:
return this.visitVariableDeclaration( node);
}
return this.visitUnknownNode(node);
}
public visitFontFace(node:FontFace):boolean {
return true;
}
public visitKeyframe(node:Keyframe):boolean {
return true;
}
public visitKeyframeSelector(node:KeyframeSelector):boolean {
return true;
}
public visitStylesheet(node:Stylesheet):boolean {
return true;
}
public visitProperty(Node:Property):boolean {
return true;
}
public visitRuleSet(node:RuleSet):boolean {
return true;
}
public visitSelector(node:Selector):boolean {
return true;
}
public visitSimpleSelector(node:SimpleSelector):boolean {
return true;
}
public visitDeclaration(node:Declaration):boolean {
return true;
}
public visitFunction(node:Function):boolean {
return true;
}
public visitFunctionDeclaration(node:FunctionDeclaration):boolean {
return true;
}
public visitInvocation(node:Invocation):boolean {
return true;
}
public visitTerm(node:Term):boolean {
return true;
}
public visitImport(node:Import):boolean {
return true;
}
public visitNamespace(node:Namespace):boolean {
return true;
}
public visitExpression(node:Expression):boolean {
return true;
}
public visitNumericValue(node:NumericValue):boolean {
return true;
}
public visitPage(node:Page):boolean {
return true;
}
public visitPageBoxMarginBox(node:PageBoxMarginBox):boolean {
return true;
}
public visitNodelist(node:Nodelist):boolean {
return true;
}
public visitVariableDeclaration(node:VariableDeclaration):boolean {
return true;
}
public visitVariable(node:Variable):boolean {
return true;
}
public visitMixinDeclaration(node:MixinDeclaration):boolean {
return true;
}
public visitMixinReference(node:MixinReference):boolean {
return true;
}
public visitUnknownNode(node:Node):boolean {
return true;
}
}
*/
var ParseErrorCollector = /** @class */ (function () {
function ParseErrorCollector() {
this.entries = [];
}
ParseErrorCollector.entries = function (node) {
var visitor = new ParseErrorCollector();
node.acceptVisitor(visitor);
return visitor.entries;
};
ParseErrorCollector.prototype.visitNode = function (node) {
if (node.isErroneous()) {
node.collectIssues(this.entries);
}
return true;
};
return ParseErrorCollector;
}());
/***/ }),
/* 75 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "startsWith": () => /* binding */ startsWith,
/* harmony export */ "endsWith": () => /* binding */ endsWith,
/* harmony export */ "difference": () => /* binding */ difference,
/* harmony export */ "getLimitedString": () => /* binding */ getLimitedString,
/* harmony export */ "trim": () => /* binding */ trim
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function startsWith(haystack, needle) {
if (haystack.length < needle.length) {
return false;
}
for (var i = 0; i < needle.length; i++) {
if (haystack[i] !== needle[i]) {
return false;
}
}
return true;
}
/**
* Determines if haystack ends with needle.
*/
function endsWith(haystack, needle) {
var diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === diff;
}
else if (diff === 0) {
return haystack === needle;
}
else {
return false;
}
}
/**
* Computes the difference score for two strings. More similar strings have a higher score.
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
* Strings that have a large length difference will get a bad default score 0.
* Complexity - both time and space O(first.length * second.length)
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
*
* @param first a string
* @param second a string
*/
function difference(first, second, maxLenDelta) {
if (maxLenDelta === void 0) { maxLenDelta = 4; }
var lengthDifference = Math.abs(first.length - second.length);
// We only compute score if length of the currentWord and length of entry.name are similar.
if (lengthDifference > maxLenDelta) {
return 0;
}
// Initialize LCS (largest common subsequence) matrix.
var LCS = [];
var zeroArray = [];
var i, j;
for (i = 0; i < second.length + 1; ++i) {
zeroArray.push(0);
}
for (i = 0; i < first.length + 1; ++i) {
LCS.push(zeroArray);
}
for (i = 1; i < first.length + 1; ++i) {
for (j = 1; j < second.length + 1; ++j) {
if (first[i - 1] === second[j - 1]) {
LCS[i][j] = LCS[i - 1][j - 1] + 1;
}
else {
LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]);
}
}
}
return LCS[first.length][second.length] - Math.sqrt(lengthDifference);
}
/**
* Limit of string length.
*/
function getLimitedString(str, ellipsis) {
if (ellipsis === void 0) { ellipsis = true; }
if (!str) {
return '';
}
if (str.length < 140) {
return str;
}
return str.slice(0, 140) + (ellipsis ? '\u2026' : '');
}
/**
* Limit of string length.
*/
function trim(str, regexp) {
var m = regexp.exec(str);
if (m && m[0].length) {
return str.substr(0, str.length - m[0].length);
}
return str;
}
/***/ }),
/* 76 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "CSSIssueType": () => /* binding */ CSSIssueType,
/* harmony export */ "ParseError": () => /* binding */ ParseError
/* harmony export */ });
/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_0__.loadMessageBundle();
var CSSIssueType = /** @class */ (function () {
function CSSIssueType(id, message) {
this.id = id;
this.message = message;
}
return CSSIssueType;
}());
var ParseError = {
NumberExpected: new CSSIssueType('css-numberexpected', localize('expected.number', "number expected")),
ConditionExpected: new CSSIssueType('css-conditionexpected', localize('expected.condt', "condition expected")),
RuleOrSelectorExpected: new CSSIssueType('css-ruleorselectorexpected', localize('expected.ruleorselector', "at-rule or selector expected")),
DotExpected: new CSSIssueType('css-dotexpected', localize('expected.dot', "dot expected")),
ColonExpected: new CSSIssueType('css-colonexpected', localize('expected.colon', "colon expected")),
SemiColonExpected: new CSSIssueType('css-semicolonexpected', localize('expected.semicolon', "semi-colon expected")),
TermExpected: new CSSIssueType('css-termexpected', localize('expected.term', "term expected")),
ExpressionExpected: new CSSIssueType('css-expressionexpected', localize('expected.expression', "expression expected")),
OperatorExpected: new CSSIssueType('css-operatorexpected', localize('expected.operator', "operator expected")),
IdentifierExpected: new CSSIssueType('css-identifierexpected', localize('expected.ident', "identifier expected")),
PercentageExpected: new CSSIssueType('css-percentageexpected', localize('expected.percentage', "percentage expected")),
URIOrStringExpected: new CSSIssueType('css-uriorstringexpected', localize('expected.uriorstring', "uri or string expected")),
URIExpected: new CSSIssueType('css-uriexpected', localize('expected.uri', "URI expected")),
VariableNameExpected: new CSSIssueType('css-varnameexpected', localize('expected.varname', "variable name expected")),
VariableValueExpected: new CSSIssueType('css-varvalueexpected', localize('expected.varvalue', "variable value expected")),
PropertyValueExpected: new CSSIssueType('css-propertyvalueexpected', localize('expected.propvalue', "property value expected")),
LeftCurlyExpected: new CSSIssueType('css-lcurlyexpected', localize('expected.lcurly', "{ expected")),
RightCurlyExpected: new CSSIssueType('css-rcurlyexpected', localize('expected.rcurly', "} expected")),
LeftSquareBracketExpected: new CSSIssueType('css-rbracketexpected', localize('expected.lsquare', "[ expected")),
RightSquareBracketExpected: new CSSIssueType('css-lbracketexpected', localize('expected.rsquare', "] expected")),
LeftParenthesisExpected: new CSSIssueType('css-lparentexpected', localize('expected.lparen', "( expected")),
RightParenthesisExpected: new CSSIssueType('css-rparentexpected', localize('expected.rparent', ") expected")),
CommaExpected: new CSSIssueType('css-commaexpected', localize('expected.comma', "comma expected")),
PageDirectiveOrDeclarationExpected: new CSSIssueType('css-pagedirordeclexpected', localize('expected.pagedirordecl', "page directive or declaraton expected")),
UnknownAtRule: new CSSIssueType('css-unknownatrule', localize('unknown.atrule', "at-rule unknown")),
UnknownKeyword: new CSSIssueType('css-unknownkeyword', localize('unknown.keyword', "unknown keyword")),
SelectorExpected: new CSSIssueType('css-selectorexpected', localize('expected.selector', "selector expected")),
StringLiteralExpected: new CSSIssueType('css-stringliteralexpected', localize('expected.stringliteral', "string literal expected")),
WhitespaceExpected: new CSSIssueType('css-whitespaceexpected', localize('expected.whitespace', "whitespace expected")),
MediaQueryExpected: new CSSIssueType('css-mediaqueryexpected', localize('expected.mediaquery', "media query expected")),
IdentifierOrWildcardExpected: new CSSIssueType('css-idorwildcardexpected', localize('expected.idorwildcard', "identifier or wildcard expected")),
WildcardExpected: new CSSIssueType('css-wildcardexpected', localize('expected.wildcard', "wildcard expected")),
IdentifierOrVariableExpected: new CSSIssueType('css-idorvarexpected', localize('expected.idorvar', "identifier or variable expected")),
};
/***/ }),
/* 77 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.config = exports.loadMessageBundle = void 0;
var path = __webpack_require__(3);
var fs = __webpack_require__(64);
var ral_1 = __webpack_require__(78);
var common_1 = __webpack_require__(79);
var common_2 = __webpack_require__(79);
Object.defineProperty(exports, "MessageFormat", ({ enumerable: true, get: function () { return common_2.MessageFormat; } }));
Object.defineProperty(exports, "BundleFormat", ({ enumerable: true, get: function () { return common_2.BundleFormat; } }));
var toString = Object.prototype.toString;
function isNumber(value) {
return toString.call(value) === '[object Number]';
}
function isString(value) {
return toString.call(value) === '[object String]';
}
function isBoolean(value) {
return value === true || value === false;
}
function readJsonFileSync(filename) {
return JSON.parse(fs.readFileSync(filename, 'utf8'));
}
var resolvedBundles;
var options;
function initializeSettings() {
options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: common_1.MessageFormat.bundle };
if (isString(process.env.VSCODE_NLS_CONFIG)) {
try {
var vscodeOptions_1 = JSON.parse(process.env.VSCODE_NLS_CONFIG);
var language = void 0;
if (vscodeOptions_1.availableLanguages) {
var value = vscodeOptions_1.availableLanguages['*'];
if (isString(value)) {
language = value;
}
}
if (isString(vscodeOptions_1.locale)) {
options.locale = vscodeOptions_1.locale.toLowerCase();
}
if (language === undefined) {
options.language = options.locale;
}
else if (language !== 'en') {
options.language = language;
}
if (isBoolean(vscodeOptions_1._languagePackSupport)) {
options.languagePackSupport = vscodeOptions_1._languagePackSupport;
}
if (isString(vscodeOptions_1._cacheRoot)) {
options.cacheRoot = vscodeOptions_1._cacheRoot;
}
if (isString(vscodeOptions_1._languagePackId)) {
options.languagePackId = vscodeOptions_1._languagePackId;
}
if (isString(vscodeOptions_1._translationsConfigFile)) {
options.translationsConfigFile = vscodeOptions_1._translationsConfigFile;
try {
options.translationsConfig = readJsonFileSync(options.translationsConfigFile);
}
catch (error) {
// We can't read the translation config file. Mark the cache as corrupted.
if (vscodeOptions_1._corruptedFile) {
var dirname = path.dirname(vscodeOptions_1._corruptedFile);
fs.exists(dirname, function (exists) {
if (exists) {
fs.writeFile(vscodeOptions_1._corruptedFile, 'corrupted', 'utf8', function (err) {
console.error(err);
});
}
});
}
}
}
}
catch (_a) {
// Do nothing.
}
}
common_1.setPseudo(options.locale === 'pseudo');
resolvedBundles = Object.create(null);
}
initializeSettings();
function supportsLanguagePack() {
return options.languagePackSupport === true && options.cacheRoot !== undefined && options.languagePackId !== undefined && options.translationsConfigFile !== undefined
&& options.translationsConfig !== undefined;
}
function createScopedLocalizeFunction(messages) {
return function (key, message) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
if (isNumber(key)) {
if (key >= messages.length) {
console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: " + new Error('').stack);
return;
}
return common_1.format(messages[key], args);
}
else {
if (isString(message)) {
console.warn("Message " + message + " didn't get externalized correctly.");
return common_1.format(message, args);
}
else {
console.error("Broken localize call found. Stacktrace is\n: " + new Error('').stack);
}
}
};
}
function resolveLanguage(file) {
var resolvedLanguage;
if (options.cacheLanguageResolution && resolvedLanguage) {
resolvedLanguage = resolvedLanguage;
}
else {
if (common_1.isPseudo || !options.language) {
resolvedLanguage = '.nls.json';
}
else {
var locale = options.language;
while (locale) {
var candidate = '.nls.' + locale + '.json';
if (fs.existsSync(file + candidate)) {
resolvedLanguage = candidate;
break;
}
else {
var index = locale.lastIndexOf('-');
if (index > 0) {
locale = locale.substring(0, index);
}
else {
resolvedLanguage = '.nls.json';
locale = null;
}
}
}
}
if (options.cacheLanguageResolution) {
resolvedLanguage = resolvedLanguage;
}
}
return file + resolvedLanguage;
}
function findInTheBoxBundle(root) {
var language = options.language;
while (language) {
var candidate = path.join(root, "nls.bundle." + language + ".json");
if (fs.existsSync(candidate)) {
return candidate;
}
else {
var index = language.lastIndexOf('-');
if (index > 0) {
language = language.substring(0, index);
}
else {
language = undefined;
}
}
}
// Test if we can reslove the default bundle.
if (language === undefined) {
var candidate = path.join(root, 'nls.bundle.json');
if (fs.existsSync(candidate)) {
return candidate;
}
}
return undefined;
}
function mkdir(directory) {
try {
fs.mkdirSync(directory);
}
catch (err) {
if (err.code === 'EEXIST') {
return;
}
else if (err.code === 'ENOENT') {
var parent = path.dirname(directory);
if (parent !== directory) {
mkdir(parent);
fs.mkdirSync(directory);
}
}
else {
throw err;
}
}
}
function createDefaultNlsBundle(folder) {
var metaData = readJsonFileSync(path.join(folder, 'nls.metadata.json'));
var result = Object.create(null);
for (var module_1 in metaData) {
var entry = metaData[module_1];
result[module_1] = entry.messages;
}
return result;
}
function createNLSBundle(header, metaDataPath) {
var languagePackLocation = options.translationsConfig[header.id];
if (!languagePackLocation) {
return undefined;
}
var languagePack = readJsonFileSync(languagePackLocation).contents;
var metaData = readJsonFileSync(path.join(metaDataPath, 'nls.metadata.json'));
var result = Object.create(null);
for (var module_2 in metaData) {
var entry = metaData[module_2];
var translations = languagePack[header.outDir + "/" + module_2];
if (translations) {
var resultMessages = [];
for (var i = 0; i < entry.keys.length; i++) {
var messageKey = entry.keys[i];
var key = isString(messageKey) ? messageKey : messageKey.key;
var translatedMessage = translations[key];
if (translatedMessage === undefined) {
translatedMessage = entry.messages[i];
}
resultMessages.push(translatedMessage);
}
result[module_2] = resultMessages;
}
else {
result[module_2] = entry.messages;
}
}
return result;
}
function touch(file) {
var d = new Date();
fs.utimes(file, d, d, function () {
// Do nothing. Ignore
});
}
function cacheBundle(key, bundle) {
resolvedBundles[key] = bundle;
return bundle;
}
function loadNlsBundleOrCreateFromI18n(header, bundlePath) {
var result;
var bundle = path.join(options.cacheRoot, header.id + "-" + header.hash + ".json");
var useMemoryOnly = false;
var writeBundle = false;
try {
result = JSON.parse(fs.readFileSync(bundle, { encoding: 'utf8', flag: 'r' }));
touch(bundle);
return result;
}
catch (err) {
if (err.code === 'ENOENT') {
writeBundle = true;
}
else if (err instanceof SyntaxError) {
// We have a syntax error. So no valid JSON. Use
console.log("Syntax error parsing message bundle: " + err.message + ".");
fs.unlink(bundle, function (err) {
if (err) {
console.error("Deleting corrupted bundle " + bundle + " failed.");
}
});
useMemoryOnly = true;
}
else {
throw err;
}
}
result = createNLSBundle(header, bundlePath);
if (!result || useMemoryOnly) {
return result;
}
if (writeBundle) {
try {
fs.writeFileSync(bundle, JSON.stringify(result), { encoding: 'utf8', flag: 'wx' });
}
catch (err) {
if (err.code === 'EEXIST') {
return result;
}
throw err;
}
}
return result;
}
function loadDefaultNlsBundle(bundlePath) {
try {
return createDefaultNlsBundle(bundlePath);
}
catch (err) {
console.log("Generating default bundle from meta data failed.", err);
return undefined;
}
}
function loadNlsBundle(header, bundlePath) {
var result;
// Core decided to use a language pack. Do the same in the extension
if (supportsLanguagePack()) {
try {
result = loadNlsBundleOrCreateFromI18n(header, bundlePath);
}
catch (err) {
console.log("Load or create bundle failed ", err);
}
}
if (!result) {
// No language pack found, but core is running in language pack mode
// Don't try to use old in the box bundles since the might be stale
// Fall right back to the default bundle.
if (options.languagePackSupport) {
return loadDefaultNlsBundle(bundlePath);
}
var candidate = findInTheBoxBundle(bundlePath);
if (candidate) {
try {
return readJsonFileSync(candidate);
}
catch (err) {
console.log("Loading in the box message bundle failed.", err);
}
}
result = loadDefaultNlsBundle(bundlePath);
}
return result;
}
function tryFindMetaDataHeaderFile(file) {
var result;
var dirname = path.dirname(file);
while (true) {
result = path.join(dirname, 'nls.metadata.header.json');
if (fs.existsSync(result)) {
break;
}
var parent = path.dirname(dirname);
if (parent === dirname) {
result = undefined;
break;
}
else {
dirname = parent;
}
}
return result;
}
function loadMessageBundle(file) {
if (!file) {
// No file. We are in dev mode. Return the default
// localize function.
return common_1.localize;
}
// Remove extension since we load json files.
var ext = path.extname(file);
if (ext) {
file = file.substr(0, file.length - ext.length);
}
if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.bundle) {
var headerFile = tryFindMetaDataHeaderFile(file);
if (headerFile) {
var bundlePath = path.dirname(headerFile);
var bundle = resolvedBundles[bundlePath];
if (bundle === undefined) {
try {
var header = JSON.parse(fs.readFileSync(headerFile, 'utf8'));
try {
var nlsBundle = loadNlsBundle(header, bundlePath);
bundle = cacheBundle(bundlePath, nlsBundle ? { header: header, nlsBundle: nlsBundle } : null);
}
catch (err) {
console.error('Failed to load nls bundle', err);
bundle = cacheBundle(bundlePath, null);
}
}
catch (err) {
console.error('Failed to read header file', err);
bundle = cacheBundle(bundlePath, null);
}
}
if (bundle) {
var module_3 = file.substr(bundlePath.length + 1).replace(/\\/g, '/');
var messages = bundle.nlsBundle[module_3];
if (messages === undefined) {
console.error("Messages for file " + file + " not found. See console for details.");
return function () {
return 'Messages not found.';
};
}
return createScopedLocalizeFunction(messages);
}
}
}
if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.file) {
// Try to load a single file bundle
try {
var json = readJsonFileSync(resolveLanguage(file));
if (Array.isArray(json)) {
return createScopedLocalizeFunction(json);
}
else {
if (common_1.isDefined(json.messages) && common_1.isDefined(json.keys)) {
return createScopedLocalizeFunction(json.messages);
}
else {
console.error("String bundle '" + file + "' uses an unsupported format.");
return function () {
return 'File bundle has unsupported format. See console for details';
};
}
}
}
catch (err) {
if (err.code !== 'ENOENT') {
console.error('Failed to load single file bundle', err);
}
}
}
console.error("Failed to load message bundle for file " + file);
return function () {
return 'Failed to load message bundle. See console for details.';
};
}
exports.loadMessageBundle = loadMessageBundle;
function config(opts) {
if (opts) {
if (isString(opts.locale)) {
options.locale = opts.locale.toLowerCase();
options.language = options.locale;
resolvedBundles = Object.create(null);
}
if (opts.messageFormat !== undefined) {
options.messageFormat = opts.messageFormat;
}
if (opts.bundleFormat === common_1.BundleFormat.standalone && options.languagePackSupport === true) {
options.languagePackSupport = false;
}
}
common_1.setPseudo(options.locale === 'pseudo');
return loadMessageBundle;
}
exports.config = config;
ral_1.default.install(Object.freeze({
loadMessageBundle: loadMessageBundle,
config: config
}));
//# sourceMappingURL=main.js.map
/***/ }),
/* 78 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
var _ral;
function RAL() {
if (_ral === undefined) {
throw new Error("No runtime abstraction layer installed");
}
return _ral;
}
(function (RAL) {
function install(ral) {
if (ral === undefined) {
throw new Error("No runtime abstraction layer provided");
}
_ral = ral;
}
RAL.install = install;
})(RAL || (RAL = {}));
exports.default = RAL;
//# sourceMappingURL=ral.js.map
/***/ }),
/* 79 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.config = exports.loadMessageBundle = exports.localize = exports.format = exports.setPseudo = exports.isPseudo = exports.isDefined = exports.BundleFormat = exports.MessageFormat = void 0;
var ral_1 = __webpack_require__(78);
var MessageFormat;
(function (MessageFormat) {
MessageFormat["file"] = "file";
MessageFormat["bundle"] = "bundle";
MessageFormat["both"] = "both";
})(MessageFormat = exports.MessageFormat || (exports.MessageFormat = {}));
var BundleFormat;
(function (BundleFormat) {
// the nls.bundle format
BundleFormat["standalone"] = "standalone";
BundleFormat["languagePack"] = "languagePack";
})(BundleFormat = exports.BundleFormat || (exports.BundleFormat = {}));
var LocalizeInfo;
(function (LocalizeInfo) {
function is(value) {
var candidate = value;
return candidate && isDefined(candidate.key) && isDefined(candidate.comment);
}
LocalizeInfo.is = is;
})(LocalizeInfo || (LocalizeInfo = {}));
function isDefined(value) {
return typeof value !== 'undefined';
}
exports.isDefined = isDefined;
exports.isPseudo = false;
function setPseudo(pseudo) {
exports.isPseudo = pseudo;
}
exports.setPseudo = setPseudo;
function format(message, args) {
var result;
if (exports.isPseudo) {
// FF3B and FF3D is the Unicode zenkaku representation for [ and ]
message = '\uFF3B' + message.replace(/[aouei]/g, '$&$&') + '\uFF3D';
}
if (args.length === 0) {
result = message;
}
else {
result = message.replace(/\{(\d+)\}/g, function (match, rest) {
var index = rest[0];
var arg = args[index];
var replacement = match;
if (typeof arg === 'string') {
replacement = arg;
}
else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) {
replacement = String(arg);
}
return replacement;
});
}
return result;
}
exports.format = format;
function localize(_key, message) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
return format(message, args);
}
exports.localize = localize;
function loadMessageBundle(file) {
return ral_1.default().loadMessageBundle(file);
}
exports.loadMessageBundle = loadMessageBundle;
function config(opts) {
return ral_1.default().config(opts);
}
exports.config = config;
//# sourceMappingURL=common.js.map
/***/ }),
/* 80 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "browserNames": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.browserNames,
/* harmony export */ "getBrowserLabel": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.getBrowserLabel,
/* harmony export */ "getEntryDescription": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.getEntryDescription,
/* harmony export */ "textToMarkedString": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.textToMarkedString,
/* harmony export */ "colorFrom256RGB": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFrom256RGB,
/* harmony export */ "colorFromHSL": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFromHSL,
/* harmony export */ "colorFromHex": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFromHex,
/* harmony export */ "colorFunctions": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFunctions,
/* harmony export */ "colorKeywords": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorKeywords,
/* harmony export */ "colors": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colors,
/* harmony export */ "getColorValue": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getColorValue,
/* harmony export */ "hexDigit": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.hexDigit,
/* harmony export */ "hslFromColor": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.hslFromColor,
/* harmony export */ "isColorConstructor": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.isColorConstructor,
/* harmony export */ "isColorValue": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.isColorValue,
/* harmony export */ "basicShapeFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions,
/* harmony export */ "boxKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.boxKeywords,
/* harmony export */ "cssWideKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords,
/* harmony export */ "geometryBoxKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords,
/* harmony export */ "html5Tags": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.html5Tags,
/* harmony export */ "imageFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.imageFunctions,
/* harmony export */ "lineStyleKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords,
/* harmony export */ "lineWidthKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.lineWidthKeywords,
/* harmony export */ "pageBoxDirectives": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.pageBoxDirectives,
/* harmony export */ "positionKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.positionKeywords,
/* harmony export */ "repeatStyleKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords,
/* harmony export */ "svgElements": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.svgElements,
/* harmony export */ "transitionTimingFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions,
/* harmony export */ "units": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.units
/* harmony export */ });
/* harmony import */ var _entry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(82);
/* harmony import */ var _builtinData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(83);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/***/ }),
/* 81 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "browserNames": () => /* binding */ browserNames,
/* harmony export */ "getEntryDescription": () => /* binding */ getEntryDescription,
/* harmony export */ "textToMarkedString": () => /* binding */ textToMarkedString,
/* harmony export */ "getBrowserLabel": () => /* binding */ getBrowserLabel
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var browserNames = {
E: 'Edge',
FF: 'Firefox',
S: 'Safari',
C: 'Chrome',
IE: 'IE',
O: 'Opera'
};
function getEntryStatus(status) {
switch (status) {
case 'experimental':
return '⚠️ Property is experimental. Be cautious when using it.️\n\n';
case 'nonstandard':
return '🚨️ Property is nonstandard. Avoid using it.\n\n';
case 'obsolete':
return '🚨️️️ Property is obsolete. Avoid using it.\n\n';
default:
return '';
}
}
function getEntryDescription(entry, doesSupportMarkdown, settings) {
var result;
if (doesSupportMarkdown) {
result = {
kind: 'markdown',
value: getEntryMarkdownDescription(entry, settings)
};
}
else {
result = {
kind: 'plaintext',
value: getEntryStringDescription(entry, settings)
};
}
if (result.value === '') {
return undefined;
}
return result;
}
function textToMarkedString(text) {
text = text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
return text.replace(//g, '>');
}
function getEntryStringDescription(entry, settings) {
if (!entry.description || entry.description === '') {
return '';
}
if (typeof entry.description !== 'string') {
return entry.description.value;
}
var result = '';
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
if (entry.status) {
result += getEntryStatus(entry.status);
}
result += entry.description;
var browserLabel = getBrowserLabel(entry.browsers);
if (browserLabel) {
result += '\n(' + browserLabel + ')';
}
if ('syntax' in entry) {
result += "\n\nSyntax: " + entry.syntax;
}
}
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
if (result.length > 0) {
result += '\n\n';
}
result += entry.references.map(function (r) {
return r.name + ": " + r.url;
}).join(' | ');
}
return result;
}
function getEntryMarkdownDescription(entry, settings) {
if (!entry.description || entry.description === '') {
return '';
}
var result = '';
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) {
if (entry.status) {
result += getEntryStatus(entry.status);
}
var description = typeof entry.description === 'string' ? entry.description : entry.description.value;
result += textToMarkedString(description);
var browserLabel = getBrowserLabel(entry.browsers);
if (browserLabel) {
result += '\n\n(' + textToMarkedString(browserLabel) + ')';
}
if ('syntax' in entry && entry.syntax) {
result += "\n\nSyntax: " + textToMarkedString(entry.syntax);
}
}
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) {
if (result.length > 0) {
result += '\n\n';
}
result += entry.references.map(function (r) {
return "[" + r.name + "](" + r.url + ")";
}).join(' | ');
}
return result;
}
/**
* Input is like `["E12","FF49","C47","IE","O"]`
* Output is like `Edge 12, Firefox 49, Chrome 47, IE, Opera`
*/
function getBrowserLabel(browsers) {
if (browsers === void 0) { browsers = []; }
if (browsers.length === 0) {
return null;
}
return browsers
.map(function (b) {
var result = '';
var matches = b.match(/([A-Z]+)(\d+)?/);
var name = matches[1];
var version = matches[2];
if (name in browserNames) {
result += browserNames[name];
}
if (version) {
result += ' ' + version;
}
return result;
})
.join(', ');
}
/***/ }),
/* 82 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "colorFunctions": () => /* binding */ colorFunctions,
/* harmony export */ "colors": () => /* binding */ colors,
/* harmony export */ "colorKeywords": () => /* binding */ colorKeywords,
/* harmony export */ "isColorConstructor": () => /* binding */ isColorConstructor,
/* harmony export */ "isColorValue": () => /* binding */ isColorValue,
/* harmony export */ "hexDigit": () => /* binding */ hexDigit,
/* harmony export */ "colorFromHex": () => /* binding */ colorFromHex,
/* harmony export */ "colorFrom256RGB": () => /* binding */ colorFrom256RGB,
/* harmony export */ "colorFromHSL": () => /* binding */ colorFromHSL,
/* harmony export */ "hslFromColor": () => /* binding */ hslFromColor,
/* harmony export */ "getColorValue": () => /* binding */ getColorValue
/* harmony export */ });
/* harmony import */ var _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74);
/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(77);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_1__.loadMessageBundle();
var colorFunctions = [
{ func: 'rgb($red, $green, $blue)', desc: localize('css.builtin.rgb', 'Creates a Color from red, green, and blue values.') },
{ func: 'rgba($red, $green, $blue, $alpha)', desc: localize('css.builtin.rgba', 'Creates a Color from red, green, blue, and alpha values.') },
{ func: 'hsl($hue, $saturation, $lightness)', desc: localize('css.builtin.hsl', 'Creates a Color from hue, saturation, and lightness values.') },
{ func: 'hsla($hue, $saturation, $lightness, $alpha)', desc: localize('css.builtin.hsla', 'Creates a Color from hue, saturation, lightness, and alpha values.') }
];
var colors = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgrey: '#a9a9a9',
darkgreen: '#006400',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkslategrey: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dimgrey: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
grey: '#808080',
green: '#008000',
greenyellow: '#adff2f',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
indianred: '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgray: '#d3d3d3',
lightgrey: '#d3d3d3',
lightgreen: '#90ee90',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightslategrey: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370d8',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#d87093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
red: '#ff0000',
rebeccapurple: '#663399',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
slategrey: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32'
};
var colorKeywords = {
'currentColor': 'The value of the \'color\' property. The computed value of the \'currentColor\' keyword is the computed value of the \'color\' property. If the \'currentColor\' keyword is set on the \'color\' property itself, it is treated as \'color:inherit\' at parse time.',
'transparent': 'Fully transparent. This keyword can be considered a shorthand for rgba(0,0,0,0) which is its computed value.',
};
function getNumericValue(node, factor) {
var val = node.getText();
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/);
if (m) {
if (m[2]) {
factor = 100.0;
}
var result = parseFloat(m[1]) / factor;
if (result >= 0 && result <= 1) {
return result;
}
}
throw new Error();
}
function getAngle(node) {
var val = node.getText();
var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg)?$/);
if (m) {
return parseFloat(val) % 360;
}
throw new Error();
}
function isColorConstructor(node) {
var name = node.getName();
if (!name) {
return false;
}
return /^(rgb|rgba|hsl|hsla)$/gi.test(name);
}
/**
* Returns true if the node is a color value - either
* defined a hex number, as rgb or rgba function, or
* as color name.
*/
function isColorValue(node) {
if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.HexColorValue) {
return true;
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Function) {
return isColorConstructor(node);
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Identifier) {
if (node.parent && node.parent.type !== _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) {
return false;
}
var candidateColor = node.getText().toLowerCase();
if (candidateColor === 'none') {
return false;
}
if (colors[candidateColor]) {
return true;
}
}
return false;
}
var Digit0 = 48;
var Digit9 = 57;
var A = 65;
var F = 70;
var a = 97;
var f = 102;
function hexDigit(charCode) {
if (charCode < Digit0) {
return 0;
}
if (charCode <= Digit9) {
return charCode - Digit0;
}
if (charCode < a) {
charCode += (a - A);
}
if (charCode >= a && charCode <= f) {
return charCode - a + 10;
}
return 0;
}
function colorFromHex(text) {
if (text[0] !== '#') {
return null;
}
switch (text.length) {
case 4:
return {
red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
alpha: 1
};
case 5:
return {
red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0,
green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0,
blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0,
alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0,
};
case 7:
return {
red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
alpha: 1
};
case 9:
return {
red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0,
green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0,
blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0,
alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0
};
}
return null;
}
function colorFrom256RGB(red, green, blue, alpha) {
if (alpha === void 0) { alpha = 1.0; }
return {
red: red / 255.0,
green: green / 255.0,
blue: blue / 255.0,
alpha: alpha
};
}
function colorFromHSL(hue, sat, light, alpha) {
if (alpha === void 0) { alpha = 1.0; }
hue = hue / 60.0;
if (sat === 0) {
return { red: light, green: light, blue: light, alpha: alpha };
}
else {
var hueToRgb = function (t1, t2, hue) {
while (hue < 0) {
hue += 6;
}
while (hue >= 6) {
hue -= 6;
}
if (hue < 1) {
return (t2 - t1) * hue + t1;
}
if (hue < 3) {
return t2;
}
if (hue < 4) {
return (t2 - t1) * (4 - hue) + t1;
}
return t1;
};
var t2 = light <= 0.5 ? (light * (sat + 1)) : (light + sat - (light * sat));
var t1 = light * 2 - t2;
return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha: alpha };
}
}
function hslFromColor(rgba) {
var r = rgba.red;
var g = rgba.green;
var b = rgba.blue;
var a = rgba.alpha;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h = 0;
var s = 0;
var l = (min + max) / 2;
var chroma = max - min;
if (chroma > 0) {
s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1);
switch (max) {
case r:
h = (g - b) / chroma + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / chroma + 2;
break;
case b:
h = (r - g) / chroma + 4;
break;
}
h *= 60;
h = Math.round(h);
}
return { h: h, s: s, l: l, a: a };
}
function getColorValue(node) {
if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.HexColorValue) {
var text = node.getText();
return colorFromHex(text);
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Function) {
var functionNode = node;
var name = functionNode.getName();
var colorValues = functionNode.getArguments().getChildren();
if (!name || colorValues.length < 3 || colorValues.length > 4) {
return null;
}
try {
var alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1;
if (name === 'rgb' || name === 'rgba') {
return {
red: getNumericValue(colorValues[0], 255.0),
green: getNumericValue(colorValues[1], 255.0),
blue: getNumericValue(colorValues[2], 255.0),
alpha: alpha
};
}
else if (name === 'hsl' || name === 'hsla') {
var h = getAngle(colorValues[0]);
var s = getNumericValue(colorValues[1], 100.0);
var l = getNumericValue(colorValues[2], 100.0);
return colorFromHSL(h, s, l, alpha);
}
}
catch (e) {
// parse error on numeric value
return null;
}
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Identifier) {
if (node.parent && node.parent.type !== _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) {
return null;
}
var term = node.parent;
if (term && term.parent && term.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.BinaryExpression) {
var expression = term.parent;
if (expression.parent && expression.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ListEntry && expression.parent.key === expression) {
return null;
}
}
var candidateColor = node.getText().toLowerCase();
if (candidateColor === 'none') {
return null;
}
var colorHex = colors[candidateColor];
if (colorHex) {
return colorFromHex(colorHex);
}
}
return null;
}
/***/ }),
/* 83 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "positionKeywords": () => /* binding */ positionKeywords,
/* harmony export */ "repeatStyleKeywords": () => /* binding */ repeatStyleKeywords,
/* harmony export */ "lineStyleKeywords": () => /* binding */ lineStyleKeywords,
/* harmony export */ "lineWidthKeywords": () => /* binding */ lineWidthKeywords,
/* harmony export */ "boxKeywords": () => /* binding */ boxKeywords,
/* harmony export */ "geometryBoxKeywords": () => /* binding */ geometryBoxKeywords,
/* harmony export */ "cssWideKeywords": () => /* binding */ cssWideKeywords,
/* harmony export */ "imageFunctions": () => /* binding */ imageFunctions,
/* harmony export */ "transitionTimingFunctions": () => /* binding */ transitionTimingFunctions,
/* harmony export */ "basicShapeFunctions": () => /* binding */ basicShapeFunctions,
/* harmony export */ "units": () => /* binding */ units,
/* harmony export */ "html5Tags": () => /* binding */ html5Tags,
/* harmony export */ "svgElements": () => /* binding */ svgElements,
/* harmony export */ "pageBoxDirectives": () => /* binding */ pageBoxDirectives
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var positionKeywords = {
'bottom': 'Computes to ‘100%’ for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.',
'center': 'Computes to ‘50%’ (‘left 50%’) for the horizontal position if the horizontal position is not otherwise specified, or ‘50%’ (‘top 50%’) for the vertical position if it is.',
'left': 'Computes to ‘0%’ for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset.',
'right': 'Computes to ‘100%’ for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset.',
'top': 'Computes to ‘0%’ for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset.'
};
var repeatStyleKeywords = {
'no-repeat': 'Placed once and not repeated in this direction.',
'repeat': 'Repeated in this direction as often as needed to cover the background painting area.',
'repeat-x': 'Computes to ‘repeat no-repeat’.',
'repeat-y': 'Computes to ‘no-repeat repeat’.',
'round': 'Repeated as often as will fit within the background positioning area. If it doesn’t fit a whole number of times, it is rescaled so that it does.',
'space': 'Repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area.'
};
var lineStyleKeywords = {
'dashed': 'A series of square-ended dashes.',
'dotted': 'A series of round dots.',
'double': 'Two parallel solid lines with some space between them.',
'groove': 'Looks as if it were carved in the canvas.',
'hidden': 'Same as ‘none’, but has different behavior in the border conflict resolution rules for border-collapsed tables.',
'inset': 'Looks as if the content on the inside of the border is sunken into the canvas.',
'none': 'No border. Color and width are ignored.',
'outset': 'Looks as if the content on the inside of the border is coming out of the canvas.',
'ridge': 'Looks as if it were coming out of the canvas.',
'solid': 'A single line segment.'
};
var lineWidthKeywords = ['medium', 'thick', 'thin'];
var boxKeywords = {
'border-box': 'The background is painted within (clipped to) the border box.',
'content-box': 'The background is painted within (clipped to) the content box.',
'padding-box': 'The background is painted within (clipped to) the padding box.'
};
var geometryBoxKeywords = {
'margin-box': 'Uses the margin box as reference box.',
'fill-box': 'Uses the object bounding box as reference box.',
'stroke-box': 'Uses the stroke bounding box as reference box.',
'view-box': 'Uses the nearest SVG viewport as reference box.'
};
var cssWideKeywords = {
'initial': 'Represents the value specified as the property’s initial value.',
'inherit': 'Represents the computed value of the property on the element’s parent.',
'unset': 'Acts as either `inherit` or `initial`, depending on whether the property is inherited or not.'
};
var imageFunctions = {
'url()': 'Reference an image file by URL',
'image()': 'Provide image fallbacks and annotations.',
'-webkit-image-set()': 'Provide multiple resolutions. Remember to use unprefixed image-set() in addition.',
'image-set()': 'Provide multiple resolutions of an image and const the UA decide which is most appropriate in a given situation.',
'-moz-element()': 'Use an element in the document as an image. Remember to use unprefixed element() in addition.',
'element()': 'Use an element in the document as an image.',
'cross-fade()': 'Indicates the two images to be combined and how far along in the transition the combination is.',
'-webkit-gradient()': 'Deprecated. Use modern linear-gradient() or radial-gradient() instead.',
'-webkit-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.',
'-moz-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.',
'-o-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.',
'linear-gradient()': 'A linear gradient is created by specifying a straight gradient line, and then several colors placed along that line.',
'-webkit-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.',
'-moz-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.',
'-o-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.',
'repeating-linear-gradient()': 'Same as linear-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.',
'-webkit-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.',
'-moz-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.',
'radial-gradient()': 'Colors emerge from a single point and smoothly spread outward in a circular or elliptical shape.',
'-webkit-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.',
'-moz-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.',
'repeating-radial-gradient()': 'Same as radial-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.'
};
var transitionTimingFunctions = {
'ease': 'Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).',
'ease-in': 'Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).',
'ease-in-out': 'Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0).',
'ease-out': 'Equivalent to cubic-bezier(0, 0, 0.58, 1.0).',
'linear': 'Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).',
'step-end': 'Equivalent to steps(1, end).',
'step-start': 'Equivalent to steps(1, start).',
'steps()': 'The first parameter specifies the number of intervals in the function. The second parameter, which is optional, is either the value “start” or “end”.',
'cubic-bezier()': 'Specifies a cubic-bezier curve. The four values specify points P1 and P2 of the curve as (x1, y1, x2, y2).',
'cubic-bezier(0.6, -0.28, 0.735, 0.045)': 'Ease-in Back. Overshoots.',
'cubic-bezier(0.68, -0.55, 0.265, 1.55)': 'Ease-in-out Back. Overshoots.',
'cubic-bezier(0.175, 0.885, 0.32, 1.275)': 'Ease-out Back. Overshoots.',
'cubic-bezier(0.6, 0.04, 0.98, 0.335)': 'Ease-in Circular. Based on half circle.',
'cubic-bezier(0.785, 0.135, 0.15, 0.86)': 'Ease-in-out Circular. Based on half circle.',
'cubic-bezier(0.075, 0.82, 0.165, 1)': 'Ease-out Circular. Based on half circle.',
'cubic-bezier(0.55, 0.055, 0.675, 0.19)': 'Ease-in Cubic. Based on power of three.',
'cubic-bezier(0.645, 0.045, 0.355, 1)': 'Ease-in-out Cubic. Based on power of three.',
'cubic-bezier(0.215, 0.610, 0.355, 1)': 'Ease-out Cubic. Based on power of three.',
'cubic-bezier(0.95, 0.05, 0.795, 0.035)': 'Ease-in Exponential. Based on two to the power ten.',
'cubic-bezier(1, 0, 0, 1)': 'Ease-in-out Exponential. Based on two to the power ten.',
'cubic-bezier(0.19, 1, 0.22, 1)': 'Ease-out Exponential. Based on two to the power ten.',
'cubic-bezier(0.47, 0, 0.745, 0.715)': 'Ease-in Sine.',
'cubic-bezier(0.445, 0.05, 0.55, 0.95)': 'Ease-in-out Sine.',
'cubic-bezier(0.39, 0.575, 0.565, 1)': 'Ease-out Sine.',
'cubic-bezier(0.55, 0.085, 0.68, 0.53)': 'Ease-in Quadratic. Based on power of two.',
'cubic-bezier(0.455, 0.03, 0.515, 0.955)': 'Ease-in-out Quadratic. Based on power of two.',
'cubic-bezier(0.25, 0.46, 0.45, 0.94)': 'Ease-out Quadratic. Based on power of two.',
'cubic-bezier(0.895, 0.03, 0.685, 0.22)': 'Ease-in Quartic. Based on power of four.',
'cubic-bezier(0.77, 0, 0.175, 1)': 'Ease-in-out Quartic. Based on power of four.',
'cubic-bezier(0.165, 0.84, 0.44, 1)': 'Ease-out Quartic. Based on power of four.',
'cubic-bezier(0.755, 0.05, 0.855, 0.06)': 'Ease-in Quintic. Based on power of five.',
'cubic-bezier(0.86, 0, 0.07, 1)': 'Ease-in-out Quintic. Based on power of five.',
'cubic-bezier(0.23, 1, 0.320, 1)': 'Ease-out Quintic. Based on power of five.'
};
var basicShapeFunctions = {
'circle()': 'Defines a circle.',
'ellipse()': 'Defines an ellipse.',
'inset()': 'Defines an inset rectangle.',
'polygon()': 'Defines a polygon.'
};
var units = {
'length': ['em', 'rem', 'ex', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vw', 'vh', 'vmin', 'vmax'],
'angle': ['deg', 'rad', 'grad', 'turn'],
'time': ['ms', 's'],
'frequency': ['Hz', 'kHz'],
'resolution': ['dpi', 'dpcm', 'dppx'],
'percentage': ['%', 'fr']
};
var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption',
'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer',
'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link',
'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q',
'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td',
'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'const', 'video', 'wbr'];
var svgElements = ['circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology',
'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'foreignObject', 'g', 'hatch', 'hatchpath', 'image', 'line', 'linearGradient',
'marker', 'mask', 'mesh', 'meshpatch', 'meshrow', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'solidcolor', 'stop', 'svg', 'switch',
'symbol', 'text', 'textPath', 'tspan', 'use', 'view'];
var pageBoxDirectives = [
'@bottom-center', '@bottom-left', '@bottom-left-corner', '@bottom-right', '@bottom-right-corner',
'@left-bottom', '@left-middle', '@left-top', '@right-bottom', '@right-middle', '@right-top',
'@top-center', '@top-left', '@top-left-corner', '@top-right', '@top-right-corner'
];
/***/ }),
/* 84 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "values": () => /* binding */ values,
/* harmony export */ "isDefined": () => /* binding */ isDefined
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function values(obj) {
return Object.keys(obj).map(function (key) { return obj[key]; });
}
function isDefined(obj) {
return typeof obj !== 'undefined';
}
/***/ }),
/* 85 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "CSSCompletion": () => /* binding */ CSSCompletion
/* harmony export */ });
/* harmony import */ var _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74);
/* harmony import */ var _parser_cssSymbolScope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86);
/* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(80);
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(75);
/* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88);
/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(77);
/* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84);
/* harmony import */ var _pathCompletion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_5__.loadMessageBundle();
var SnippetFormat = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.InsertTextFormat.Snippet;
var SortTexts;
(function (SortTexts) {
// char code 32, comes before everything
SortTexts["Enums"] = " ";
SortTexts["Normal"] = "d";
SortTexts["VendorPrefixed"] = "x";
SortTexts["Term"] = "y";
SortTexts["Variable"] = "z";
})(SortTexts || (SortTexts = {}));
var CSSCompletion = /** @class */ (function () {
function CSSCompletion(variablePrefix, lsOptions, cssDataManager) {
if (variablePrefix === void 0) { variablePrefix = null; }
this.variablePrefix = variablePrefix;
this.lsOptions = lsOptions;
this.cssDataManager = cssDataManager;
this.completionParticipants = [];
}
CSSCompletion.prototype.configure = function (settings) {
this.settings = settings;
};
CSSCompletion.prototype.getSymbolContext = function () {
if (!this.symbolContext) {
this.symbolContext = new _parser_cssSymbolScope__WEBPACK_IMPORTED_MODULE_1__.Symbols(this.styleSheet);
}
return this.symbolContext;
};
CSSCompletion.prototype.setCompletionParticipants = function (registeredCompletionParticipants) {
this.completionParticipants = registeredCompletionParticipants || [];
};
CSSCompletion.prototype.doComplete2 = function (document, position, styleSheet, documentContext) {
return __awaiter(this, void 0, void 0, function () {
var participant, contributedParticipants, result, pathCompletionResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) {
return [2 /*return*/, this.doComplete(document, position, styleSheet)];
}
participant = new _pathCompletion__WEBPACK_IMPORTED_MODULE_7__.PathCompletionParticipant(this.lsOptions.fileSystemProvider.readDirectory);
contributedParticipants = this.completionParticipants;
this.completionParticipants = [participant].concat(contributedParticipants);
result = this.doComplete(document, position, styleSheet);
_a.label = 1;
case 1:
_a.trys.push([1, , 3, 4]);
return [4 /*yield*/, participant.computeCompletions(document, documentContext)];
case 2:
pathCompletionResult = _a.sent();
return [2 /*return*/, {
isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete,
items: pathCompletionResult.items.concat(result.items)
}];
case 3:
this.completionParticipants = contributedParticipants;
return [7 /*endfinally*/];
case 4: return [2 /*return*/];
}
});
});
};
CSSCompletion.prototype.doComplete = function (document, position, styleSheet) {
this.offset = document.offsetAt(position);
this.position = position;
this.currentWord = getCurrentWord(document, this.offset);
this.defaultReplaceRange = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Range.create(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Position.create(this.position.line, this.position.character - this.currentWord.length), this.position);
this.textDocument = document;
this.styleSheet = styleSheet;
try {
var result = { isIncomplete: false, items: [] };
this.nodePath = _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.getNodePath(this.styleSheet, this.offset);
for (var i = this.nodePath.length - 1; i >= 0; i--) {
var node = this.nodePath[i];
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Property) {
this.getCompletionsForDeclarationProperty(node.getParent(), result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Expression) {
if (node.parent instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Interpolation) {
this.getVariableProposals(null, result);
}
else {
this.getCompletionsForExpression(node, result);
}
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SimpleSelector) {
var parentRef = node.findAParent(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Ruleset);
if (parentRef) {
if (parentRef.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference) {
this.getCompletionsForExtendsReference(parentRef, node, result);
}
else {
var parentRuleSet = parentRef;
this.getCompletionsForSelector(parentRuleSet, parentRuleSet && parentRuleSet.isNested(), result);
}
}
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument) {
this.getCompletionsForFunctionArgument(node, node.getParent(), result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declarations) {
this.getCompletionsForDeclarations(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.VariableDeclaration) {
this.getCompletionsForVariableDeclaration(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) {
this.getCompletionsForRuleSet(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Interpolation) {
this.getCompletionsForInterpolation(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionDeclaration) {
this.getCompletionsForFunctionDeclaration(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.MixinReference) {
this.getCompletionsForMixinReference(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function) {
this.getCompletionsForFunctionArgument(null, node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Supports) {
this.getCompletionsForSupports(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) {
this.getCompletionsForSupportsCondition(node, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ExtendsReference) {
this.getCompletionsForExtendsReference(node, null, result);
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.URILiteral) {
this.getCompletionForUriLiteralValue(node, result);
}
else if (node.parent === null) {
this.getCompletionForTopLevel(result);
}
else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.StringLiteral && this.isImportPathParent(node.parent.type)) {
this.getCompletionForImportPath(node, result);
// } else if (node instanceof nodes.Variable) {
// this.getCompletionsForVariableDeclaration()
}
else {
continue;
}
if (result.items.length > 0 || this.offset > node.offset) {
return this.finalize(result);
}
}
this.getCompletionsForStylesheet(result);
if (result.items.length === 0) {
if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) {
this.getVariableProposals(null, result);
}
}
return this.finalize(result);
}
finally {
// don't hold on any state, clear symbolContext
this.position = null;
this.currentWord = null;
this.textDocument = null;
this.styleSheet = null;
this.symbolContext = null;
this.defaultReplaceRange = null;
this.nodePath = null;
}
};
CSSCompletion.prototype.isImportPathParent = function (type) {
return type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Import;
};
CSSCompletion.prototype.finalize = function (result) {
return result;
};
CSSCompletion.prototype.findInNodePath = function () {
var types = [];
for (var _i = 0; _i < arguments.length; _i++) {
types[_i] = arguments[_i];
}
for (var i = this.nodePath.length - 1; i >= 0; i--) {
var node = this.nodePath[i];
if (types.indexOf(node.type) !== -1) {
return node;
}
}
return null;
};
CSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) {
return this.getPropertyProposals(declaration, result);
};
CSSCompletion.prototype.getPropertyProposals = function (declaration, result) {
var _this = this;
var triggerPropertyValueCompletion = this.isTriggerPropertyValueCompletionEnabled;
var completePropertyWithSemicolon = this.isCompletePropertyWithSemicolonEnabled;
var properties = this.cssDataManager.getProperties();
properties.forEach(function (entry) {
var range;
var insertText;
var retrigger = false;
if (declaration) {
range = _this.getCompletionRange(declaration.getProperty());
insertText = entry.name;
if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition)) {
insertText += ': ';
retrigger = true;
}
}
else {
range = _this.getCompletionRange(null);
insertText = entry.name + ': ';
retrigger = true;
}
// Empty .selector { | } case
if (!declaration && completePropertyWithSemicolon) {
insertText += '$0;';
}
// Cases such as .selector { p; } or .selector { p:; }
if (declaration && !declaration.semicolonPosition) {
if (completePropertyWithSemicolon && _this.offset >= _this.textDocument.offsetAt(range.end)) {
insertText += '$0;';
}
}
var item = {
label: entry.name,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()),
tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemTag.Deprecated] : [],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(range, insertText),
insertTextFormat: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.InsertTextFormat.Snippet,
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Property
};
if (!entry.restrictions) {
retrigger = false;
}
if (triggerPropertyValueCompletion && retrigger) {
item.command = {
title: 'Suggest',
command: 'editor.action.triggerSuggest'
};
}
var relevance = typeof entry.relevance === 'number' ? Math.min(Math.max(entry.relevance, 0), 99) : 50;
var sortTextSuffix = (255 - relevance).toString(16);
var sortTextPrefix = _utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(entry.name, '-') ? SortTexts.VendorPrefixed : SortTexts.Normal;
item.sortText = sortTextPrefix + '_' + sortTextSuffix;
result.items.push(item);
});
this.completionParticipants.forEach(function (participant) {
if (participant.onCssProperty) {
participant.onCssProperty({
propertyName: _this.currentWord,
range: _this.defaultReplaceRange
});
}
});
return result;
};
Object.defineProperty(CSSCompletion.prototype, "isTriggerPropertyValueCompletionEnabled", {
get: function () {
if (!this.settings ||
!this.settings.completion ||
this.settings.completion.triggerPropertyValueCompletion === undefined) {
return true;
}
return this.settings.completion.triggerPropertyValueCompletion;
},
enumerable: false,
configurable: true
});
Object.defineProperty(CSSCompletion.prototype, "isCompletePropertyWithSemicolonEnabled", {
get: function () {
if (!this.settings ||
!this.settings.completion ||
this.settings.completion.completePropertyWithSemicolon === undefined) {
return true;
}
return this.settings.completion.completePropertyWithSemicolon;
},
enumerable: false,
configurable: true
});
CSSCompletion.prototype.getCompletionsForDeclarationValue = function (node, result) {
var _this = this;
var propertyName = node.getFullPropertyName();
var entry = this.cssDataManager.getProperty(propertyName);
var existingNode = node.getValue() || null;
while (existingNode && existingNode.hasChildren()) {
existingNode = existingNode.findChildAtOffset(this.offset, false);
}
this.completionParticipants.forEach(function (participant) {
if (participant.onCssPropertyValue) {
participant.onCssPropertyValue({
propertyName: propertyName,
propertyValue: _this.currentWord,
range: _this.getCompletionRange(existingNode)
});
}
});
if (entry) {
if (entry.restrictions) {
for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) {
var restriction = _a[_i];
switch (restriction) {
case 'color':
this.getColorProposals(entry, existingNode, result);
break;
case 'position':
this.getPositionProposals(entry, existingNode, result);
break;
case 'repeat':
this.getRepeatStyleProposals(entry, existingNode, result);
break;
case 'line-style':
this.getLineStyleProposals(entry, existingNode, result);
break;
case 'line-width':
this.getLineWidthProposals(entry, existingNode, result);
break;
case 'geometry-box':
this.getGeometryBoxProposals(entry, existingNode, result);
break;
case 'box':
this.getBoxProposals(entry, existingNode, result);
break;
case 'image':
this.getImageProposals(entry, existingNode, result);
break;
case 'timing-function':
this.getTimingFunctionProposals(entry, existingNode, result);
break;
case 'shape':
this.getBasicShapeProposals(entry, existingNode, result);
break;
}
}
}
this.getValueEnumProposals(entry, existingNode, result);
this.getCSSWideKeywordProposals(entry, existingNode, result);
this.getUnitProposals(entry, existingNode, result);
}
else {
var existingValues = collectValues(this.styleSheet, node);
for (var _b = 0, _c = existingValues.getEntries(); _b < _c.length; _b++) {
var existingValue = _c[_b];
result.items.push({
label: existingValue,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), existingValue),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
}
this.getVariableProposals(existingNode, result);
this.getTermProposals(entry, existingNode, result);
return result;
};
CSSCompletion.prototype.getValueEnumProposals = function (entry, existingNode, result) {
if (entry.values) {
for (var _i = 0, _a = entry.values; _i < _a.length; _i++) {
var value = _a[_i];
var insertString = value.name;
var insertTextFormat = void 0;
if (_utils_strings__WEBPACK_IMPORTED_MODULE_3__.endsWith(insertString, ')')) {
var from = insertString.lastIndexOf('(');
if (from !== -1) {
insertString = insertString.substr(0, from) + '($1)';
insertTextFormat = SnippetFormat;
}
}
var sortText = SortTexts.Enums;
if (_utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(value.name, '-')) {
sortText += SortTexts.VendorPrefixed;
}
var item = {
label: value.name,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(value, this.doesSupportMarkdown()),
tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemTag.Deprecated] : [],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertString),
sortText: sortText,
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value,
insertTextFormat: insertTextFormat
};
result.items.push(item);
}
}
return result;
};
CSSCompletion.prototype.getCSSWideKeywordProposals = function (entry, existingNode, result) {
for (var keywords in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords) {
result.items.push({
label: keywords,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords[keywords],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), keywords),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getCompletionsForInterpolation = function (node, result) {
if (this.offset >= node.offset + 2) {
this.getVariableProposals(null, result);
}
return result;
};
CSSCompletion.prototype.getVariableProposals = function (existingNode, result) {
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var insertText = _utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(symbol.name, '--') ? "var(" + symbol.name + ")" : symbol.name;
var completionItem = {
label: symbol.name,
documentation: symbol.value ? _utils_strings__WEBPACK_IMPORTED_MODULE_3__.getLimitedString(symbol.value) : symbol.value,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Variable,
sortText: SortTexts.Variable
};
if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) {
completionItem.kind = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Color;
}
if (symbol.node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionParameter) {
var mixinNode = (symbol.node.getParent());
if (mixinNode.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.MixinDeclaration) {
completionItem.detail = localize('completion.argument', 'argument from \'{0}\'', mixinNode.getName());
}
}
result.items.push(completionItem);
}
return result;
};
CSSCompletion.prototype.getVariableProposalsForCSSVarFunction = function (result) {
var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
symbols = symbols.filter(function (symbol) {
return _utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(symbol.name, '--');
});
for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
var symbol = symbols_2[_i];
var completionItem = {
label: symbol.name,
documentation: symbol.value ? _utils_strings__WEBPACK_IMPORTED_MODULE_3__.getLimitedString(symbol.value) : symbol.value,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(null), symbol.name),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Variable
};
if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) {
completionItem.kind = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Color;
}
result.items.push(completionItem);
}
return result;
};
CSSCompletion.prototype.getUnitProposals = function (entry, existingNode, result) {
var currentWord = '0';
if (this.currentWord.length > 0) {
var numMatch = this.currentWord.match(/^-?\d[\.\d+]*/);
if (numMatch) {
currentWord = numMatch[0];
result.isIncomplete = currentWord.length === this.currentWord.length;
}
}
else if (this.currentWord.length === 0) {
result.isIncomplete = true;
}
if (existingNode && existingNode.parent && existingNode.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) {
existingNode = existingNode.getParent(); // include the unary operator
}
if (entry.restrictions) {
for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) {
var restriction = _a[_i];
var units = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.units[restriction];
if (units) {
for (var _b = 0, units_1 = units; _b < units_1.length; _b++) {
var unit = units_1[_b];
var insertText = currentWord + unit;
result.items.push({
label: insertText,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Unit
});
}
}
}
}
return result;
};
CSSCompletion.prototype.getCompletionRange = function (existingNode) {
if (existingNode && existingNode.offset <= this.offset && this.offset <= existingNode.end) {
var end = existingNode.end !== -1 ? this.textDocument.positionAt(existingNode.end) : this.position;
var start = this.textDocument.positionAt(existingNode.offset);
if (start.line === end.line) {
return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Range.create(start, end); // multi line edits are not allowed
}
}
return this.defaultReplaceRange;
};
CSSCompletion.prototype.getColorProposals = function (entry, existingNode, result) {
for (var color in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors) {
result.items.push({
label: color,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors[color],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Color
});
}
for (var color in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorKeywords) {
result.items.push({
label: color,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorKeywords[color],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
var colorValues = new Set();
this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues, this.offset));
for (var _i = 0, _a = colorValues.getEntries(); _i < _a.length; _i++) {
var color = _a[_i];
result.items.push({
label: color,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), color),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Color
});
}
var _loop_1 = function (p) {
var tabStop = 1;
var replaceFunction = function (_match, p1) { return '${' + tabStop++ + ':' + p1 + '}'; };
var insertText = p.func.replace(/\[?\$(\w+)\]?/g, replaceFunction);
result.items.push({
label: p.func.substr(0, p.func.indexOf('(')),
detail: p.func,
documentation: p.desc,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this_1.getCompletionRange(existingNode), insertText),
insertTextFormat: SnippetFormat,
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function
});
};
var this_1 = this;
for (var _b = 0, _c = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorFunctions; _b < _c.length; _b++) {
var p = _c[_b];
_loop_1(p);
}
return result;
};
CSSCompletion.prototype.getPositionProposals = function (entry, existingNode, result) {
for (var position in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.positionKeywords) {
result.items.push({
label: position,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.positionKeywords[position],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), position),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getRepeatStyleProposals = function (entry, existingNode, result) {
for (var repeat in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords) {
result.items.push({
label: repeat,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords[repeat],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), repeat),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getLineStyleProposals = function (entry, existingNode, result) {
for (var lineStyle in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords) {
result.items.push({
label: lineStyle,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords[lineStyle],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), lineStyle),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getLineWidthProposals = function (entry, existingNode, result) {
for (var _i = 0, _a = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineWidthKeywords; _i < _a.length; _i++) {
var lineWidth = _a[_i];
result.items.push({
label: lineWidth,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), lineWidth),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getGeometryBoxProposals = function (entry, existingNode, result) {
for (var box in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords) {
result.items.push({
label: box,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords[box],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getBoxProposals = function (entry, existingNode, result) {
for (var box in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.boxKeywords) {
result.items.push({
label: box,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.boxKeywords[box],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), box),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Value
});
}
return result;
};
CSSCompletion.prototype.getImageProposals = function (entry, existingNode, result) {
for (var image in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.imageFunctions) {
var insertText = moveCursorInsideParenthesis(image);
result.items.push({
label: image,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.imageFunctions[image],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
insertTextFormat: image !== insertText ? SnippetFormat : void 0
});
}
return result;
};
CSSCompletion.prototype.getTimingFunctionProposals = function (entry, existingNode, result) {
for (var timing in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions) {
var insertText = moveCursorInsideParenthesis(timing);
result.items.push({
label: timing,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions[timing],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
insertTextFormat: timing !== insertText ? SnippetFormat : void 0
});
}
return result;
};
CSSCompletion.prototype.getBasicShapeProposals = function (entry, existingNode, result) {
for (var shape in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions) {
var insertText = moveCursorInsideParenthesis(shape);
result.items.push({
label: shape,
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions[shape],
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
insertTextFormat: shape !== insertText ? SnippetFormat : void 0
});
}
return result;
};
CSSCompletion.prototype.getCompletionsForStylesheet = function (result) {
var node = this.styleSheet.findFirstChildBeforeOffset(this.offset);
if (!node) {
return this.getCompletionForTopLevel(result);
}
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) {
return this.getCompletionsForRuleSet(node, result);
}
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Supports) {
return this.getCompletionsForSupports(node, result);
}
return result;
};
CSSCompletion.prototype.getCompletionForTopLevel = function (result) {
var _this = this;
this.cssDataManager.getAtDirectives().forEach(function (entry) {
result.items.push({
label: entry.name,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(_this.getCompletionRange(null), entry.name),
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()),
tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemTag.Deprecated] : [],
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Keyword
});
});
this.getCompletionsForSelector(null, false, result);
return result;
};
CSSCompletion.prototype.getCompletionsForRuleSet = function (ruleSet, result) {
var declarations = ruleSet.getDeclarations();
var isAfter = declarations && declarations.endsWith('}') && this.offset >= declarations.end;
if (isAfter) {
return this.getCompletionForTopLevel(result);
}
var isInSelectors = !declarations || this.offset <= declarations.offset;
if (isInSelectors) {
return this.getCompletionsForSelector(ruleSet, ruleSet.isNested(), result);
}
return this.getCompletionsForDeclarations(ruleSet.getDeclarations(), result);
};
CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) {
var _this = this;
var existingNode = this.findInNodePath(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.PseudoSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.IdentifierSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ClassSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ElementNameSelector);
if (!existingNode && this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) {
// after the ':' of a pseudo selector, no node generated for just ':'
this.currentWord = ':' + this.currentWord;
if (this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) {
this.currentWord = ':' + this.currentWord; // for '::'
}
this.defaultReplaceRange = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Range.create(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Position.create(this.position.line, this.position.character - this.currentWord.length), this.position);
}
var pseudoClasses = this.cssDataManager.getPseudoClasses();
pseudoClasses.forEach(function (entry) {
var insertText = moveCursorInsideParenthesis(entry.name);
var item = {
label: entry.name,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()),
tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemTag.Deprecated] : [],
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0
};
if (_utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(entry.name, ':-')) {
item.sortText = SortTexts.VendorPrefixed;
}
result.items.push(item);
});
var pseudoElements = this.cssDataManager.getPseudoElements();
pseudoElements.forEach(function (entry) {
var insertText = moveCursorInsideParenthesis(entry.name);
var item = {
label: entry.name,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(_this.getCompletionRange(existingNode), insertText),
documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()),
tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemTag.Deprecated] : [],
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0
};
if (_utils_strings__WEBPACK_IMPORTED_MODULE_3__.startsWith(entry.name, '::-')) {
item.sortText = SortTexts.VendorPrefixed;
}
result.items.push(item);
});
if (!isNested) { // show html tags only for top level
for (var _i = 0, _a = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.html5Tags; _i < _a.length; _i++) {
var entry = _a[_i];
result.items.push({
label: entry,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), entry),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Keyword
});
}
for (var _b = 0, _c = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.svgElements; _b < _c.length; _b++) {
var entry = _c[_b];
result.items.push({
label: entry,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), entry),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Keyword
});
}
}
var visited = {};
visited[this.currentWord] = true;
var docText = this.textDocument.getText();
this.styleSheet.accept(function (n) {
if (n.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.SimpleSelector && n.length > 0) {
var selector = docText.substr(n.offset, n.length);
if (selector.charAt(0) === '.' && !visited[selector]) {
visited[selector] = true;
result.items.push({
label: selector,
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(_this.getCompletionRange(existingNode), selector),
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Keyword
});
}
return false;
}
return true;
});
if (ruleSet && ruleSet.isNested()) {
var selector = ruleSet.getSelectors().findFirstChildBeforeOffset(this.offset);
if (selector && ruleSet.getSelectors().getChildren().indexOf(selector) === 0) {
this.getPropertyProposals(null, result);
}
}
return result;
};
CSSCompletion.prototype.getCompletionsForDeclarations = function (declarations, result) {
if (!declarations || this.offset === declarations.offset) { // incomplete nodes
return result;
}
var node = declarations.findFirstChildBeforeOffset(this.offset);
if (!node) {
return this.getCompletionsForDeclarationProperty(null, result);
}
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.AbstractDeclaration) {
var declaration = node;
if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition) || this.offset <= declaration.colonPosition) {
// complete property
return this.getCompletionsForDeclarationProperty(declaration, result);
}
else if (((0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.semicolonPosition) && declaration.semicolonPosition < this.offset)) {
if (this.offset === declaration.semicolonPosition + 1) {
return result; // don't show new properties right after semicolon (see Bug 15421:[intellisense] [css] Be less aggressive when manually typing CSS)
}
// complete next property
return this.getCompletionsForDeclarationProperty(null, result);
}
if (declaration instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration) {
// complete value
return this.getCompletionsForDeclarationValue(declaration, result);
}
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ExtendsReference) {
this.getCompletionsForExtendsReference(node, null, result);
}
else if (this.currentWord && this.currentWord[0] === '@') {
this.getCompletionsForDeclarationProperty(null, result);
}
else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) {
this.getCompletionsForDeclarationProperty(null, result);
}
return result;
};
CSSCompletion.prototype.getCompletionsForVariableDeclaration = function (declaration, result) {
if (this.offset && (0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition) && this.offset > declaration.colonPosition) {
this.getVariableProposals(declaration.getValue(), result);
}
return result;
};
CSSCompletion.prototype.getCompletionsForExpression = function (expression, result) {
var parent = expression.getParent();
if (parent instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument) {
this.getCompletionsForFunctionArgument(parent, parent.getParent(), result);
return result;
}
var declaration = expression.findParent(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Declaration);
if (!declaration) {
this.getTermProposals(undefined, null, result);
return result;
}
var node = expression.findChildAtOffset(this.offset, true);
if (!node) {
return this.getCompletionsForDeclarationValue(declaration, result);
}
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NumericValue || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier) {
return this.getCompletionsForDeclarationValue(declaration, result);
}
return result;
};
CSSCompletion.prototype.getCompletionsForFunctionArgument = function (arg, func, result) {
var identifier = func.getIdentifier();
if (identifier && identifier.matches('var')) {
if (!func.getArguments().hasChildren() || func.getArguments().getChild(0) === arg) {
this.getVariableProposalsForCSSVarFunction(result);
}
}
return result;
};
CSSCompletion.prototype.getCompletionsForFunctionDeclaration = function (decl, result) {
var declarations = decl.getDeclarations();
if (declarations && this.offset > declarations.offset && this.offset < declarations.end) {
this.getTermProposals(undefined, null, result);
}
return result;
};
CSSCompletion.prototype.getCompletionsForMixinReference = function (ref, result) {
var _this = this;
var allMixins = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Mixin);
for (var _i = 0, allMixins_1 = allMixins; _i < allMixins_1.length; _i++) {
var mixinSymbol = allMixins_1[_i];
if (mixinSymbol.node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.MixinDeclaration) {
result.items.push(this.makeTermProposal(mixinSymbol, mixinSymbol.node.getParameters(), null));
}
}
var identifierNode = ref.getIdentifier() || null;
this.completionParticipants.forEach(function (participant) {
if (participant.onCssMixinReference) {
participant.onCssMixinReference({
mixinName: _this.currentWord,
range: _this.getCompletionRange(identifierNode)
});
}
});
return result;
};
CSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) {
var allFunctions = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function);
for (var _i = 0, allFunctions_1 = allFunctions; _i < allFunctions_1.length; _i++) {
var functionSymbol = allFunctions_1[_i];
if (functionSymbol.node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionDeclaration) {
result.items.push(this.makeTermProposal(functionSymbol, functionSymbol.node.getParameters(), existingNode));
}
}
return result;
};
CSSCompletion.prototype.makeTermProposal = function (symbol, parameters, existingNode) {
var decl = symbol.node;
var params = parameters.getChildren().map(function (c) {
return (c instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionParameter) ? c.getName() : c.getText();
});
var insertText = symbol.name + '(' + params.map(function (p, index) { return '${' + (index + 1) + ':' + p + '}'; }).join(', ') + ')';
return {
label: symbol.name,
detail: symbol.name + '(' + params.join(', ') + ')',
textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.TextEdit.replace(this.getCompletionRange(existingNode), insertText),
insertTextFormat: SnippetFormat,
kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.CompletionItemKind.Function,
sortText: SortTexts.Term
};
};
CSSCompletion.prototype.getCompletionsForSupportsCondition = function (supportsCondition, result) {
var child = supportsCondition.findFirstChildBeforeOffset(this.offset);
if (child) {
if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration) {
if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(child.colonPosition) || this.offset <= child.colonPosition) {
return this.getCompletionsForDeclarationProperty(child, result);
}
else {
return this.getCompletionsForDeclarationValue(child, result);
}
}
else if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) {
return this.getCompletionsForSupportsCondition(child, result);
}
}
if ((0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(supportsCondition.lParent) && this.offset > supportsCondition.lParent && (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(supportsCondition.rParent) || this.offset <= supportsCondition.rParent)) {
return this.getCompletionsForDeclarationProperty(null, result);
}
return result;
};
CSSCompletion.prototype.getCompletionsForSupports = function (supports, result) {
var declarations = supports.getDeclarations();
var inInCondition = !declarations || this.offset <= declarations.offset;
if (inInCondition) {
var child = supports.findFirstChildBeforeOffset(this.offset);
if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) {
return this.getCompletionsForSupportsCondition(child, result);
}
return result;
}
return this.getCompletionForTopLevel(result);
};
CSSCompletion.prototype.getCompletionsForExtendsReference = function (extendsRef, existingNode, result) {
return result;
};
CSSCompletion.prototype.getCompletionForUriLiteralValue = function (uriLiteralNode, result) {
var uriValue;
var position;
var range;
// No children, empty value
if (!uriLiteralNode.hasChildren()) {
uriValue = '';
position = this.position;
var emptyURIValuePosition = this.textDocument.positionAt(uriLiteralNode.offset + 'url('.length);
range = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.Range.create(emptyURIValuePosition, emptyURIValuePosition);
}
else {
var uriValueNode = uriLiteralNode.getChild(0);
uriValue = uriValueNode.getText();
position = this.position;
range = this.getCompletionRange(uriValueNode);
}
this.completionParticipants.forEach(function (participant) {
if (participant.onCssURILiteralValue) {
participant.onCssURILiteralValue({
uriValue: uriValue,
position: position,
range: range
});
}
});
return result;
};
CSSCompletion.prototype.getCompletionForImportPath = function (importPathNode, result) {
var _this = this;
this.completionParticipants.forEach(function (participant) {
if (participant.onCssImportPath) {
participant.onCssImportPath({
pathValue: importPathNode.getText(),
position: _this.position,
range: _this.getCompletionRange(importPathNode)
});
}
});
return result;
};
CSSCompletion.prototype.hasCharacterAtPosition = function (offset, char) {
var text = this.textDocument.getText();
return (offset >= 0 && offset < text.length) && text.charAt(offset) === char;
};
CSSCompletion.prototype.doesSupportMarkdown = function () {
var _a, _b, _c;
if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.supportsMarkdown)) {
if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.lsOptions.clientCapabilities)) {
this.supportsMarkdown = true;
return this.supportsMarkdown;
}
var documentationFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.documentationFormat;
this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_4__.MarkupKind.Markdown) !== -1;
}
return this.supportsMarkdown;
};
return CSSCompletion;
}());
function isDeprecated(entry) {
if (entry.status && (entry.status === 'nonstandard' || entry.status === 'obsolete')) {
return true;
}
return false;
}
/**
* Rank number should all be same length strings
*/
function computeRankNumber(n) {
var nstr = n.toString();
switch (nstr.length) {
case 4:
return nstr;
case 3:
return '0' + nstr;
case 2:
return '00' + nstr;
case 1:
return '000' + nstr;
default:
return '0000';
}
}
var Set = /** @class */ (function () {
function Set() {
this.entries = {};
}
Set.prototype.add = function (entry) {
this.entries[entry] = true;
};
Set.prototype.getEntries = function () {
return Object.keys(this.entries);
};
return Set;
}());
function moveCursorInsideParenthesis(text) {
return text.replace(/\(\)$/, "($1)");
}
function collectValues(styleSheet, declaration) {
var fullPropertyName = declaration.getFullPropertyName();
var entries = new Set();
function visitValue(node) {
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NumericValue || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.HexColorValue) {
entries.add(node.getText());
}
return true;
}
function matchesProperty(decl) {
var propertyName = decl.getFullPropertyName();
return fullPropertyName === propertyName;
}
function vistNode(node) {
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration && node !== declaration) {
if (matchesProperty(node)) {
var value = node.getValue();
if (value) {
value.accept(visitValue);
}
}
}
return true;
}
styleSheet.accept(vistNode);
return entries;
}
var ColorValueCollector = /** @class */ (function () {
function ColorValueCollector(entries, currentOffset) {
this.entries = entries;
this.currentOffset = currentOffset;
// nothing to do
}
ColorValueCollector.prototype.visitNode = function (node) {
if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.HexColorValue || (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function && _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.isColorConstructor(node))) {
if (this.currentOffset < node.offset || node.end < this.currentOffset) {
this.entries.add(node.getText());
}
}
return true;
};
return ColorValueCollector;
}());
function getCurrentWord(document, offset) {
var i = offset - 1;
var text = document.getText();
while (i >= 0 && ' \t\n\r":{[()]},*>+'.indexOf(text.charAt(i)) === -1) {
i--;
}
return text.substring(i + 1, offset);
}
function isColorString(s) {
// From https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444
return (s.toLowerCase() in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors) || /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(s);
}
/***/ }),
/* 86 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Scope": () => /* binding */ Scope,
/* harmony export */ "GlobalScope": () => /* binding */ GlobalScope,
/* harmony export */ "Symbol": () => /* binding */ Symbol,
/* harmony export */ "ScopeBuilder": () => /* binding */ ScopeBuilder,
/* harmony export */ "Symbols": () => /* binding */ Symbols
/* harmony export */ });
/* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74);
/* harmony import */ var _utils_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Scope = /** @class */ (function () {
function Scope(offset, length) {
this.offset = offset;
this.length = length;
this.symbols = [];
this.parent = null;
this.children = [];
}
Scope.prototype.addChild = function (scope) {
this.children.push(scope);
scope.setParent(this);
};
Scope.prototype.setParent = function (scope) {
this.parent = scope;
};
Scope.prototype.findScope = function (offset, length) {
if (length === void 0) { length = 0; }
if (this.offset <= offset && this.offset + this.length > offset + length || this.offset === offset && this.length === length) {
return this.findInScope(offset, length);
}
return null;
};
Scope.prototype.findInScope = function (offset, length) {
if (length === void 0) { length = 0; }
// find the first scope child that has an offset larger than offset + length
var end = offset + length;
var idx = (0,_utils_arrays__WEBPACK_IMPORTED_MODULE_1__.findFirst)(this.children, function (s) { return s.offset > end; });
if (idx === 0) {
// all scopes have offsets larger than our end
return this;
}
var res = this.children[idx - 1];
if (res.offset <= offset && res.offset + res.length >= offset + length) {
return res.findInScope(offset, length);
}
return this;
};
Scope.prototype.addSymbol = function (symbol) {
this.symbols.push(symbol);
};
Scope.prototype.getSymbol = function (name, type) {
for (var index = 0; index < this.symbols.length; index++) {
var symbol = this.symbols[index];
if (symbol.name === name && symbol.type === type) {
return symbol;
}
}
return null;
};
Scope.prototype.getSymbols = function () {
return this.symbols;
};
return Scope;
}());
var GlobalScope = /** @class */ (function (_super) {
__extends(GlobalScope, _super);
function GlobalScope() {
return _super.call(this, 0, Number.MAX_VALUE) || this;
}
return GlobalScope;
}(Scope));
var Symbol = /** @class */ (function () {
function Symbol(name, value, node, type) {
this.name = name;
this.value = value;
this.node = node;
this.type = type;
}
return Symbol;
}());
var ScopeBuilder = /** @class */ (function () {
function ScopeBuilder(scope) {
this.scope = scope;
}
ScopeBuilder.prototype.addSymbol = function (node, name, value, type) {
if (node.offset !== -1) {
var current = this.scope.findScope(node.offset, node.length);
if (current) {
current.addSymbol(new Symbol(name, value, node, type));
}
}
};
ScopeBuilder.prototype.addScope = function (node) {
if (node.offset !== -1) {
var current = this.scope.findScope(node.offset, node.length);
if (current && (current.offset !== node.offset || current.length !== node.length)) { // scope already known?
var newScope = new Scope(node.offset, node.length);
current.addChild(newScope);
return newScope;
}
return current;
}
return null;
};
ScopeBuilder.prototype.addSymbolToChildScope = function (scopeNode, node, name, value, type) {
if (scopeNode && scopeNode.offset !== -1) {
var current = this.addScope(scopeNode); // create the scope or gets the existing one
if (current) {
current.addSymbol(new Symbol(name, value, node, type));
}
}
};
ScopeBuilder.prototype.visitNode = function (node) {
switch (node.type) {
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Keyframe:
this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Keyframe);
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.CustomPropertyDeclaration:
return this.visitCustomPropertyDeclarationNode(node);
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.VariableDeclaration:
return this.visitVariableDeclarationNode(node);
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Ruleset:
return this.visitRuleSet(node);
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.MixinDeclaration:
this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Mixin);
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionDeclaration:
this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function);
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionParameter: {
return this.visitFunctionParameterNode(node);
}
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Declarations:
this.addScope(node);
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.For:
var forNode = node;
var scopeNode = forNode.getDeclarations();
if (scopeNode && forNode.variable) {
this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
}
return true;
case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Each: {
var eachNode = node;
var scopeNode_1 = eachNode.getDeclarations();
if (scopeNode_1) {
var variables = eachNode.getVariables().getChildren();
for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) {
var variable = variables_1[_i];
this.addSymbolToChildScope(scopeNode_1, variable, variable.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
}
}
return true;
}
}
return true;
};
ScopeBuilder.prototype.visitRuleSet = function (node) {
var current = this.scope.findScope(node.offset, node.length);
if (current) {
for (var _i = 0, _a = node.getSelectors().getChildren(); _i < _a.length; _i++) {
var child = _a[_i];
if (child instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Selector) {
if (child.getChildren().length === 1) { // only selectors with a single element can be extended
current.addSymbol(new Symbol(child.getChild(0).getText(), void 0, child, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Rule));
}
}
}
}
return true;
};
ScopeBuilder.prototype.visitVariableDeclarationNode = function (node) {
var value = node.getValue() ? node.getValue().getText() : void 0;
this.addSymbol(node, node.getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
return true;
};
ScopeBuilder.prototype.visitFunctionParameterNode = function (node) {
// parameters are part of the body scope
var scopeNode = node.getParent().getDeclarations();
if (scopeNode) {
var valueNode = node.getDefaultValue();
var value = valueNode ? valueNode.getText() : void 0;
this.addSymbolToChildScope(scopeNode, node, node.getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
}
return true;
};
ScopeBuilder.prototype.visitCustomPropertyDeclarationNode = function (node) {
var value = node.getValue() ? node.getValue().getText() : '';
this.addCSSVariable(node.getProperty(), node.getProperty().getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable);
return true;
};
ScopeBuilder.prototype.addCSSVariable = function (node, name, value, type) {
if (node.offset !== -1) {
this.scope.addSymbol(new Symbol(name, value, node, type));
}
};
return ScopeBuilder;
}());
var Symbols = /** @class */ (function () {
function Symbols(node) {
this.global = new GlobalScope();
node.acceptVisitor(new ScopeBuilder(this.global));
}
Symbols.prototype.findSymbolsAtOffset = function (offset, referenceType) {
var scope = this.global.findScope(offset, 0);
var result = [];
var names = {};
while (scope) {
var symbols = scope.getSymbols();
for (var i = 0; i < symbols.length; i++) {
var symbol = symbols[i];
if (symbol.type === referenceType && !names[symbol.name]) {
result.push(symbol);
names[symbol.name] = true;
}
}
scope = scope.parent;
}
return result;
};
Symbols.prototype.internalFindSymbol = function (node, referenceTypes) {
var scopeNode = node;
if (node.parent instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionParameter && node.parent.getParent() instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.BodyDeclaration) {
scopeNode = node.parent.getParent().getDeclarations();
}
if (node.parent instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument && node.parent.getParent() instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function) {
var funcId = node.parent.getParent().getIdentifier();
if (funcId) {
var functionSymbol = this.internalFindSymbol(funcId, [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function]);
if (functionSymbol) {
scopeNode = functionSymbol.node.getDeclarations();
}
}
}
if (!scopeNode) {
return null;
}
var name = node.getText();
var scope = this.global.findScope(scopeNode.offset, scopeNode.length);
while (scope) {
for (var index = 0; index < referenceTypes.length; index++) {
var type = referenceTypes[index];
var symbol = scope.getSymbol(name, type);
if (symbol) {
return symbol;
}
}
scope = scope.parent;
}
return null;
};
Symbols.prototype.evaluateReferenceTypes = function (node) {
if (node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier) {
var referenceTypes = node.referenceTypes;
if (referenceTypes) {
return referenceTypes;
}
else {
if (node.isCustomProperty) {
return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable];
}
// are a reference to a keyframe?
var decl = _cssNodes__WEBPACK_IMPORTED_MODULE_0__.getParentDeclaration(node);
if (decl) {
var propertyName = decl.getNonPrefixedPropertyName();
if ((propertyName === 'animation' || propertyName === 'animation-name')
&& decl.getValue() && decl.getValue().offset === node.offset) {
return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Keyframe];
}
}
}
}
else if (node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Variable) {
return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable];
}
var selector = node.findAParent(_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Selector, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference);
if (selector) {
return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Rule];
}
return null;
};
Symbols.prototype.findSymbolFromNode = function (node) {
if (!node) {
return null;
}
while (node.type === _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Interpolation) {
node = node.getParent();
}
var referenceTypes = this.evaluateReferenceTypes(node);
if (referenceTypes) {
return this.internalFindSymbol(node, referenceTypes);
}
return null;
};
Symbols.prototype.matchesSymbol = function (node, symbol) {
if (!node) {
return false;
}
while (node.type === _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Interpolation) {
node = node.getParent();
}
if (!node.matches(symbol.name)) {
return false;
}
var referenceTypes = this.evaluateReferenceTypes(node);
if (!referenceTypes || referenceTypes.indexOf(symbol.type) === -1) {
return false;
}
var nodeSymbol = this.internalFindSymbol(node, referenceTypes);
return nodeSymbol === symbol;
};
Symbols.prototype.findSymbol = function (name, type, offset) {
var scope = this.global.findScope(offset);
while (scope) {
var symbol = scope.getSymbol(name, type);
if (symbol) {
return symbol;
}
scope = scope.parent;
}
return null;
};
return Symbols;
}());
/***/ }),
/* 87 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "findFirst": () => /* binding */ findFirst,
/* harmony export */ "includes": () => /* binding */ includes,
/* harmony export */ "union": () => /* binding */ union
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
* are located before all elements where p(x) is true.
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
*/
function findFirst(array, p) {
var low = 0, high = array.length;
if (high === 0) {
return 0; // no children
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (p(array[mid])) {
high = mid;
}
else {
low = mid + 1;
}
}
return low;
}
function includes(array, item) {
return array.indexOf(item) !== -1;
}
function union() {
var arrays = [];
for (var _i = 0; _i < arguments.length; _i++) {
arrays[_i] = arguments[_i];
}
var result = [];
for (var _a = 0, arrays_1 = arrays; _a < arrays_1.length; _a++) {
var array = arrays_1[_a];
for (var _b = 0, array_1 = array; _b < array_1.length; _b++) {
var item = array_1[_b];
if (!includes(result, item)) {
result.push(item);
}
}
}
return result;
}
/***/ }),
/* 88 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "TextDocument": () => /* reexport safe */ vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__.TextDocument,
/* harmony export */ "AnnotatedTextEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.AnnotatedTextEdit,
/* harmony export */ "ChangeAnnotation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ChangeAnnotationIdentifier,
/* harmony export */ "CodeAction": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeAction,
/* harmony export */ "CodeActionContext": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionContext,
/* harmony export */ "CodeActionKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionKind,
/* harmony export */ "CodeDescription": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeDescription,
/* harmony export */ "CodeLens": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeLens,
/* harmony export */ "Color": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Color,
/* harmony export */ "ColorInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorInformation,
/* harmony export */ "ColorPresentation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorPresentation,
/* harmony export */ "Command": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Command,
/* harmony export */ "CompletionItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItem,
/* harmony export */ "CompletionItemKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemKind,
/* harmony export */ "CompletionItemTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemTag,
/* harmony export */ "CompletionList": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionList,
/* harmony export */ "CreateFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CreateFile,
/* harmony export */ "DeleteFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DeleteFile,
/* harmony export */ "Diagnostic": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Diagnostic,
/* harmony export */ "DiagnosticRelatedInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticTag,
/* harmony export */ "DocumentHighlight": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlight,
/* harmony export */ "DocumentHighlightKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlightKind,
/* harmony export */ "DocumentLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentLink,
/* harmony export */ "DocumentSymbol": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentSymbol,
/* harmony export */ "EOL": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.EOL,
/* harmony export */ "FoldingRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRange,
/* harmony export */ "FoldingRangeKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRangeKind,
/* harmony export */ "FormattingOptions": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FormattingOptions,
/* harmony export */ "Hover": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Hover,
/* harmony export */ "InsertReplaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertReplaceEdit,
/* harmony export */ "InsertTextFormat": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertTextFormat,
/* harmony export */ "InsertTextMode": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertTextMode,
/* harmony export */ "Location": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Location,
/* harmony export */ "LocationLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.LocationLink,
/* harmony export */ "MarkedString": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkedString,
/* harmony export */ "MarkupContent": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupContent,
/* harmony export */ "MarkupKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "ParameterInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ParameterInformation,
/* harmony export */ "Position": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Position,
/* harmony export */ "Range": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Range,
/* harmony export */ "RenameFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.RenameFile,
/* harmony export */ "SelectionRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SelectionRange,
/* harmony export */ "SignatureInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SignatureInformation,
/* harmony export */ "SymbolInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolInformation,
/* harmony export */ "SymbolKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolKind,
/* harmony export */ "SymbolTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolTag,
/* harmony export */ "TextDocumentEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentEdit,
/* harmony export */ "TextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentItem,
/* harmony export */ "TextEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextEdit,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.VersionedTextDocumentIdentifier,
/* harmony export */ "WorkspaceChange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceChange,
/* harmony export */ "WorkspaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceEdit,
/* harmony export */ "integer": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.integer,
/* harmony export */ "uinteger": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.uinteger,
/* harmony export */ "ClientCapabilities": () => /* binding */ ClientCapabilities,
/* harmony export */ "FileType": () => /* binding */ FileType
/* harmony export */ });
/* harmony import */ var vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(89);
/* harmony import */ var vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(90);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var ClientCapabilities;
(function (ClientCapabilities) {
ClientCapabilities.LATEST = {
textDocument: {
completion: {
completionItem: {
documentationFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText]
}
},
hover: {
contentFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText]
}
}
};
})(ClientCapabilities || (ClientCapabilities = {}));
var FileType;
(function (FileType) {
/**
* The file type is unknown.
*/
FileType[FileType["Unknown"] = 0] = "Unknown";
/**
* A regular file.
*/
FileType[FileType["File"] = 1] = "File";
/**
* A directory.
*/
FileType[FileType["Directory"] = 2] = "Directory";
/**
* A symbolic link to a file.
*/
FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
})(FileType || (FileType = {}));
/***/ }),
/* 89 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "integer": () => /* binding */ integer,
/* harmony export */ "uinteger": () => /* binding */ uinteger,
/* harmony export */ "Position": () => /* binding */ Position,
/* harmony export */ "Range": () => /* binding */ Range,
/* harmony export */ "Location": () => /* binding */ Location,
/* harmony export */ "LocationLink": () => /* binding */ LocationLink,
/* harmony export */ "Color": () => /* binding */ Color,
/* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
/* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
/* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
/* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
/* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
/* harmony export */ "CodeDescription": () => /* binding */ CodeDescription,
/* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
/* harmony export */ "Command": () => /* binding */ Command,
/* harmony export */ "TextEdit": () => /* binding */ TextEdit,
/* harmony export */ "ChangeAnnotation": () => /* binding */ ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* binding */ ChangeAnnotationIdentifier,
/* harmony export */ "AnnotatedTextEdit": () => /* binding */ AnnotatedTextEdit,
/* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
/* harmony export */ "CreateFile": () => /* binding */ CreateFile,
/* harmony export */ "RenameFile": () => /* binding */ RenameFile,
/* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
/* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
/* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
/* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* binding */ OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
/* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
/* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
/* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
/* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
/* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
/* harmony export */ "InsertReplaceEdit": () => /* binding */ InsertReplaceEdit,
/* harmony export */ "InsertTextMode": () => /* binding */ InsertTextMode,
/* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
/* harmony export */ "CompletionList": () => /* binding */ CompletionList,
/* harmony export */ "MarkedString": () => /* binding */ MarkedString,
/* harmony export */ "Hover": () => /* binding */ Hover,
/* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
/* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
/* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
/* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
/* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
/* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
/* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
/* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
/* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
/* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
/* harmony export */ "CodeAction": () => /* binding */ CodeAction,
/* harmony export */ "CodeLens": () => /* binding */ CodeLens,
/* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
/* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
/* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
/* harmony export */ "EOL": () => /* binding */ EOL,
/* harmony export */ "TextDocument": () => /* binding */ TextDocument
/* harmony export */ });
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var integer;
(function (integer) {
integer.MIN_VALUE = -2147483648;
integer.MAX_VALUE = 2147483647;
})(integer || (integer = {}));
var uinteger;
(function (uinteger) {
uinteger.MIN_VALUE = 0;
uinteger.MAX_VALUE = 2147483647;
})(uinteger || (uinteger = {}));
/**
* The Position namespace provides helper functions to work with
* [Position](#Position) literals.
*/
var Position;
(function (Position) {
/**
* Creates a new Position literal from the given line and character.
* @param line The position's line.
* @param character The position's character.
*/
function create(line, character) {
if (line === Number.MAX_VALUE) {
line = uinteger.MAX_VALUE;
}
if (character === Number.MAX_VALUE) {
character = uinteger.MAX_VALUE;
}
return { line: line, character: character };
}
Position.create = create;
/**
* Checks whether the given literal conforms to the [Position](#Position) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
}
Position.is = is;
})(Position || (Position = {}));
/**
* The Range namespace provides helper functions to work with
* [Range](#Range) literals.
*/
var Range;
(function (Range) {
function create(one, two, three, four) {
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
return { start: Position.create(one, two), end: Position.create(three, four) };
}
else if (Position.is(one) && Position.is(two)) {
return { start: one, end: two };
}
else {
throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
}
}
Range.create = create;
/**
* Checks whether the given literal conforms to the [Range](#Range) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
}
Range.is = is;
})(Range || (Range = {}));
/**
* The Location namespace provides helper functions to work with
* [Location](#Location) literals.
*/
var Location;
(function (Location) {
/**
* Creates a Location literal.
* @param uri The location's uri.
* @param range The location's range.
*/
function create(uri, range) {
return { uri: uri, range: range };
}
Location.create = create;
/**
* Checks whether the given literal conforms to the [Location](#Location) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
}
Location.is = is;
})(Location || (Location = {}));
/**
* The LocationLink namespace provides helper functions to work with
* [LocationLink](#LocationLink) literals.
*/
var LocationLink;
(function (LocationLink) {
/**
* Creates a LocationLink literal.
* @param targetUri The definition's uri.
* @param targetRange The full range of the definition.
* @param targetSelectionRange The span of the symbol definition at the target.
* @param originSelectionRange The span of the symbol being defined in the originating source file.
*/
function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
}
LocationLink.create = create;
/**
* Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
&& (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
&& (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
}
LocationLink.is = is;
})(LocationLink || (LocationLink = {}));
/**
* The Color namespace provides helper functions to work with
* [Color](#Color) literals.
*/
var Color;
(function (Color) {
/**
* Creates a new Color literal.
*/
function create(red, green, blue, alpha) {
return {
red: red,
green: green,
blue: blue,
alpha: alpha,
};
}
Color.create = create;
/**
* Checks whether the given literal conforms to the [Color](#Color) interface.
*/
function is(value) {
var candidate = value;
return Is.numberRange(candidate.red, 0, 1)
&& Is.numberRange(candidate.green, 0, 1)
&& Is.numberRange(candidate.blue, 0, 1)
&& Is.numberRange(candidate.alpha, 0, 1);
}
Color.is = is;
})(Color || (Color = {}));
/**
* The ColorInformation namespace provides helper functions to work with
* [ColorInformation](#ColorInformation) literals.
*/
var ColorInformation;
(function (ColorInformation) {
/**
* Creates a new ColorInformation literal.
*/
function create(range, color) {
return {
range: range,
color: color,
};
}
ColorInformation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Range.is(candidate.range) && Color.is(candidate.color);
}
ColorInformation.is = is;
})(ColorInformation || (ColorInformation = {}));
/**
* The Color namespace provides helper functions to work with
* [ColorPresentation](#ColorPresentation) literals.
*/
var ColorPresentation;
(function (ColorPresentation) {
/**
* Creates a new ColorInformation literal.
*/
function create(label, textEdit, additionalTextEdits) {
return {
label: label,
textEdit: textEdit,
additionalTextEdits: additionalTextEdits,
};
}
ColorPresentation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.string(candidate.label)
&& (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
&& (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
}
ColorPresentation.is = is;
})(ColorPresentation || (ColorPresentation = {}));
/**
* Enum of known range kinds
*/
var FoldingRangeKind;
(function (FoldingRangeKind) {
/**
* Folding range for a comment
*/
FoldingRangeKind["Comment"] = "comment";
/**
* Folding range for a imports or includes
*/
FoldingRangeKind["Imports"] = "imports";
/**
* Folding range for a region (e.g. `#region`)
*/
FoldingRangeKind["Region"] = "region";
})(FoldingRangeKind || (FoldingRangeKind = {}));
/**
* The folding range namespace provides helper functions to work with
* [FoldingRange](#FoldingRange) literals.
*/
var FoldingRange;
(function (FoldingRange) {
/**
* Creates a new FoldingRange literal.
*/
function create(startLine, endLine, startCharacter, endCharacter, kind) {
var result = {
startLine: startLine,
endLine: endLine
};
if (Is.defined(startCharacter)) {
result.startCharacter = startCharacter;
}
if (Is.defined(endCharacter)) {
result.endCharacter = endCharacter;
}
if (Is.defined(kind)) {
result.kind = kind;
}
return result;
}
FoldingRange.create = create;
/**
* Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
*/
function is(value) {
var candidate = value;
return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
&& (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
&& (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
&& (Is.undefined(candidate.kind) || Is.string(candidate.kind));
}
FoldingRange.is = is;
})(FoldingRange || (FoldingRange = {}));
/**
* The DiagnosticRelatedInformation namespace provides helper functions to work with
* [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
*/
var DiagnosticRelatedInformation;
(function (DiagnosticRelatedInformation) {
/**
* Creates a new DiagnosticRelatedInformation literal.
*/
function create(location, message) {
return {
location: location,
message: message
};
}
DiagnosticRelatedInformation.create = create;
/**
* Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
}
DiagnosticRelatedInformation.is = is;
})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
/**
* The diagnostic's severity.
*/
var DiagnosticSeverity;
(function (DiagnosticSeverity) {
/**
* Reports an error.
*/
DiagnosticSeverity.Error = 1;
/**
* Reports a warning.
*/
DiagnosticSeverity.Warning = 2;
/**
* Reports an information.
*/
DiagnosticSeverity.Information = 3;
/**
* Reports a hint.
*/
DiagnosticSeverity.Hint = 4;
})(DiagnosticSeverity || (DiagnosticSeverity = {}));
/**
* The diagnostic tags.
*
* @since 3.15.0
*/
var DiagnosticTag;
(function (DiagnosticTag) {
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out instead of having
* an error squiggle.
*/
DiagnosticTag.Unnecessary = 1;
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
DiagnosticTag.Deprecated = 2;
})(DiagnosticTag || (DiagnosticTag = {}));
/**
* The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
*
* @since 3.16.0
*/
var CodeDescription;
(function (CodeDescription) {
function is(value) {
var candidate = value;
return candidate !== undefined && candidate !== null && Is.string(candidate.href);
}
CodeDescription.is = is;
})(CodeDescription || (CodeDescription = {}));
/**
* The Diagnostic namespace provides helper functions to work with
* [Diagnostic](#Diagnostic) literals.
*/
var Diagnostic;
(function (Diagnostic) {
/**
* Creates a new Diagnostic literal.
*/
function create(range, message, severity, code, source, relatedInformation) {
var result = { range: range, message: message };
if (Is.defined(severity)) {
result.severity = severity;
}
if (Is.defined(code)) {
result.code = code;
}
if (Is.defined(source)) {
result.source = source;
}
if (Is.defined(relatedInformation)) {
result.relatedInformation = relatedInformation;
}
return result;
}
Diagnostic.create = create;
/**
* Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
*/
function is(value) {
var _a;
var candidate = value;
return Is.defined(candidate)
&& Range.is(candidate.range)
&& Is.string(candidate.message)
&& (Is.number(candidate.severity) || Is.undefined(candidate.severity))
&& (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
&& (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
&& (Is.string(candidate.source) || Is.undefined(candidate.source))
&& (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
}
Diagnostic.is = is;
})(Diagnostic || (Diagnostic = {}));
/**
* The Command namespace provides helper functions to work with
* [Command](#Command) literals.
*/
var Command;
(function (Command) {
/**
* Creates a new Command literal.
*/
function create(title, command) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var result = { title: title, command: command };
if (Is.defined(args) && args.length > 0) {
result.arguments = args;
}
return result;
}
Command.create = create;
/**
* Checks whether the given literal conforms to the [Command](#Command) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
}
Command.is = is;
})(Command || (Command = {}));
/**
* The TextEdit namespace provides helper function to create replace,
* insert and delete edits more easily.
*/
var TextEdit;
(function (TextEdit) {
/**
* Creates a replace text edit.
* @param range The range of text to be replaced.
* @param newText The new text.
*/
function replace(range, newText) {
return { range: range, newText: newText };
}
TextEdit.replace = replace;
/**
* Creates a insert text edit.
* @param position The position to insert the text at.
* @param newText The text to be inserted.
*/
function insert(position, newText) {
return { range: { start: position, end: position }, newText: newText };
}
TextEdit.insert = insert;
/**
* Creates a delete text edit.
* @param range The range of text to be deleted.
*/
function del(range) {
return { range: range, newText: '' };
}
TextEdit.del = del;
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate)
&& Is.string(candidate.newText)
&& Range.is(candidate.range);
}
TextEdit.is = is;
})(TextEdit || (TextEdit = {}));
var ChangeAnnotation;
(function (ChangeAnnotation) {
function create(label, needsConfirmation, description) {
var result = { label: label };
if (needsConfirmation !== undefined) {
result.needsConfirmation = needsConfirmation;
}
if (description !== undefined) {
result.description = description;
}
return result;
}
ChangeAnnotation.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
(Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
(Is.string(candidate.description) || candidate.description === undefined);
}
ChangeAnnotation.is = is;
})(ChangeAnnotation || (ChangeAnnotation = {}));
var ChangeAnnotationIdentifier;
(function (ChangeAnnotationIdentifier) {
function is(value) {
var candidate = value;
return typeof candidate === 'string';
}
ChangeAnnotationIdentifier.is = is;
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
var AnnotatedTextEdit;
(function (AnnotatedTextEdit) {
/**
* Creates an annotated replace text edit.
*
* @param range The range of text to be replaced.
* @param newText The new text.
* @param annotation The annotation.
*/
function replace(range, newText, annotation) {
return { range: range, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.replace = replace;
/**
* Creates an annotated insert text edit.
*
* @param position The position to insert the text at.
* @param newText The text to be inserted.
* @param annotation The annotation.
*/
function insert(position, newText, annotation) {
return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.insert = insert;
/**
* Creates an annotated delete text edit.
*
* @param range The range of text to be deleted.
* @param annotation The annotation.
*/
function del(range, annotation) {
return { range: range, newText: '', annotationId: annotation };
}
AnnotatedTextEdit.del = del;
function is(value) {
var candidate = value;
return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
AnnotatedTextEdit.is = is;
})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
/**
* The TextDocumentEdit namespace provides helper function to create
* an edit that manipulates a text document.
*/
var TextDocumentEdit;
(function (TextDocumentEdit) {
/**
* Creates a new `TextDocumentEdit`
*/
function create(textDocument, edits) {
return { textDocument: textDocument, edits: edits };
}
TextDocumentEdit.create = create;
function is(value) {
var candidate = value;
return Is.defined(candidate)
&& OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
&& Array.isArray(candidate.edits);
}
TextDocumentEdit.is = is;
})(TextDocumentEdit || (TextDocumentEdit = {}));
var CreateFile;
(function (CreateFile) {
function create(uri, options, annotation) {
var result = {
kind: 'create',
uri: uri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
CreateFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
CreateFile.is = is;
})(CreateFile || (CreateFile = {}));
var RenameFile;
(function (RenameFile) {
function create(oldUri, newUri, options, annotation) {
var result = {
kind: 'rename',
oldUri: oldUri,
newUri: newUri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
RenameFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
RenameFile.is = is;
})(RenameFile || (RenameFile = {}));
var DeleteFile;
(function (DeleteFile) {
function create(uri, options, annotation) {
var result = {
kind: 'delete',
uri: uri
};
if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
DeleteFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
DeleteFile.is = is;
})(DeleteFile || (DeleteFile = {}));
var WorkspaceEdit;
(function (WorkspaceEdit) {
function is(value) {
var candidate = value;
return candidate &&
(candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
(candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
if (Is.string(change.kind)) {
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
}
else {
return TextDocumentEdit.is(change);
}
}));
}
WorkspaceEdit.is = is;
})(WorkspaceEdit || (WorkspaceEdit = {}));
var TextEditChangeImpl = /** @class */ (function () {
function TextEditChangeImpl(edits, changeAnnotations) {
this.edits = edits;
this.changeAnnotations = changeAnnotations;
}
TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.insert(position, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.insert(position, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.insert(position, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.replace(range, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.replace(range, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.replace(range, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.delete = function (range, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.del(range);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.del(range, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.del(range, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.add = function (edit) {
this.edits.push(edit);
};
TextEditChangeImpl.prototype.all = function () {
return this.edits;
};
TextEditChangeImpl.prototype.clear = function () {
this.edits.splice(0, this.edits.length);
};
TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
if (value === undefined) {
throw new Error("Text edit change is not configured to manage change annotations.");
}
};
return TextEditChangeImpl;
}());
/**
* A helper class
*/
var ChangeAnnotations = /** @class */ (function () {
function ChangeAnnotations(annotations) {
this._annotations = annotations === undefined ? Object.create(null) : annotations;
this._counter = 0;
this._size = 0;
}
ChangeAnnotations.prototype.all = function () {
return this._annotations;
};
Object.defineProperty(ChangeAnnotations.prototype, "size", {
get: function () {
return this._size;
},
enumerable: false,
configurable: true
});
ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
var id;
if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
id = idOrAnnotation;
}
else {
id = this.nextId();
annotation = idOrAnnotation;
}
if (this._annotations[id] !== undefined) {
throw new Error("Id " + id + " is already in use.");
}
if (annotation === undefined) {
throw new Error("No annotation provided for id " + id);
}
this._annotations[id] = annotation;
this._size++;
return id;
};
ChangeAnnotations.prototype.nextId = function () {
this._counter++;
return this._counter.toString();
};
return ChangeAnnotations;
}());
/**
* A workspace change helps constructing changes to a workspace.
*/
var WorkspaceChange = /** @class */ (function () {
function WorkspaceChange(workspaceEdit) {
var _this = this;
this._textEditChanges = Object.create(null);
if (workspaceEdit !== undefined) {
this._workspaceEdit = workspaceEdit;
if (workspaceEdit.documentChanges) {
this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
workspaceEdit.changeAnnotations = this._changeAnnotations.all();
workspaceEdit.documentChanges.forEach(function (change) {
if (TextDocumentEdit.is(change)) {
var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
_this._textEditChanges[change.textDocument.uri] = textEditChange;
}
});
}
else if (workspaceEdit.changes) {
Object.keys(workspaceEdit.changes).forEach(function (key) {
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
_this._textEditChanges[key] = textEditChange;
});
}
}
else {
this._workspaceEdit = {};
}
}
Object.defineProperty(WorkspaceChange.prototype, "edit", {
/**
* Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
* use to be returned from a workspace edit operation like rename.
*/
get: function () {
this.initDocumentChanges();
if (this._changeAnnotations !== undefined) {
if (this._changeAnnotations.size === 0) {
this._workspaceEdit.changeAnnotations = undefined;
}
else {
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
}
return this._workspaceEdit;
},
enumerable: false,
configurable: true
});
WorkspaceChange.prototype.getTextEditChange = function (key) {
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var textDocument = { uri: key.uri, version: key.version };
var result = this._textEditChanges[textDocument.uri];
if (!result) {
var edits = [];
var textDocumentEdit = {
textDocument: textDocument,
edits: edits
};
this._workspaceEdit.documentChanges.push(textDocumentEdit);
result = new TextEditChangeImpl(edits, this._changeAnnotations);
this._textEditChanges[textDocument.uri] = result;
}
return result;
}
else {
this.initChanges();
if (this._workspaceEdit.changes === undefined) {
throw new Error('Workspace edit is not configured for normal text edit changes.');
}
var result = this._textEditChanges[key];
if (!result) {
var edits = [];
this._workspaceEdit.changes[key] = edits;
result = new TextEditChangeImpl(edits);
this._textEditChanges[key] = result;
}
return result;
}
};
WorkspaceChange.prototype.initDocumentChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._changeAnnotations = new ChangeAnnotations();
this._workspaceEdit.documentChanges = [];
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
};
WorkspaceChange.prototype.initChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._workspaceEdit.changes = Object.create(null);
}
};
WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = CreateFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = CreateFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = RenameFile.create(oldUri, newUri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = RenameFile.create(oldUri, newUri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = DeleteFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = DeleteFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
return WorkspaceChange;
}());
/**
* The TextDocumentIdentifier namespace provides helper functions to work with
* [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
*/
var TextDocumentIdentifier;
(function (TextDocumentIdentifier) {
/**
* Creates a new TextDocumentIdentifier literal.
* @param uri The document's uri.
*/
function create(uri) {
return { uri: uri };
}
TextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri);
}
TextDocumentIdentifier.is = is;
})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
/**
* The VersionedTextDocumentIdentifier namespace provides helper functions to work with
* [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
*/
var VersionedTextDocumentIdentifier;
(function (VersionedTextDocumentIdentifier) {
/**
* Creates a new VersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
VersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
}
VersionedTextDocumentIdentifier.is = is;
})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
/**
* The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
* [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
*/
var OptionalVersionedTextDocumentIdentifier;
(function (OptionalVersionedTextDocumentIdentifier) {
/**
* Creates a new OptionalVersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
OptionalVersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
}
OptionalVersionedTextDocumentIdentifier.is = is;
})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
/**
* The TextDocumentItem namespace provides helper functions to work with
* [TextDocumentItem](#TextDocumentItem) literals.
*/
var TextDocumentItem;
(function (TextDocumentItem) {
/**
* Creates a new TextDocumentItem literal.
* @param uri The document's uri.
* @param languageId The document's language identifier.
* @param version The document's version number.
* @param text The document's text.
*/
function create(uri, languageId, version, text) {
return { uri: uri, languageId: languageId, version: version, text: text };
}
TextDocumentItem.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
}
TextDocumentItem.is = is;
})(TextDocumentItem || (TextDocumentItem = {}));
/**
* Describes the content type that a client supports in various
* result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
*
* Please note that `MarkupKinds` must not start with a `$`. This kinds
* are reserved for internal usage.
*/
var MarkupKind;
(function (MarkupKind) {
/**
* Plain text is supported as a content format
*/
MarkupKind.PlainText = 'plaintext';
/**
* Markdown is supported as a content format
*/
MarkupKind.Markdown = 'markdown';
})(MarkupKind || (MarkupKind = {}));
(function (MarkupKind) {
/**
* Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
*/
function is(value) {
var candidate = value;
return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
}
MarkupKind.is = is;
})(MarkupKind || (MarkupKind = {}));
var MarkupContent;
(function (MarkupContent) {
/**
* Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
}
MarkupContent.is = is;
})(MarkupContent || (MarkupContent = {}));
/**
* The kind of a completion entry.
*/
var CompletionItemKind;
(function (CompletionItemKind) {
CompletionItemKind.Text = 1;
CompletionItemKind.Method = 2;
CompletionItemKind.Function = 3;
CompletionItemKind.Constructor = 4;
CompletionItemKind.Field = 5;
CompletionItemKind.Variable = 6;
CompletionItemKind.Class = 7;
CompletionItemKind.Interface = 8;
CompletionItemKind.Module = 9;
CompletionItemKind.Property = 10;
CompletionItemKind.Unit = 11;
CompletionItemKind.Value = 12;
CompletionItemKind.Enum = 13;
CompletionItemKind.Keyword = 14;
CompletionItemKind.Snippet = 15;
CompletionItemKind.Color = 16;
CompletionItemKind.File = 17;
CompletionItemKind.Reference = 18;
CompletionItemKind.Folder = 19;
CompletionItemKind.EnumMember = 20;
CompletionItemKind.Constant = 21;
CompletionItemKind.Struct = 22;
CompletionItemKind.Event = 23;
CompletionItemKind.Operator = 24;
CompletionItemKind.TypeParameter = 25;
})(CompletionItemKind || (CompletionItemKind = {}));
/**
* Defines whether the insert text in a completion item should be interpreted as
* plain text or a snippet.
*/
var InsertTextFormat;
(function (InsertTextFormat) {
/**
* The primary text to be inserted is treated as a plain string.
*/
InsertTextFormat.PlainText = 1;
/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*
* See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
*/
InsertTextFormat.Snippet = 2;
})(InsertTextFormat || (InsertTextFormat = {}));
/**
* Completion item tags are extra annotations that tweak the rendering of a completion
* item.
*
* @since 3.15.0
*/
var CompletionItemTag;
(function (CompletionItemTag) {
/**
* Render a completion as obsolete, usually using a strike-out.
*/
CompletionItemTag.Deprecated = 1;
})(CompletionItemTag || (CompletionItemTag = {}));
/**
* The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
*
* @since 3.16.0
*/
var InsertReplaceEdit;
(function (InsertReplaceEdit) {
/**
* Creates a new insert / replace edit
*/
function create(newText, insert, replace) {
return { newText: newText, insert: insert, replace: replace };
}
InsertReplaceEdit.create = create;
/**
* Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
*/
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
}
InsertReplaceEdit.is = is;
})(InsertReplaceEdit || (InsertReplaceEdit = {}));
/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0
*/
var InsertTextMode;
(function (InsertTextMode) {
/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
InsertTextMode.asIs = 1;
/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: <2tabs><3tabs>foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
InsertTextMode.adjustIndentation = 2;
})(InsertTextMode || (InsertTextMode = {}));
/**
* The CompletionItem namespace provides functions to deal with
* completion items.
*/
var CompletionItem;
(function (CompletionItem) {
/**
* Create a completion item and seed it with a label.
* @param label The completion item's label
*/
function create(label) {
return { label: label };
}
CompletionItem.create = create;
})(CompletionItem || (CompletionItem = {}));
/**
* The CompletionList namespace provides functions to deal with
* completion lists.
*/
var CompletionList;
(function (CompletionList) {
/**
* Creates a new completion list.
*
* @param items The completion items.
* @param isIncomplete The list is not complete.
*/
function create(items, isIncomplete) {
return { items: items ? items : [], isIncomplete: !!isIncomplete };
}
CompletionList.create = create;
})(CompletionList || (CompletionList = {}));
var MarkedString;
(function (MarkedString) {
/**
* Creates a marked string from plain text.
*
* @param plainText The plain text.
*/
function fromPlainText(plainText) {
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}
MarkedString.fromPlainText = fromPlainText;
/**
* Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
*/
function is(value) {
var candidate = value;
return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
}
MarkedString.is = is;
})(MarkedString || (MarkedString = {}));
var Hover;
(function (Hover) {
/**
* Checks whether the given value conforms to the [Hover](#Hover) interface.
*/
function is(value) {
var candidate = value;
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
MarkedString.is(candidate.contents) ||
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
}
Hover.is = is;
})(Hover || (Hover = {}));
/**
* The ParameterInformation namespace provides helper functions to work with
* [ParameterInformation](#ParameterInformation) literals.
*/
var ParameterInformation;
(function (ParameterInformation) {
/**
* Creates a new parameter information literal.
*
* @param label A label string.
* @param documentation A doc string.
*/
function create(label, documentation) {
return documentation ? { label: label, documentation: documentation } : { label: label };
}
ParameterInformation.create = create;
})(ParameterInformation || (ParameterInformation = {}));
/**
* The SignatureInformation namespace provides helper functions to work with
* [SignatureInformation](#SignatureInformation) literals.
*/
var SignatureInformation;
(function (SignatureInformation) {
function create(label, documentation) {
var parameters = [];
for (var _i = 2; _i < arguments.length; _i++) {
parameters[_i - 2] = arguments[_i];
}
var result = { label: label };
if (Is.defined(documentation)) {
result.documentation = documentation;
}
if (Is.defined(parameters)) {
result.parameters = parameters;
}
else {
result.parameters = [];
}
return result;
}
SignatureInformation.create = create;
})(SignatureInformation || (SignatureInformation = {}));
/**
* A document highlight kind.
*/
var DocumentHighlightKind;
(function (DocumentHighlightKind) {
/**
* A textual occurrence.
*/
DocumentHighlightKind.Text = 1;
/**
* Read-access of a symbol, like reading a variable.
*/
DocumentHighlightKind.Read = 2;
/**
* Write-access of a symbol, like writing to a variable.
*/
DocumentHighlightKind.Write = 3;
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
/**
* DocumentHighlight namespace to provide helper functions to work with
* [DocumentHighlight](#DocumentHighlight) literals.
*/
var DocumentHighlight;
(function (DocumentHighlight) {
/**
* Create a DocumentHighlight object.
* @param range The range the highlight applies to.
*/
function create(range, kind) {
var result = { range: range };
if (Is.number(kind)) {
result.kind = kind;
}
return result;
}
DocumentHighlight.create = create;
})(DocumentHighlight || (DocumentHighlight = {}));
/**
* A symbol kind.
*/
var SymbolKind;
(function (SymbolKind) {
SymbolKind.File = 1;
SymbolKind.Module = 2;
SymbolKind.Namespace = 3;
SymbolKind.Package = 4;
SymbolKind.Class = 5;
SymbolKind.Method = 6;
SymbolKind.Property = 7;
SymbolKind.Field = 8;
SymbolKind.Constructor = 9;
SymbolKind.Enum = 10;
SymbolKind.Interface = 11;
SymbolKind.Function = 12;
SymbolKind.Variable = 13;
SymbolKind.Constant = 14;
SymbolKind.String = 15;
SymbolKind.Number = 16;
SymbolKind.Boolean = 17;
SymbolKind.Array = 18;
SymbolKind.Object = 19;
SymbolKind.Key = 20;
SymbolKind.Null = 21;
SymbolKind.EnumMember = 22;
SymbolKind.Struct = 23;
SymbolKind.Event = 24;
SymbolKind.Operator = 25;
SymbolKind.TypeParameter = 26;
})(SymbolKind || (SymbolKind = {}));
/**
* Symbol tags are extra annotations that tweak the rendering of a symbol.
* @since 3.16
*/
var SymbolTag;
(function (SymbolTag) {
/**
* Render a symbol as obsolete, usually using a strike-out.
*/
SymbolTag.Deprecated = 1;
})(SymbolTag || (SymbolTag = {}));
var SymbolInformation;
(function (SymbolInformation) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the location of the symbol.
* @param uri The resource of the location of symbol, defaults to the current document.
* @param containerName The name of the symbol containing the symbol.
*/
function create(name, kind, range, uri, containerName) {
var result = {
name: name,
kind: kind,
location: { uri: uri, range: range }
};
if (containerName) {
result.containerName = containerName;
}
return result;
}
SymbolInformation.create = create;
})(SymbolInformation || (SymbolInformation = {}));
var DocumentSymbol;
(function (DocumentSymbol) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param detail The detail of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the symbol.
* @param selectionRange The selectionRange of the symbol.
* @param children Children of the symbol.
*/
function create(name, detail, kind, range, selectionRange, children) {
var result = {
name: name,
detail: detail,
kind: kind,
range: range,
selectionRange: selectionRange
};
if (children !== undefined) {
result.children = children;
}
return result;
}
DocumentSymbol.create = create;
/**
* Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
*/
function is(value) {
var candidate = value;
return candidate &&
Is.string(candidate.name) && Is.number(candidate.kind) &&
Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
(candidate.detail === undefined || Is.string(candidate.detail)) &&
(candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
(candidate.children === undefined || Array.isArray(candidate.children)) &&
(candidate.tags === undefined || Array.isArray(candidate.tags));
}
DocumentSymbol.is = is;
})(DocumentSymbol || (DocumentSymbol = {}));
/**
* A set of predefined code action kinds
*/
var CodeActionKind;
(function (CodeActionKind) {
/**
* Empty kind.
*/
CodeActionKind.Empty = '';
/**
* Base kind for quickfix actions: 'quickfix'
*/
CodeActionKind.QuickFix = 'quickfix';
/**
* Base kind for refactoring actions: 'refactor'
*/
CodeActionKind.Refactor = 'refactor';
/**
* Base kind for refactoring extraction actions: 'refactor.extract'
*
* Example extract actions:
*
* - Extract method
* - Extract function
* - Extract variable
* - Extract interface from class
* - ...
*/
CodeActionKind.RefactorExtract = 'refactor.extract';
/**
* Base kind for refactoring inline actions: 'refactor.inline'
*
* Example inline actions:
*
* - Inline function
* - Inline variable
* - Inline constant
* - ...
*/
CodeActionKind.RefactorInline = 'refactor.inline';
/**
* Base kind for refactoring rewrite actions: 'refactor.rewrite'
*
* Example rewrite actions:
*
* - Convert JavaScript function to class
* - Add or remove parameter
* - Encapsulate field
* - Make method static
* - Move method to base class
* - ...
*/
CodeActionKind.RefactorRewrite = 'refactor.rewrite';
/**
* Base kind for source actions: `source`
*
* Source code actions apply to the entire file.
*/
CodeActionKind.Source = 'source';
/**
* Base kind for an organize imports source action: `source.organizeImports`
*/
CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
/**
* Base kind for auto-fix source actions: `source.fixAll`.
*
* Fix all actions automatically fix errors that have a clear fix that do not require user input.
* They should not suppress errors or perform unsafe fixes such as generating new types or classes.
*
* @since 3.15.0
*/
CodeActionKind.SourceFixAll = 'source.fixAll';
})(CodeActionKind || (CodeActionKind = {}));
/**
* The CodeActionContext namespace provides helper functions to work with
* [CodeActionContext](#CodeActionContext) literals.
*/
var CodeActionContext;
(function (CodeActionContext) {
/**
* Creates a new CodeActionContext literal.
*/
function create(diagnostics, only) {
var result = { diagnostics: diagnostics };
if (only !== undefined && only !== null) {
result.only = only;
}
return result;
}
CodeActionContext.create = create;
/**
* Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
}
CodeActionContext.is = is;
})(CodeActionContext || (CodeActionContext = {}));
var CodeAction;
(function (CodeAction) {
function create(title, kindOrCommandOrEdit, kind) {
var result = { title: title };
var checkKind = true;
if (typeof kindOrCommandOrEdit === 'string') {
checkKind = false;
result.kind = kindOrCommandOrEdit;
}
else if (Command.is(kindOrCommandOrEdit)) {
result.command = kindOrCommandOrEdit;
}
else {
result.edit = kindOrCommandOrEdit;
}
if (checkKind && kind !== undefined) {
result.kind = kind;
}
return result;
}
CodeAction.create = create;
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.title) &&
(candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
(candidate.kind === undefined || Is.string(candidate.kind)) &&
(candidate.edit !== undefined || candidate.command !== undefined) &&
(candidate.command === undefined || Command.is(candidate.command)) &&
(candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
}
CodeAction.is = is;
})(CodeAction || (CodeAction = {}));
/**
* The CodeLens namespace provides helper functions to work with
* [CodeLens](#CodeLens) literals.
*/
var CodeLens;
(function (CodeLens) {
/**
* Creates a new CodeLens literal.
*/
function create(range, data) {
var result = { range: range };
if (Is.defined(data)) {
result.data = data;
}
return result;
}
CodeLens.create = create;
/**
* Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
}
CodeLens.is = is;
})(CodeLens || (CodeLens = {}));
/**
* The FormattingOptions namespace provides helper functions to work with
* [FormattingOptions](#FormattingOptions) literals.
*/
var FormattingOptions;
(function (FormattingOptions) {
/**
* Creates a new FormattingOptions literal.
*/
function create(tabSize, insertSpaces) {
return { tabSize: tabSize, insertSpaces: insertSpaces };
}
FormattingOptions.create = create;
/**
* Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
}
FormattingOptions.is = is;
})(FormattingOptions || (FormattingOptions = {}));
/**
* The DocumentLink namespace provides helper functions to work with
* [DocumentLink](#DocumentLink) literals.
*/
var DocumentLink;
(function (DocumentLink) {
/**
* Creates a new DocumentLink literal.
*/
function create(range, target, data) {
return { range: range, target: target, data: data };
}
DocumentLink.create = create;
/**
* Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
}
DocumentLink.is = is;
})(DocumentLink || (DocumentLink = {}));
/**
* The SelectionRange namespace provides helper function to work with
* SelectionRange literals.
*/
var SelectionRange;
(function (SelectionRange) {
/**
* Creates a new SelectionRange
* @param range the range.
* @param parent an optional parent.
*/
function create(range, parent) {
return { range: range, parent: parent };
}
SelectionRange.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
}
SelectionRange.is = is;
})(SelectionRange || (SelectionRange = {}));
var EOL = ['\n', '\r\n', '\r'];
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var TextDocument;
(function (TextDocument) {
/**
* Creates a new ITextDocument literal from the given uri and content.
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
&& Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
}
TextDocument.is = is;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits, function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = text.length;
for (var i = sortedEdits.length - 1; i >= 0; i--) {
var e = sortedEdits[i];
var startOffset = document.offsetAt(e.range.start);
var endOffset = document.offsetAt(e.range.end);
if (endOffset <= lastModifiedOffset) {
text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
}
else {
throw new Error('Overlapping edit');
}
lastModifiedOffset = startOffset;
}
return text;
}
TextDocument.applyEdits = applyEdits;
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
})(TextDocument || (TextDocument = {}));
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: false,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (event, version) {
this._content = event.text;
this._version = version;
this._lineOffsets = undefined;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
var lineOffsets = [];
var text = this._content;
var isLineStart = true;
for (var i = 0; i < text.length; i++) {
if (isLineStart) {
lineOffsets.push(i);
isLineStart = false;
}
var ch = text.charAt(i);
isLineStart = (ch === '\r' || ch === '\n');
if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
i++;
}
}
if (isLineStart && text.length > 0) {
lineOffsets.push(text.length);
}
this._lineOffsets = lineOffsets;
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return Position.create(0, offset);
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return Position.create(line, offset - lineOffsets[line]);
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: false,
configurable: true
});
return FullTextDocument;
}());
var Is;
(function (Is) {
var toString = Object.prototype.toString;
function defined(value) {
return typeof value !== 'undefined';
}
Is.defined = defined;
function undefined(value) {
return typeof value === 'undefined';
}
Is.undefined = undefined;
function boolean(value) {
return value === true || value === false;
}
Is.boolean = boolean;
function string(value) {
return toString.call(value) === '[object String]';
}
Is.string = string;
function number(value) {
return toString.call(value) === '[object Number]';
}
Is.number = number;
function numberRange(value, min, max) {
return toString.call(value) === '[object Number]' && min <= value && value <= max;
}
Is.numberRange = numberRange;
function integer(value) {
return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
}
Is.integer = integer;
function uinteger(value) {
return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
}
Is.uinteger = uinteger;
function func(value) {
return toString.call(value) === '[object Function]';
}
Is.func = func;
function objectLiteral(value) {
// Strictly speaking class instances pass this check as well. Since the LSP
// doesn't use classes we ignore this for now. If we do we need to add something
// like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
return value !== null && typeof value === 'object';
}
Is.objectLiteral = objectLiteral;
function typedArray(value, check) {
return Array.isArray(value) && value.every(check);
}
Is.typedArray = typedArray;
})(Is || (Is = {}));
/***/ }),
/* 90 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "TextDocument": () => /* binding */ TextDocument
/* harmony export */ });
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: true,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (changes, version) {
for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) {
var change = changes_1[_i];
if (FullTextDocument.isIncremental(change)) {
// makes sure start is before end
var range = getWellformedRange(change.range);
// update content
var startOffset = this.offsetAt(range.start);
var endOffset = this.offsetAt(range.end);
this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length);
// update the offsets
var startLine = Math.max(range.start.line, 0);
var endLine = Math.max(range.end.line, 0);
var lineOffsets = this._lineOffsets;
var addedLineOffsets = computeLineOffsets(change.text, false, startOffset);
if (endLine - startLine === addedLineOffsets.length) {
for (var i = 0, len = addedLineOffsets.length; i < len; i++) {
lineOffsets[i + startLine + 1] = addedLineOffsets[i];
}
}
else {
if (addedLineOffsets.length < 10000) {
lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets));
}
else { // avoid too many arguments for splice
this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1));
}
}
var diff = change.text.length - (endOffset - startOffset);
if (diff !== 0) {
for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) {
lineOffsets[i] = lineOffsets[i] + diff;
}
}
}
else if (FullTextDocument.isFull(change)) {
this._content = change.text;
this._lineOffsets = undefined;
}
else {
throw new Error('Unknown change event received');
}
}
this._version = version;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
this._lineOffsets = computeLineOffsets(this._content, true);
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return { line: 0, character: offset };
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return { line: line, character: offset - lineOffsets[line] };
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: true,
configurable: true
});
FullTextDocument.isIncremental = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range !== undefined &&
(candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number');
};
FullTextDocument.isFull = function (event) {
var candidate = event;
return candidate !== undefined && candidate !== null &&
typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined;
};
return FullTextDocument;
}());
var TextDocument;
(function (TextDocument) {
/**
* Creates a new text document.
*
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param version The document's initial version number.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Updates a TextDocument by modifing its content.
*
* @param document the document to update. Only documents created by TextDocument.create are valid inputs.
* @param changes the changes to apply to the document.
* @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter.
*
*/
function update(document, changes, version) {
if (document instanceof FullTextDocument) {
document.update(changes, version);
return document;
}
else {
throw new Error('TextDocument.update: document must be created by TextDocument.create');
}
}
TextDocument.update = update;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = 0;
var spans = [];
for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) {
var e = sortedEdits_1[_i];
var startOffset = document.offsetAt(e.range.start);
if (startOffset < lastModifiedOffset) {
throw new Error('Overlapping edit');
}
else if (startOffset > lastModifiedOffset) {
spans.push(text.substring(lastModifiedOffset, startOffset));
}
if (e.newText.length) {
spans.push(e.newText);
}
lastModifiedOffset = document.offsetAt(e.range.end);
}
spans.push(text.substr(lastModifiedOffset));
return spans.join('');
}
TextDocument.applyEdits = applyEdits;
})(TextDocument || (TextDocument = {}));
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
function computeLineOffsets(text, isAtLineStart, textOffset) {
if (textOffset === void 0) { textOffset = 0; }
var result = isAtLineStart ? [textOffset] : [];
for (var i = 0; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) {
if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) {
i++;
}
result.push(textOffset + i + 1);
}
}
return result;
}
function getWellformedRange(range) {
var start = range.start;
var end = range.end;
if (start.line > end.line || (start.line === end.line && start.character > end.character)) {
return { start: end, end: start };
}
return range;
}
function getWellformedEdit(textEdit) {
var range = getWellformedRange(textEdit.range);
if (range !== textEdit.range) {
return { newText: textEdit.newText, range: range };
}
return textEdit;
}
/***/ }),
/* 91 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "PathCompletionParticipant": () => /* binding */ PathCompletionParticipant
/* harmony export */ });
/* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(88);
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75);
/* harmony import */ var _utils_resources__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(92);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var PathCompletionParticipant = /** @class */ (function () {
function PathCompletionParticipant(readDirectory) {
this.readDirectory = readDirectory;
this.literalCompletions = [];
this.importCompletions = [];
}
PathCompletionParticipant.prototype.onCssURILiteralValue = function (context) {
this.literalCompletions.push(context);
};
PathCompletionParticipant.prototype.onCssImportPath = function (context) {
this.importCompletions.push(context);
};
PathCompletionParticipant.prototype.computeCompletions = function (document, documentContext) {
return __awaiter(this, void 0, void 0, function () {
var result, _i, _a, literalCompletion, uriValue, fullValue, items, _b, items_1, item, _c, _d, importCompletion, pathValue, fullValue, suggestions, _e, suggestions_1, item;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
result = { items: [], isIncomplete: false };
_i = 0, _a = this.literalCompletions;
_f.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 5];
literalCompletion = _a[_i];
uriValue = literalCompletion.uriValue;
fullValue = stripQuotes(uriValue);
if (!(fullValue === '.' || fullValue === '..')) return [3 /*break*/, 2];
result.isIncomplete = true;
return [3 /*break*/, 4];
case 2: return [4 /*yield*/, this.providePathSuggestions(uriValue, literalCompletion.position, literalCompletion.range, document, documentContext)];
case 3:
items = _f.sent();
for (_b = 0, items_1 = items; _b < items_1.length; _b++) {
item = items_1[_b];
result.items.push(item);
}
_f.label = 4;
case 4:
_i++;
return [3 /*break*/, 1];
case 5:
_c = 0, _d = this.importCompletions;
_f.label = 6;
case 6:
if (!(_c < _d.length)) return [3 /*break*/, 10];
importCompletion = _d[_c];
pathValue = importCompletion.pathValue;
fullValue = stripQuotes(pathValue);
if (!(fullValue === '.' || fullValue === '..')) return [3 /*break*/, 7];
result.isIncomplete = true;
return [3 /*break*/, 9];
case 7: return [4 /*yield*/, this.providePathSuggestions(pathValue, importCompletion.position, importCompletion.range, document, documentContext)];
case 8:
suggestions = _f.sent();
if (document.languageId === 'scss') {
suggestions.forEach(function (s) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(s.label, '_') && (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.endsWith)(s.label, '.scss')) {
if (s.textEdit) {
s.textEdit.newText = s.label.slice(1, -5);
}
else {
s.label = s.label.slice(1, -5);
}
}
});
}
for (_e = 0, suggestions_1 = suggestions; _e < suggestions_1.length; _e++) {
item = suggestions_1[_e];
result.items.push(item);
}
_f.label = 9;
case 9:
_c++;
return [3 /*break*/, 6];
case 10: return [2 /*return*/, result];
}
});
});
};
PathCompletionParticipant.prototype.providePathSuggestions = function (pathValue, position, range, document, documentContext) {
return __awaiter(this, void 0, void 0, function () {
var fullValue, isValueQuoted, valueBeforeCursor, currentDocUri, fullValueRange, replaceRange, valueBeforeLastSlash, parentDir, result, infos, _i, infos_1, _a, name, type, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
fullValue = stripQuotes(pathValue);
isValueQuoted = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(pathValue, "'") || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(pathValue, "\"");
valueBeforeCursor = isValueQuoted
? fullValue.slice(0, position.character - (range.start.character + 1))
: fullValue.slice(0, position.character - range.start.character);
currentDocUri = document.uri;
fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range;
replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange);
valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf('/') + 1);
parentDir = documentContext.resolveReference(valueBeforeLastSlash || '.', currentDocUri);
if (!parentDir) return [3 /*break*/, 4];
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
result = [];
return [4 /*yield*/, this.readDirectory(parentDir)];
case 2:
infos = _b.sent();
for (_i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
_a = infos_1[_i], name = _a[0], type = _a[1];
// Exclude paths that start with `.`
if (name.charCodeAt(0) !== CharCode_dot && (type === _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__.FileType.Directory || (0,_utils_resources__WEBPACK_IMPORTED_MODULE_2__.joinPath)(parentDir, name) !== currentDocUri)) {
result.push(createCompletionItem(name, type === _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__.FileType.Directory, replaceRange));
}
}
return [2 /*return*/, result];
case 3:
e_1 = _b.sent();
return [3 /*break*/, 4];
case 4: return [2 /*return*/, []];
}
});
});
};
return PathCompletionParticipant;
}());
var CharCode_dot = '.'.charCodeAt(0);
function stripQuotes(fullValue) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(fullValue, "'") || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(fullValue, "\"")) {
return fullValue.slice(1, -1);
}
else {
return fullValue;
}
}
function pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange) {
var replaceRange;
var lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/');
if (lastIndexOfSlash === -1) {
replaceRange = fullValueRange;
}
else {
// For cases where cursor is in the middle of attribute value, like {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "TextDocument": () => /* reexport safe */ vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__.TextDocument,
/* harmony export */ "AnnotatedTextEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.AnnotatedTextEdit,
/* harmony export */ "ChangeAnnotation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ChangeAnnotationIdentifier,
/* harmony export */ "CodeAction": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeAction,
/* harmony export */ "CodeActionContext": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionContext,
/* harmony export */ "CodeActionKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionKind,
/* harmony export */ "CodeDescription": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeDescription,
/* harmony export */ "CodeLens": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeLens,
/* harmony export */ "Color": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Color,
/* harmony export */ "ColorInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorInformation,
/* harmony export */ "ColorPresentation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorPresentation,
/* harmony export */ "Command": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Command,
/* harmony export */ "CompletionItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItem,
/* harmony export */ "CompletionItemKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemKind,
/* harmony export */ "CompletionItemTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemTag,
/* harmony export */ "CompletionList": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionList,
/* harmony export */ "CreateFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CreateFile,
/* harmony export */ "DeleteFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DeleteFile,
/* harmony export */ "Diagnostic": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Diagnostic,
/* harmony export */ "DiagnosticRelatedInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticTag,
/* harmony export */ "DocumentHighlight": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlight,
/* harmony export */ "DocumentHighlightKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlightKind,
/* harmony export */ "DocumentLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentLink,
/* harmony export */ "DocumentSymbol": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentSymbol,
/* harmony export */ "EOL": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.EOL,
/* harmony export */ "FoldingRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRange,
/* harmony export */ "FoldingRangeKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRangeKind,
/* harmony export */ "FormattingOptions": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FormattingOptions,
/* harmony export */ "Hover": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Hover,
/* harmony export */ "InsertReplaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertReplaceEdit,
/* harmony export */ "InsertTextFormat": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertTextFormat,
/* harmony export */ "InsertTextMode": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertTextMode,
/* harmony export */ "Location": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Location,
/* harmony export */ "LocationLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.LocationLink,
/* harmony export */ "MarkedString": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkedString,
/* harmony export */ "MarkupContent": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupContent,
/* harmony export */ "MarkupKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "ParameterInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ParameterInformation,
/* harmony export */ "Position": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Position,
/* harmony export */ "Range": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Range,
/* harmony export */ "RenameFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.RenameFile,
/* harmony export */ "SelectionRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SelectionRange,
/* harmony export */ "SignatureInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SignatureInformation,
/* harmony export */ "SymbolInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolInformation,
/* harmony export */ "SymbolKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolKind,
/* harmony export */ "SymbolTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolTag,
/* harmony export */ "TextDocumentEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentEdit,
/* harmony export */ "TextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentItem,
/* harmony export */ "TextEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextEdit,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.VersionedTextDocumentIdentifier,
/* harmony export */ "WorkspaceChange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceChange,
/* harmony export */ "WorkspaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceEdit,
/* harmony export */ "integer": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.integer,
/* harmony export */ "uinteger": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.uinteger,
/* harmony export */ "TokenType": () => /* binding */ TokenType,
/* harmony export */ "ScannerState": () => /* binding */ ScannerState,
/* harmony export */ "ClientCapabilities": () => /* binding */ ClientCapabilities,
/* harmony export */ "FileType": () => /* binding */ FileType
/* harmony export */ });
/* harmony import */ var vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(118);
/* harmony import */ var vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(90);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var TokenType;
(function (TokenType) {
TokenType[TokenType["StartCommentTag"] = 0] = "StartCommentTag";
TokenType[TokenType["Comment"] = 1] = "Comment";
TokenType[TokenType["EndCommentTag"] = 2] = "EndCommentTag";
TokenType[TokenType["StartTagOpen"] = 3] = "StartTagOpen";
TokenType[TokenType["StartTagClose"] = 4] = "StartTagClose";
TokenType[TokenType["StartTagSelfClose"] = 5] = "StartTagSelfClose";
TokenType[TokenType["StartTag"] = 6] = "StartTag";
TokenType[TokenType["EndTagOpen"] = 7] = "EndTagOpen";
TokenType[TokenType["EndTagClose"] = 8] = "EndTagClose";
TokenType[TokenType["EndTag"] = 9] = "EndTag";
TokenType[TokenType["DelimiterAssign"] = 10] = "DelimiterAssign";
TokenType[TokenType["AttributeName"] = 11] = "AttributeName";
TokenType[TokenType["AttributeValue"] = 12] = "AttributeValue";
TokenType[TokenType["StartDoctypeTag"] = 13] = "StartDoctypeTag";
TokenType[TokenType["Doctype"] = 14] = "Doctype";
TokenType[TokenType["EndDoctypeTag"] = 15] = "EndDoctypeTag";
TokenType[TokenType["Content"] = 16] = "Content";
TokenType[TokenType["Whitespace"] = 17] = "Whitespace";
TokenType[TokenType["Unknown"] = 18] = "Unknown";
TokenType[TokenType["Script"] = 19] = "Script";
TokenType[TokenType["Styles"] = 20] = "Styles";
TokenType[TokenType["EOS"] = 21] = "EOS";
})(TokenType || (TokenType = {}));
var ScannerState;
(function (ScannerState) {
ScannerState[ScannerState["WithinContent"] = 0] = "WithinContent";
ScannerState[ScannerState["AfterOpeningStartTag"] = 1] = "AfterOpeningStartTag";
ScannerState[ScannerState["AfterOpeningEndTag"] = 2] = "AfterOpeningEndTag";
ScannerState[ScannerState["WithinDoctype"] = 3] = "WithinDoctype";
ScannerState[ScannerState["WithinTag"] = 4] = "WithinTag";
ScannerState[ScannerState["WithinEndTag"] = 5] = "WithinEndTag";
ScannerState[ScannerState["WithinComment"] = 6] = "WithinComment";
ScannerState[ScannerState["WithinScriptContent"] = 7] = "WithinScriptContent";
ScannerState[ScannerState["WithinStyleContent"] = 8] = "WithinStyleContent";
ScannerState[ScannerState["AfterAttributeName"] = 9] = "AfterAttributeName";
ScannerState[ScannerState["BeforeAttributeValue"] = 10] = "BeforeAttributeValue";
})(ScannerState || (ScannerState = {}));
var ClientCapabilities;
(function (ClientCapabilities) {
ClientCapabilities.LATEST = {
textDocument: {
completion: {
completionItem: {
documentationFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText]
}
},
hover: {
contentFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText]
}
}
};
})(ClientCapabilities || (ClientCapabilities = {}));
var FileType;
(function (FileType) {
/**
* The file type is unknown.
*/
FileType[FileType["Unknown"] = 0] = "Unknown";
/**
* A regular file.
*/
FileType[FileType["File"] = 1] = "File";
/**
* A directory.
*/
FileType[FileType["Directory"] = 2] = "Directory";
/**
* A symbolic link to a file.
*/
FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
})(FileType || (FileType = {}));
/***/ }),
/* 118 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "integer": () => /* binding */ integer,
/* harmony export */ "uinteger": () => /* binding */ uinteger,
/* harmony export */ "Position": () => /* binding */ Position,
/* harmony export */ "Range": () => /* binding */ Range,
/* harmony export */ "Location": () => /* binding */ Location,
/* harmony export */ "LocationLink": () => /* binding */ LocationLink,
/* harmony export */ "Color": () => /* binding */ Color,
/* harmony export */ "ColorInformation": () => /* binding */ ColorInformation,
/* harmony export */ "ColorPresentation": () => /* binding */ ColorPresentation,
/* harmony export */ "FoldingRangeKind": () => /* binding */ FoldingRangeKind,
/* harmony export */ "FoldingRange": () => /* binding */ FoldingRange,
/* harmony export */ "DiagnosticRelatedInformation": () => /* binding */ DiagnosticRelatedInformation,
/* harmony export */ "DiagnosticSeverity": () => /* binding */ DiagnosticSeverity,
/* harmony export */ "DiagnosticTag": () => /* binding */ DiagnosticTag,
/* harmony export */ "CodeDescription": () => /* binding */ CodeDescription,
/* harmony export */ "Diagnostic": () => /* binding */ Diagnostic,
/* harmony export */ "Command": () => /* binding */ Command,
/* harmony export */ "TextEdit": () => /* binding */ TextEdit,
/* harmony export */ "ChangeAnnotation": () => /* binding */ ChangeAnnotation,
/* harmony export */ "ChangeAnnotationIdentifier": () => /* binding */ ChangeAnnotationIdentifier,
/* harmony export */ "AnnotatedTextEdit": () => /* binding */ AnnotatedTextEdit,
/* harmony export */ "TextDocumentEdit": () => /* binding */ TextDocumentEdit,
/* harmony export */ "CreateFile": () => /* binding */ CreateFile,
/* harmony export */ "RenameFile": () => /* binding */ RenameFile,
/* harmony export */ "DeleteFile": () => /* binding */ DeleteFile,
/* harmony export */ "WorkspaceEdit": () => /* binding */ WorkspaceEdit,
/* harmony export */ "WorkspaceChange": () => /* binding */ WorkspaceChange,
/* harmony export */ "TextDocumentIdentifier": () => /* binding */ TextDocumentIdentifier,
/* harmony export */ "VersionedTextDocumentIdentifier": () => /* binding */ VersionedTextDocumentIdentifier,
/* harmony export */ "OptionalVersionedTextDocumentIdentifier": () => /* binding */ OptionalVersionedTextDocumentIdentifier,
/* harmony export */ "TextDocumentItem": () => /* binding */ TextDocumentItem,
/* harmony export */ "MarkupKind": () => /* binding */ MarkupKind,
/* harmony export */ "MarkupContent": () => /* binding */ MarkupContent,
/* harmony export */ "CompletionItemKind": () => /* binding */ CompletionItemKind,
/* harmony export */ "InsertTextFormat": () => /* binding */ InsertTextFormat,
/* harmony export */ "CompletionItemTag": () => /* binding */ CompletionItemTag,
/* harmony export */ "InsertReplaceEdit": () => /* binding */ InsertReplaceEdit,
/* harmony export */ "InsertTextMode": () => /* binding */ InsertTextMode,
/* harmony export */ "CompletionItem": () => /* binding */ CompletionItem,
/* harmony export */ "CompletionList": () => /* binding */ CompletionList,
/* harmony export */ "MarkedString": () => /* binding */ MarkedString,
/* harmony export */ "Hover": () => /* binding */ Hover,
/* harmony export */ "ParameterInformation": () => /* binding */ ParameterInformation,
/* harmony export */ "SignatureInformation": () => /* binding */ SignatureInformation,
/* harmony export */ "DocumentHighlightKind": () => /* binding */ DocumentHighlightKind,
/* harmony export */ "DocumentHighlight": () => /* binding */ DocumentHighlight,
/* harmony export */ "SymbolKind": () => /* binding */ SymbolKind,
/* harmony export */ "SymbolTag": () => /* binding */ SymbolTag,
/* harmony export */ "SymbolInformation": () => /* binding */ SymbolInformation,
/* harmony export */ "DocumentSymbol": () => /* binding */ DocumentSymbol,
/* harmony export */ "CodeActionKind": () => /* binding */ CodeActionKind,
/* harmony export */ "CodeActionContext": () => /* binding */ CodeActionContext,
/* harmony export */ "CodeAction": () => /* binding */ CodeAction,
/* harmony export */ "CodeLens": () => /* binding */ CodeLens,
/* harmony export */ "FormattingOptions": () => /* binding */ FormattingOptions,
/* harmony export */ "DocumentLink": () => /* binding */ DocumentLink,
/* harmony export */ "SelectionRange": () => /* binding */ SelectionRange,
/* harmony export */ "EOL": () => /* binding */ EOL,
/* harmony export */ "TextDocument": () => /* binding */ TextDocument
/* harmony export */ });
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
var integer;
(function (integer) {
integer.MIN_VALUE = -2147483648;
integer.MAX_VALUE = 2147483647;
})(integer || (integer = {}));
var uinteger;
(function (uinteger) {
uinteger.MIN_VALUE = 0;
uinteger.MAX_VALUE = 2147483647;
})(uinteger || (uinteger = {}));
/**
* The Position namespace provides helper functions to work with
* [Position](#Position) literals.
*/
var Position;
(function (Position) {
/**
* Creates a new Position literal from the given line and character.
* @param line The position's line.
* @param character The position's character.
*/
function create(line, character) {
if (line === Number.MAX_VALUE) {
line = uinteger.MAX_VALUE;
}
if (character === Number.MAX_VALUE) {
character = uinteger.MAX_VALUE;
}
return { line: line, character: character };
}
Position.create = create;
/**
* Checks whether the given literal conforms to the [Position](#Position) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
}
Position.is = is;
})(Position || (Position = {}));
/**
* The Range namespace provides helper functions to work with
* [Range](#Range) literals.
*/
var Range;
(function (Range) {
function create(one, two, three, four) {
if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
return { start: Position.create(one, two), end: Position.create(three, four) };
}
else if (Position.is(one) && Position.is(two)) {
return { start: one, end: two };
}
else {
throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
}
}
Range.create = create;
/**
* Checks whether the given literal conforms to the [Range](#Range) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
}
Range.is = is;
})(Range || (Range = {}));
/**
* The Location namespace provides helper functions to work with
* [Location](#Location) literals.
*/
var Location;
(function (Location) {
/**
* Creates a Location literal.
* @param uri The location's uri.
* @param range The location's range.
*/
function create(uri, range) {
return { uri: uri, range: range };
}
Location.create = create;
/**
* Checks whether the given literal conforms to the [Location](#Location) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
}
Location.is = is;
})(Location || (Location = {}));
/**
* The LocationLink namespace provides helper functions to work with
* [LocationLink](#LocationLink) literals.
*/
var LocationLink;
(function (LocationLink) {
/**
* Creates a LocationLink literal.
* @param targetUri The definition's uri.
* @param targetRange The full range of the definition.
* @param targetSelectionRange The span of the symbol definition at the target.
* @param originSelectionRange The span of the symbol being defined in the originating source file.
*/
function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };
}
LocationLink.create = create;
/**
* Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)
&& (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))
&& (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
}
LocationLink.is = is;
})(LocationLink || (LocationLink = {}));
/**
* The Color namespace provides helper functions to work with
* [Color](#Color) literals.
*/
var Color;
(function (Color) {
/**
* Creates a new Color literal.
*/
function create(red, green, blue, alpha) {
return {
red: red,
green: green,
blue: blue,
alpha: alpha,
};
}
Color.create = create;
/**
* Checks whether the given literal conforms to the [Color](#Color) interface.
*/
function is(value) {
var candidate = value;
return Is.numberRange(candidate.red, 0, 1)
&& Is.numberRange(candidate.green, 0, 1)
&& Is.numberRange(candidate.blue, 0, 1)
&& Is.numberRange(candidate.alpha, 0, 1);
}
Color.is = is;
})(Color || (Color = {}));
/**
* The ColorInformation namespace provides helper functions to work with
* [ColorInformation](#ColorInformation) literals.
*/
var ColorInformation;
(function (ColorInformation) {
/**
* Creates a new ColorInformation literal.
*/
function create(range, color) {
return {
range: range,
color: color,
};
}
ColorInformation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Range.is(candidate.range) && Color.is(candidate.color);
}
ColorInformation.is = is;
})(ColorInformation || (ColorInformation = {}));
/**
* The Color namespace provides helper functions to work with
* [ColorPresentation](#ColorPresentation) literals.
*/
var ColorPresentation;
(function (ColorPresentation) {
/**
* Creates a new ColorInformation literal.
*/
function create(label, textEdit, additionalTextEdits) {
return {
label: label,
textEdit: textEdit,
additionalTextEdits: additionalTextEdits,
};
}
ColorPresentation.create = create;
/**
* Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.string(candidate.label)
&& (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))
&& (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
}
ColorPresentation.is = is;
})(ColorPresentation || (ColorPresentation = {}));
/**
* Enum of known range kinds
*/
var FoldingRangeKind;
(function (FoldingRangeKind) {
/**
* Folding range for a comment
*/
FoldingRangeKind["Comment"] = "comment";
/**
* Folding range for a imports or includes
*/
FoldingRangeKind["Imports"] = "imports";
/**
* Folding range for a region (e.g. `#region`)
*/
FoldingRangeKind["Region"] = "region";
})(FoldingRangeKind || (FoldingRangeKind = {}));
/**
* The folding range namespace provides helper functions to work with
* [FoldingRange](#FoldingRange) literals.
*/
var FoldingRange;
(function (FoldingRange) {
/**
* Creates a new FoldingRange literal.
*/
function create(startLine, endLine, startCharacter, endCharacter, kind) {
var result = {
startLine: startLine,
endLine: endLine
};
if (Is.defined(startCharacter)) {
result.startCharacter = startCharacter;
}
if (Is.defined(endCharacter)) {
result.endCharacter = endCharacter;
}
if (Is.defined(kind)) {
result.kind = kind;
}
return result;
}
FoldingRange.create = create;
/**
* Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.
*/
function is(value) {
var candidate = value;
return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)
&& (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))
&& (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))
&& (Is.undefined(candidate.kind) || Is.string(candidate.kind));
}
FoldingRange.is = is;
})(FoldingRange || (FoldingRange = {}));
/**
* The DiagnosticRelatedInformation namespace provides helper functions to work with
* [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.
*/
var DiagnosticRelatedInformation;
(function (DiagnosticRelatedInformation) {
/**
* Creates a new DiagnosticRelatedInformation literal.
*/
function create(location, message) {
return {
location: location,
message: message
};
}
DiagnosticRelatedInformation.create = create;
/**
* Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
}
DiagnosticRelatedInformation.is = is;
})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
/**
* The diagnostic's severity.
*/
var DiagnosticSeverity;
(function (DiagnosticSeverity) {
/**
* Reports an error.
*/
DiagnosticSeverity.Error = 1;
/**
* Reports a warning.
*/
DiagnosticSeverity.Warning = 2;
/**
* Reports an information.
*/
DiagnosticSeverity.Information = 3;
/**
* Reports a hint.
*/
DiagnosticSeverity.Hint = 4;
})(DiagnosticSeverity || (DiagnosticSeverity = {}));
/**
* The diagnostic tags.
*
* @since 3.15.0
*/
var DiagnosticTag;
(function (DiagnosticTag) {
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out instead of having
* an error squiggle.
*/
DiagnosticTag.Unnecessary = 1;
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
DiagnosticTag.Deprecated = 2;
})(DiagnosticTag || (DiagnosticTag = {}));
/**
* The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.
*
* @since 3.16.0
*/
var CodeDescription;
(function (CodeDescription) {
function is(value) {
var candidate = value;
return candidate !== undefined && candidate !== null && Is.string(candidate.href);
}
CodeDescription.is = is;
})(CodeDescription || (CodeDescription = {}));
/**
* The Diagnostic namespace provides helper functions to work with
* [Diagnostic](#Diagnostic) literals.
*/
var Diagnostic;
(function (Diagnostic) {
/**
* Creates a new Diagnostic literal.
*/
function create(range, message, severity, code, source, relatedInformation) {
var result = { range: range, message: message };
if (Is.defined(severity)) {
result.severity = severity;
}
if (Is.defined(code)) {
result.code = code;
}
if (Is.defined(source)) {
result.source = source;
}
if (Is.defined(relatedInformation)) {
result.relatedInformation = relatedInformation;
}
return result;
}
Diagnostic.create = create;
/**
* Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.
*/
function is(value) {
var _a;
var candidate = value;
return Is.defined(candidate)
&& Range.is(candidate.range)
&& Is.string(candidate.message)
&& (Is.number(candidate.severity) || Is.undefined(candidate.severity))
&& (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))
&& (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))
&& (Is.string(candidate.source) || Is.undefined(candidate.source))
&& (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
}
Diagnostic.is = is;
})(Diagnostic || (Diagnostic = {}));
/**
* The Command namespace provides helper functions to work with
* [Command](#Command) literals.
*/
var Command;
(function (Command) {
/**
* Creates a new Command literal.
*/
function create(title, command) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var result = { title: title, command: command };
if (Is.defined(args) && args.length > 0) {
result.arguments = args;
}
return result;
}
Command.create = create;
/**
* Checks whether the given literal conforms to the [Command](#Command) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
}
Command.is = is;
})(Command || (Command = {}));
/**
* The TextEdit namespace provides helper function to create replace,
* insert and delete edits more easily.
*/
var TextEdit;
(function (TextEdit) {
/**
* Creates a replace text edit.
* @param range The range of text to be replaced.
* @param newText The new text.
*/
function replace(range, newText) {
return { range: range, newText: newText };
}
TextEdit.replace = replace;
/**
* Creates a insert text edit.
* @param position The position to insert the text at.
* @param newText The text to be inserted.
*/
function insert(position, newText) {
return { range: { start: position, end: position }, newText: newText };
}
TextEdit.insert = insert;
/**
* Creates a delete text edit.
* @param range The range of text to be deleted.
*/
function del(range) {
return { range: range, newText: '' };
}
TextEdit.del = del;
function is(value) {
var candidate = value;
return Is.objectLiteral(candidate)
&& Is.string(candidate.newText)
&& Range.is(candidate.range);
}
TextEdit.is = is;
})(TextEdit || (TextEdit = {}));
var ChangeAnnotation;
(function (ChangeAnnotation) {
function create(label, needsConfirmation, description) {
var result = { label: label };
if (needsConfirmation !== undefined) {
result.needsConfirmation = needsConfirmation;
}
if (description !== undefined) {
result.description = description;
}
return result;
}
ChangeAnnotation.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) &&
(Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&
(Is.string(candidate.description) || candidate.description === undefined);
}
ChangeAnnotation.is = is;
})(ChangeAnnotation || (ChangeAnnotation = {}));
var ChangeAnnotationIdentifier;
(function (ChangeAnnotationIdentifier) {
function is(value) {
var candidate = value;
return typeof candidate === 'string';
}
ChangeAnnotationIdentifier.is = is;
})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
var AnnotatedTextEdit;
(function (AnnotatedTextEdit) {
/**
* Creates an annotated replace text edit.
*
* @param range The range of text to be replaced.
* @param newText The new text.
* @param annotation The annotation.
*/
function replace(range, newText, annotation) {
return { range: range, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.replace = replace;
/**
* Creates an annotated insert text edit.
*
* @param position The position to insert the text at.
* @param newText The text to be inserted.
* @param annotation The annotation.
*/
function insert(position, newText, annotation) {
return { range: { start: position, end: position }, newText: newText, annotationId: annotation };
}
AnnotatedTextEdit.insert = insert;
/**
* Creates an annotated delete text edit.
*
* @param range The range of text to be deleted.
* @param annotation The annotation.
*/
function del(range, annotation) {
return { range: range, newText: '', annotationId: annotation };
}
AnnotatedTextEdit.del = del;
function is(value) {
var candidate = value;
return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
AnnotatedTextEdit.is = is;
})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
/**
* The TextDocumentEdit namespace provides helper function to create
* an edit that manipulates a text document.
*/
var TextDocumentEdit;
(function (TextDocumentEdit) {
/**
* Creates a new `TextDocumentEdit`
*/
function create(textDocument, edits) {
return { textDocument: textDocument, edits: edits };
}
TextDocumentEdit.create = create;
function is(value) {
var candidate = value;
return Is.defined(candidate)
&& OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)
&& Array.isArray(candidate.edits);
}
TextDocumentEdit.is = is;
})(TextDocumentEdit || (TextDocumentEdit = {}));
var CreateFile;
(function (CreateFile) {
function create(uri, options, annotation) {
var result = {
kind: 'create',
uri: uri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
CreateFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
CreateFile.is = is;
})(CreateFile || (CreateFile = {}));
var RenameFile;
(function (RenameFile) {
function create(oldUri, newUri, options, annotation) {
var result = {
kind: 'rename',
oldUri: oldUri,
newUri: newUri
};
if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
RenameFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||
((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
RenameFile.is = is;
})(RenameFile || (RenameFile = {}));
var DeleteFile;
(function (DeleteFile) {
function create(uri, options, annotation) {
var result = {
kind: 'delete',
uri: uri
};
if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {
result.options = options;
}
if (annotation !== undefined) {
result.annotationId = annotation;
}
return result;
}
DeleteFile.create = create;
function is(value) {
var candidate = value;
return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||
((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));
}
DeleteFile.is = is;
})(DeleteFile || (DeleteFile = {}));
var WorkspaceEdit;
(function (WorkspaceEdit) {
function is(value) {
var candidate = value;
return candidate &&
(candidate.changes !== undefined || candidate.documentChanges !== undefined) &&
(candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) {
if (Is.string(change.kind)) {
return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
}
else {
return TextDocumentEdit.is(change);
}
}));
}
WorkspaceEdit.is = is;
})(WorkspaceEdit || (WorkspaceEdit = {}));
var TextEditChangeImpl = /** @class */ (function () {
function TextEditChangeImpl(edits, changeAnnotations) {
this.edits = edits;
this.changeAnnotations = changeAnnotations;
}
TextEditChangeImpl.prototype.insert = function (position, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.insert(position, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.insert(position, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.insert(position, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.replace = function (range, newText, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.replace(range, newText);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.replace(range, newText, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.replace(range, newText, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.delete = function (range, annotation) {
var edit;
var id;
if (annotation === undefined) {
edit = TextEdit.del(range);
}
else if (ChangeAnnotationIdentifier.is(annotation)) {
id = annotation;
edit = AnnotatedTextEdit.del(range, annotation);
}
else {
this.assertChangeAnnotations(this.changeAnnotations);
id = this.changeAnnotations.manage(annotation);
edit = AnnotatedTextEdit.del(range, id);
}
this.edits.push(edit);
if (id !== undefined) {
return id;
}
};
TextEditChangeImpl.prototype.add = function (edit) {
this.edits.push(edit);
};
TextEditChangeImpl.prototype.all = function () {
return this.edits;
};
TextEditChangeImpl.prototype.clear = function () {
this.edits.splice(0, this.edits.length);
};
TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) {
if (value === undefined) {
throw new Error("Text edit change is not configured to manage change annotations.");
}
};
return TextEditChangeImpl;
}());
/**
* A helper class
*/
var ChangeAnnotations = /** @class */ (function () {
function ChangeAnnotations(annotations) {
this._annotations = annotations === undefined ? Object.create(null) : annotations;
this._counter = 0;
this._size = 0;
}
ChangeAnnotations.prototype.all = function () {
return this._annotations;
};
Object.defineProperty(ChangeAnnotations.prototype, "size", {
get: function () {
return this._size;
},
enumerable: false,
configurable: true
});
ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) {
var id;
if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
id = idOrAnnotation;
}
else {
id = this.nextId();
annotation = idOrAnnotation;
}
if (this._annotations[id] !== undefined) {
throw new Error("Id " + id + " is already in use.");
}
if (annotation === undefined) {
throw new Error("No annotation provided for id " + id);
}
this._annotations[id] = annotation;
this._size++;
return id;
};
ChangeAnnotations.prototype.nextId = function () {
this._counter++;
return this._counter.toString();
};
return ChangeAnnotations;
}());
/**
* A workspace change helps constructing changes to a workspace.
*/
var WorkspaceChange = /** @class */ (function () {
function WorkspaceChange(workspaceEdit) {
var _this = this;
this._textEditChanges = Object.create(null);
if (workspaceEdit !== undefined) {
this._workspaceEdit = workspaceEdit;
if (workspaceEdit.documentChanges) {
this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
workspaceEdit.changeAnnotations = this._changeAnnotations.all();
workspaceEdit.documentChanges.forEach(function (change) {
if (TextDocumentEdit.is(change)) {
var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
_this._textEditChanges[change.textDocument.uri] = textEditChange;
}
});
}
else if (workspaceEdit.changes) {
Object.keys(workspaceEdit.changes).forEach(function (key) {
var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
_this._textEditChanges[key] = textEditChange;
});
}
}
else {
this._workspaceEdit = {};
}
}
Object.defineProperty(WorkspaceChange.prototype, "edit", {
/**
* Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal
* use to be returned from a workspace edit operation like rename.
*/
get: function () {
this.initDocumentChanges();
if (this._changeAnnotations !== undefined) {
if (this._changeAnnotations.size === 0) {
this._workspaceEdit.changeAnnotations = undefined;
}
else {
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
}
return this._workspaceEdit;
},
enumerable: false,
configurable: true
});
WorkspaceChange.prototype.getTextEditChange = function (key) {
if (OptionalVersionedTextDocumentIdentifier.is(key)) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var textDocument = { uri: key.uri, version: key.version };
var result = this._textEditChanges[textDocument.uri];
if (!result) {
var edits = [];
var textDocumentEdit = {
textDocument: textDocument,
edits: edits
};
this._workspaceEdit.documentChanges.push(textDocumentEdit);
result = new TextEditChangeImpl(edits, this._changeAnnotations);
this._textEditChanges[textDocument.uri] = result;
}
return result;
}
else {
this.initChanges();
if (this._workspaceEdit.changes === undefined) {
throw new Error('Workspace edit is not configured for normal text edit changes.');
}
var result = this._textEditChanges[key];
if (!result) {
var edits = [];
this._workspaceEdit.changes[key] = edits;
result = new TextEditChangeImpl(edits);
this._textEditChanges[key] = result;
}
return result;
}
};
WorkspaceChange.prototype.initDocumentChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._changeAnnotations = new ChangeAnnotations();
this._workspaceEdit.documentChanges = [];
this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
}
};
WorkspaceChange.prototype.initChanges = function () {
if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {
this._workspaceEdit.changes = Object.create(null);
}
};
WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = CreateFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = CreateFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = RenameFile.create(oldUri, newUri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = RenameFile.create(oldUri, newUri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) {
this.initDocumentChanges();
if (this._workspaceEdit.documentChanges === undefined) {
throw new Error('Workspace edit is not configured for document changes.');
}
var annotation;
if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
annotation = optionsOrAnnotation;
}
else {
options = optionsOrAnnotation;
}
var operation;
var id;
if (annotation === undefined) {
operation = DeleteFile.create(uri, options);
}
else {
id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
operation = DeleteFile.create(uri, options, id);
}
this._workspaceEdit.documentChanges.push(operation);
if (id !== undefined) {
return id;
}
};
return WorkspaceChange;
}());
/**
* The TextDocumentIdentifier namespace provides helper functions to work with
* [TextDocumentIdentifier](#TextDocumentIdentifier) literals.
*/
var TextDocumentIdentifier;
(function (TextDocumentIdentifier) {
/**
* Creates a new TextDocumentIdentifier literal.
* @param uri The document's uri.
*/
function create(uri) {
return { uri: uri };
}
TextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri);
}
TextDocumentIdentifier.is = is;
})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));
/**
* The VersionedTextDocumentIdentifier namespace provides helper functions to work with
* [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.
*/
var VersionedTextDocumentIdentifier;
(function (VersionedTextDocumentIdentifier) {
/**
* Creates a new VersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
VersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
}
VersionedTextDocumentIdentifier.is = is;
})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
/**
* The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with
* [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals.
*/
var OptionalVersionedTextDocumentIdentifier;
(function (OptionalVersionedTextDocumentIdentifier) {
/**
* Creates a new OptionalVersionedTextDocumentIdentifier literal.
* @param uri The document's uri.
* @param uri The document's text.
*/
function create(uri, version) {
return { uri: uri, version: version };
}
OptionalVersionedTextDocumentIdentifier.create = create;
/**
* Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
}
OptionalVersionedTextDocumentIdentifier.is = is;
})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
/**
* The TextDocumentItem namespace provides helper functions to work with
* [TextDocumentItem](#TextDocumentItem) literals.
*/
var TextDocumentItem;
(function (TextDocumentItem) {
/**
* Creates a new TextDocumentItem literal.
* @param uri The document's uri.
* @param languageId The document's language identifier.
* @param version The document's version number.
* @param text The document's text.
*/
function create(uri, languageId, version, text) {
return { uri: uri, languageId: languageId, version: version, text: text };
}
TextDocumentItem.create = create;
/**
* Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
}
TextDocumentItem.is = is;
})(TextDocumentItem || (TextDocumentItem = {}));
/**
* Describes the content type that a client supports in various
* result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
*
* Please note that `MarkupKinds` must not start with a `$`. This kinds
* are reserved for internal usage.
*/
var MarkupKind;
(function (MarkupKind) {
/**
* Plain text is supported as a content format
*/
MarkupKind.PlainText = 'plaintext';
/**
* Markdown is supported as a content format
*/
MarkupKind.Markdown = 'markdown';
})(MarkupKind || (MarkupKind = {}));
(function (MarkupKind) {
/**
* Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.
*/
function is(value) {
var candidate = value;
return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;
}
MarkupKind.is = is;
})(MarkupKind || (MarkupKind = {}));
var MarkupContent;
(function (MarkupContent) {
/**
* Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.
*/
function is(value) {
var candidate = value;
return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
}
MarkupContent.is = is;
})(MarkupContent || (MarkupContent = {}));
/**
* The kind of a completion entry.
*/
var CompletionItemKind;
(function (CompletionItemKind) {
CompletionItemKind.Text = 1;
CompletionItemKind.Method = 2;
CompletionItemKind.Function = 3;
CompletionItemKind.Constructor = 4;
CompletionItemKind.Field = 5;
CompletionItemKind.Variable = 6;
CompletionItemKind.Class = 7;
CompletionItemKind.Interface = 8;
CompletionItemKind.Module = 9;
CompletionItemKind.Property = 10;
CompletionItemKind.Unit = 11;
CompletionItemKind.Value = 12;
CompletionItemKind.Enum = 13;
CompletionItemKind.Keyword = 14;
CompletionItemKind.Snippet = 15;
CompletionItemKind.Color = 16;
CompletionItemKind.File = 17;
CompletionItemKind.Reference = 18;
CompletionItemKind.Folder = 19;
CompletionItemKind.EnumMember = 20;
CompletionItemKind.Constant = 21;
CompletionItemKind.Struct = 22;
CompletionItemKind.Event = 23;
CompletionItemKind.Operator = 24;
CompletionItemKind.TypeParameter = 25;
})(CompletionItemKind || (CompletionItemKind = {}));
/**
* Defines whether the insert text in a completion item should be interpreted as
* plain text or a snippet.
*/
var InsertTextFormat;
(function (InsertTextFormat) {
/**
* The primary text to be inserted is treated as a plain string.
*/
InsertTextFormat.PlainText = 1;
/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*
* See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
*/
InsertTextFormat.Snippet = 2;
})(InsertTextFormat || (InsertTextFormat = {}));
/**
* Completion item tags are extra annotations that tweak the rendering of a completion
* item.
*
* @since 3.15.0
*/
var CompletionItemTag;
(function (CompletionItemTag) {
/**
* Render a completion as obsolete, usually using a strike-out.
*/
CompletionItemTag.Deprecated = 1;
})(CompletionItemTag || (CompletionItemTag = {}));
/**
* The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.
*
* @since 3.16.0
*/
var InsertReplaceEdit;
(function (InsertReplaceEdit) {
/**
* Creates a new insert / replace edit
*/
function create(newText, insert, replace) {
return { newText: newText, insert: insert, replace: replace };
}
InsertReplaceEdit.create = create;
/**
* Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface.
*/
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
}
InsertReplaceEdit.is = is;
})(InsertReplaceEdit || (InsertReplaceEdit = {}));
/**
* How whitespace and indentation is handled during completion
* item insertion.
*
* @since 3.16.0
*/
var InsertTextMode;
(function (InsertTextMode) {
/**
* The insertion or replace strings is taken as it is. If the
* value is multi line the lines below the cursor will be
* inserted using the indentation defined in the string value.
* The client will not apply any kind of adjustments to the
* string.
*/
InsertTextMode.asIs = 1;
/**
* The editor adjusts leading whitespace of new lines so that
* they match the indentation up to the cursor of the line for
* which the item is accepted.
*
* Consider a line like this: <2tabs><3tabs>foo. Accepting a
* multi line completion item is indented using 2 tabs and all
* following lines inserted will be indented using 2 tabs as well.
*/
InsertTextMode.adjustIndentation = 2;
})(InsertTextMode || (InsertTextMode = {}));
/**
* The CompletionItem namespace provides functions to deal with
* completion items.
*/
var CompletionItem;
(function (CompletionItem) {
/**
* Create a completion item and seed it with a label.
* @param label The completion item's label
*/
function create(label) {
return { label: label };
}
CompletionItem.create = create;
})(CompletionItem || (CompletionItem = {}));
/**
* The CompletionList namespace provides functions to deal with
* completion lists.
*/
var CompletionList;
(function (CompletionList) {
/**
* Creates a new completion list.
*
* @param items The completion items.
* @param isIncomplete The list is not complete.
*/
function create(items, isIncomplete) {
return { items: items ? items : [], isIncomplete: !!isIncomplete };
}
CompletionList.create = create;
})(CompletionList || (CompletionList = {}));
var MarkedString;
(function (MarkedString) {
/**
* Creates a marked string from plain text.
*
* @param plainText The plain text.
*/
function fromPlainText(plainText) {
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}
MarkedString.fromPlainText = fromPlainText;
/**
* Checks whether the given value conforms to the [MarkedString](#MarkedString) type.
*/
function is(value) {
var candidate = value;
return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));
}
MarkedString.is = is;
})(MarkedString || (MarkedString = {}));
var Hover;
(function (Hover) {
/**
* Checks whether the given value conforms to the [Hover](#Hover) interface.
*/
function is(value) {
var candidate = value;
return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||
MarkedString.is(candidate.contents) ||
Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));
}
Hover.is = is;
})(Hover || (Hover = {}));
/**
* The ParameterInformation namespace provides helper functions to work with
* [ParameterInformation](#ParameterInformation) literals.
*/
var ParameterInformation;
(function (ParameterInformation) {
/**
* Creates a new parameter information literal.
*
* @param label A label string.
* @param documentation A doc string.
*/
function create(label, documentation) {
return documentation ? { label: label, documentation: documentation } : { label: label };
}
ParameterInformation.create = create;
})(ParameterInformation || (ParameterInformation = {}));
/**
* The SignatureInformation namespace provides helper functions to work with
* [SignatureInformation](#SignatureInformation) literals.
*/
var SignatureInformation;
(function (SignatureInformation) {
function create(label, documentation) {
var parameters = [];
for (var _i = 2; _i < arguments.length; _i++) {
parameters[_i - 2] = arguments[_i];
}
var result = { label: label };
if (Is.defined(documentation)) {
result.documentation = documentation;
}
if (Is.defined(parameters)) {
result.parameters = parameters;
}
else {
result.parameters = [];
}
return result;
}
SignatureInformation.create = create;
})(SignatureInformation || (SignatureInformation = {}));
/**
* A document highlight kind.
*/
var DocumentHighlightKind;
(function (DocumentHighlightKind) {
/**
* A textual occurrence.
*/
DocumentHighlightKind.Text = 1;
/**
* Read-access of a symbol, like reading a variable.
*/
DocumentHighlightKind.Read = 2;
/**
* Write-access of a symbol, like writing to a variable.
*/
DocumentHighlightKind.Write = 3;
})(DocumentHighlightKind || (DocumentHighlightKind = {}));
/**
* DocumentHighlight namespace to provide helper functions to work with
* [DocumentHighlight](#DocumentHighlight) literals.
*/
var DocumentHighlight;
(function (DocumentHighlight) {
/**
* Create a DocumentHighlight object.
* @param range The range the highlight applies to.
*/
function create(range, kind) {
var result = { range: range };
if (Is.number(kind)) {
result.kind = kind;
}
return result;
}
DocumentHighlight.create = create;
})(DocumentHighlight || (DocumentHighlight = {}));
/**
* A symbol kind.
*/
var SymbolKind;
(function (SymbolKind) {
SymbolKind.File = 1;
SymbolKind.Module = 2;
SymbolKind.Namespace = 3;
SymbolKind.Package = 4;
SymbolKind.Class = 5;
SymbolKind.Method = 6;
SymbolKind.Property = 7;
SymbolKind.Field = 8;
SymbolKind.Constructor = 9;
SymbolKind.Enum = 10;
SymbolKind.Interface = 11;
SymbolKind.Function = 12;
SymbolKind.Variable = 13;
SymbolKind.Constant = 14;
SymbolKind.String = 15;
SymbolKind.Number = 16;
SymbolKind.Boolean = 17;
SymbolKind.Array = 18;
SymbolKind.Object = 19;
SymbolKind.Key = 20;
SymbolKind.Null = 21;
SymbolKind.EnumMember = 22;
SymbolKind.Struct = 23;
SymbolKind.Event = 24;
SymbolKind.Operator = 25;
SymbolKind.TypeParameter = 26;
})(SymbolKind || (SymbolKind = {}));
/**
* Symbol tags are extra annotations that tweak the rendering of a symbol.
* @since 3.16
*/
var SymbolTag;
(function (SymbolTag) {
/**
* Render a symbol as obsolete, usually using a strike-out.
*/
SymbolTag.Deprecated = 1;
})(SymbolTag || (SymbolTag = {}));
var SymbolInformation;
(function (SymbolInformation) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the location of the symbol.
* @param uri The resource of the location of symbol, defaults to the current document.
* @param containerName The name of the symbol containing the symbol.
*/
function create(name, kind, range, uri, containerName) {
var result = {
name: name,
kind: kind,
location: { uri: uri, range: range }
};
if (containerName) {
result.containerName = containerName;
}
return result;
}
SymbolInformation.create = create;
})(SymbolInformation || (SymbolInformation = {}));
var DocumentSymbol;
(function (DocumentSymbol) {
/**
* Creates a new symbol information literal.
*
* @param name The name of the symbol.
* @param detail The detail of the symbol.
* @param kind The kind of the symbol.
* @param range The range of the symbol.
* @param selectionRange The selectionRange of the symbol.
* @param children Children of the symbol.
*/
function create(name, detail, kind, range, selectionRange, children) {
var result = {
name: name,
detail: detail,
kind: kind,
range: range,
selectionRange: selectionRange
};
if (children !== undefined) {
result.children = children;
}
return result;
}
DocumentSymbol.create = create;
/**
* Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.
*/
function is(value) {
var candidate = value;
return candidate &&
Is.string(candidate.name) && Is.number(candidate.kind) &&
Range.is(candidate.range) && Range.is(candidate.selectionRange) &&
(candidate.detail === undefined || Is.string(candidate.detail)) &&
(candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&
(candidate.children === undefined || Array.isArray(candidate.children)) &&
(candidate.tags === undefined || Array.isArray(candidate.tags));
}
DocumentSymbol.is = is;
})(DocumentSymbol || (DocumentSymbol = {}));
/**
* A set of predefined code action kinds
*/
var CodeActionKind;
(function (CodeActionKind) {
/**
* Empty kind.
*/
CodeActionKind.Empty = '';
/**
* Base kind for quickfix actions: 'quickfix'
*/
CodeActionKind.QuickFix = 'quickfix';
/**
* Base kind for refactoring actions: 'refactor'
*/
CodeActionKind.Refactor = 'refactor';
/**
* Base kind for refactoring extraction actions: 'refactor.extract'
*
* Example extract actions:
*
* - Extract method
* - Extract function
* - Extract variable
* - Extract interface from class
* - ...
*/
CodeActionKind.RefactorExtract = 'refactor.extract';
/**
* Base kind for refactoring inline actions: 'refactor.inline'
*
* Example inline actions:
*
* - Inline function
* - Inline variable
* - Inline constant
* - ...
*/
CodeActionKind.RefactorInline = 'refactor.inline';
/**
* Base kind for refactoring rewrite actions: 'refactor.rewrite'
*
* Example rewrite actions:
*
* - Convert JavaScript function to class
* - Add or remove parameter
* - Encapsulate field
* - Make method static
* - Move method to base class
* - ...
*/
CodeActionKind.RefactorRewrite = 'refactor.rewrite';
/**
* Base kind for source actions: `source`
*
* Source code actions apply to the entire file.
*/
CodeActionKind.Source = 'source';
/**
* Base kind for an organize imports source action: `source.organizeImports`
*/
CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
/**
* Base kind for auto-fix source actions: `source.fixAll`.
*
* Fix all actions automatically fix errors that have a clear fix that do not require user input.
* They should not suppress errors or perform unsafe fixes such as generating new types or classes.
*
* @since 3.15.0
*/
CodeActionKind.SourceFixAll = 'source.fixAll';
})(CodeActionKind || (CodeActionKind = {}));
/**
* The CodeActionContext namespace provides helper functions to work with
* [CodeActionContext](#CodeActionContext) literals.
*/
var CodeActionContext;
(function (CodeActionContext) {
/**
* Creates a new CodeActionContext literal.
*/
function create(diagnostics, only) {
var result = { diagnostics: diagnostics };
if (only !== undefined && only !== null) {
result.only = only;
}
return result;
}
CodeActionContext.create = create;
/**
* Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string));
}
CodeActionContext.is = is;
})(CodeActionContext || (CodeActionContext = {}));
var CodeAction;
(function (CodeAction) {
function create(title, kindOrCommandOrEdit, kind) {
var result = { title: title };
var checkKind = true;
if (typeof kindOrCommandOrEdit === 'string') {
checkKind = false;
result.kind = kindOrCommandOrEdit;
}
else if (Command.is(kindOrCommandOrEdit)) {
result.command = kindOrCommandOrEdit;
}
else {
result.edit = kindOrCommandOrEdit;
}
if (checkKind && kind !== undefined) {
result.kind = kind;
}
return result;
}
CodeAction.create = create;
function is(value) {
var candidate = value;
return candidate && Is.string(candidate.title) &&
(candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&
(candidate.kind === undefined || Is.string(candidate.kind)) &&
(candidate.edit !== undefined || candidate.command !== undefined) &&
(candidate.command === undefined || Command.is(candidate.command)) &&
(candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));
}
CodeAction.is = is;
})(CodeAction || (CodeAction = {}));
/**
* The CodeLens namespace provides helper functions to work with
* [CodeLens](#CodeLens) literals.
*/
var CodeLens;
(function (CodeLens) {
/**
* Creates a new CodeLens literal.
*/
function create(range, data) {
var result = { range: range };
if (Is.defined(data)) {
result.data = data;
}
return result;
}
CodeLens.create = create;
/**
* Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
}
CodeLens.is = is;
})(CodeLens || (CodeLens = {}));
/**
* The FormattingOptions namespace provides helper functions to work with
* [FormattingOptions](#FormattingOptions) literals.
*/
var FormattingOptions;
(function (FormattingOptions) {
/**
* Creates a new FormattingOptions literal.
*/
function create(tabSize, insertSpaces) {
return { tabSize: tabSize, insertSpaces: insertSpaces };
}
FormattingOptions.create = create;
/**
* Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
}
FormattingOptions.is = is;
})(FormattingOptions || (FormattingOptions = {}));
/**
* The DocumentLink namespace provides helper functions to work with
* [DocumentLink](#DocumentLink) literals.
*/
var DocumentLink;
(function (DocumentLink) {
/**
* Creates a new DocumentLink literal.
*/
function create(range, target, data) {
return { range: range, target: target, data: data };
}
DocumentLink.create = create;
/**
* Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
}
DocumentLink.is = is;
})(DocumentLink || (DocumentLink = {}));
/**
* The SelectionRange namespace provides helper function to work with
* SelectionRange literals.
*/
var SelectionRange;
(function (SelectionRange) {
/**
* Creates a new SelectionRange
* @param range the range.
* @param parent an optional parent.
*/
function create(range, parent) {
return { range: range, parent: parent };
}
SelectionRange.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
}
SelectionRange.is = is;
})(SelectionRange || (SelectionRange = {}));
var EOL = ['\n', '\r\n', '\r'];
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var TextDocument;
(function (TextDocument) {
/**
* Creates a new ITextDocument literal from the given uri and content.
* @param uri The document's uri.
* @param languageId The document's language Id.
* @param content The document's content.
*/
function create(uri, languageId, version, content) {
return new FullTextDocument(uri, languageId, version, content);
}
TextDocument.create = create;
/**
* Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.
*/
function is(value) {
var candidate = value;
return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)
&& Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
}
TextDocument.is = is;
function applyEdits(document, edits) {
var text = document.getText();
var sortedEdits = mergeSort(edits, function (a, b) {
var diff = a.range.start.line - b.range.start.line;
if (diff === 0) {
return a.range.start.character - b.range.start.character;
}
return diff;
});
var lastModifiedOffset = text.length;
for (var i = sortedEdits.length - 1; i >= 0; i--) {
var e = sortedEdits[i];
var startOffset = document.offsetAt(e.range.start);
var endOffset = document.offsetAt(e.range.end);
if (endOffset <= lastModifiedOffset) {
text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
}
else {
throw new Error('Overlapping edit');
}
lastModifiedOffset = startOffset;
}
return text;
}
TextDocument.applyEdits = applyEdits;
function mergeSort(data, compare) {
if (data.length <= 1) {
// sorted
return data;
}
var p = (data.length / 2) | 0;
var left = data.slice(0, p);
var right = data.slice(p);
mergeSort(left, compare);
mergeSort(right, compare);
var leftIdx = 0;
var rightIdx = 0;
var i = 0;
while (leftIdx < left.length && rightIdx < right.length) {
var ret = compare(left[leftIdx], right[rightIdx]);
if (ret <= 0) {
// smaller_equal -> take left to preserve order
data[i++] = left[leftIdx++];
}
else {
// greater -> take right
data[i++] = right[rightIdx++];
}
}
while (leftIdx < left.length) {
data[i++] = left[leftIdx++];
}
while (rightIdx < right.length) {
data[i++] = right[rightIdx++];
}
return data;
}
})(TextDocument || (TextDocument = {}));
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
var FullTextDocument = /** @class */ (function () {
function FullTextDocument(uri, languageId, version, content) {
this._uri = uri;
this._languageId = languageId;
this._version = version;
this._content = content;
this._lineOffsets = undefined;
}
Object.defineProperty(FullTextDocument.prototype, "uri", {
get: function () {
return this._uri;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "languageId", {
get: function () {
return this._languageId;
},
enumerable: false,
configurable: true
});
Object.defineProperty(FullTextDocument.prototype, "version", {
get: function () {
return this._version;
},
enumerable: false,
configurable: true
});
FullTextDocument.prototype.getText = function (range) {
if (range) {
var start = this.offsetAt(range.start);
var end = this.offsetAt(range.end);
return this._content.substring(start, end);
}
return this._content;
};
FullTextDocument.prototype.update = function (event, version) {
this._content = event.text;
this._version = version;
this._lineOffsets = undefined;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === undefined) {
var lineOffsets = [];
var text = this._content;
var isLineStart = true;
for (var i = 0; i < text.length; i++) {
if (isLineStart) {
lineOffsets.push(i);
isLineStart = false;
}
var ch = text.charAt(i);
isLineStart = (ch === '\r' || ch === '\n');
if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
i++;
}
}
if (isLineStart && text.length > 0) {
lineOffsets.push(text.length);
}
this._lineOffsets = lineOffsets;
}
return this._lineOffsets;
};
FullTextDocument.prototype.positionAt = function (offset) {
offset = Math.max(Math.min(offset, this._content.length), 0);
var lineOffsets = this.getLineOffsets();
var low = 0, high = lineOffsets.length;
if (high === 0) {
return Position.create(0, offset);
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (lineOffsets[mid] > offset) {
high = mid;
}
else {
low = mid + 1;
}
}
// low is the least x for which the line offset is larger than the current offset
// or array.length if no line offset is larger than the current offset
var line = low - 1;
return Position.create(line, offset - lineOffsets[line]);
};
FullTextDocument.prototype.offsetAt = function (position) {
var lineOffsets = this.getLineOffsets();
if (position.line >= lineOffsets.length) {
return this._content.length;
}
else if (position.line < 0) {
return 0;
}
var lineOffset = lineOffsets[position.line];
var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;
return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
};
Object.defineProperty(FullTextDocument.prototype, "lineCount", {
get: function () {
return this.getLineOffsets().length;
},
enumerable: false,
configurable: true
});
return FullTextDocument;
}());
var Is;
(function (Is) {
var toString = Object.prototype.toString;
function defined(value) {
return typeof value !== 'undefined';
}
Is.defined = defined;
function undefined(value) {
return typeof value === 'undefined';
}
Is.undefined = undefined;
function boolean(value) {
return value === true || value === false;
}
Is.boolean = boolean;
function string(value) {
return toString.call(value) === '[object String]';
}
Is.string = string;
function number(value) {
return toString.call(value) === '[object Number]';
}
Is.number = number;
function numberRange(value, min, max) {
return toString.call(value) === '[object Number]' && min <= value && value <= max;
}
Is.numberRange = numberRange;
function integer(value) {
return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;
}
Is.integer = integer;
function uinteger(value) {
return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;
}
Is.uinteger = uinteger;
function func(value) {
return toString.call(value) === '[object Function]';
}
Is.func = func;
function objectLiteral(value) {
// Strictly speaking class instances pass this check as well. Since the LSP
// doesn't use classes we ignore this for now. If we do we need to add something
// like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
return value !== null && typeof value === 'object';
}
Is.objectLiteral = objectLiteral;
function typedArray(value, check) {
return Array.isArray(value) && value.every(check);
}
Is.typedArray = typedArray;
})(Is || (Is = {}));
/***/ }),
/* 119 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "Node": () => /* binding */ Node,
/* harmony export */ "parse": () => /* binding */ parse
/* harmony export */ });
/* harmony import */ var _htmlScanner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(116);
/* harmony import */ var _utils_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(120);
/* harmony import */ var _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(117);
/* harmony import */ var _languageFacts_fact__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(121);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var Node = /** @class */ (function () {
function Node(start, end, children, parent) {
this.start = start;
this.end = end;
this.children = children;
this.parent = parent;
this.closed = false;
}
Object.defineProperty(Node.prototype, "attributeNames", {
get: function () { return this.attributes ? Object.keys(this.attributes) : []; },
enumerable: false,
configurable: true
});
Node.prototype.isSameTag = function (tagInLowerCase) {
if (this.tag === undefined) {
return tagInLowerCase === undefined;
}
else {
return tagInLowerCase !== undefined && this.tag.length === tagInLowerCase.length && this.tag.toLowerCase() === tagInLowerCase;
}
};
Object.defineProperty(Node.prototype, "firstChild", {
get: function () { return this.children[0]; },
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "lastChild", {
get: function () { return this.children.length ? this.children[this.children.length - 1] : void 0; },
enumerable: false,
configurable: true
});
Node.prototype.findNodeBefore = function (offset) {
var idx = (0,_utils_arrays__WEBPACK_IMPORTED_MODULE_1__.findFirst)(this.children, function (c) { return offset <= c.start; }) - 1;
if (idx >= 0) {
var child = this.children[idx];
if (offset > child.start) {
if (offset < child.end) {
return child.findNodeBefore(offset);
}
var lastChild = child.lastChild;
if (lastChild && lastChild.end === child.end) {
return child.findNodeBefore(offset);
}
return child;
}
}
return this;
};
Node.prototype.findNodeAt = function (offset) {
var idx = (0,_utils_arrays__WEBPACK_IMPORTED_MODULE_1__.findFirst)(this.children, function (c) { return offset <= c.start; }) - 1;
if (idx >= 0) {
var child = this.children[idx];
if (offset > child.start && offset <= child.end) {
return child.findNodeAt(offset);
}
}
return this;
};
return Node;
}());
function parse(text) {
var scanner = (0,_htmlScanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(text, undefined, undefined, true);
var htmlDocument = new Node(0, text.length, [], void 0);
var curr = htmlDocument;
var endTagStart = -1;
var endTagName = undefined;
var pendingAttribute = null;
var token = scanner.scan();
while (token !== _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.EOS) {
switch (token) {
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.StartTagOpen:
var child = new Node(scanner.getTokenOffset(), text.length, [], curr);
curr.children.push(child);
curr = child;
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.StartTag:
curr.tag = scanner.getTokenText();
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.StartTagClose:
if (curr.parent) {
curr.end = scanner.getTokenEnd(); // might be later set to end tag position
if (scanner.getTokenLength()) {
curr.startTagEnd = scanner.getTokenEnd();
if (curr.tag && (0,_languageFacts_fact__WEBPACK_IMPORTED_MODULE_3__.isVoidElement)(curr.tag)) {
curr.closed = true;
curr = curr.parent;
}
}
else {
// pseudo close token from an incomplete start tag
curr = curr.parent;
}
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.StartTagSelfClose:
if (curr.parent) {
curr.closed = true;
curr.end = scanner.getTokenEnd();
curr.startTagEnd = scanner.getTokenEnd();
curr = curr.parent;
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.EndTagOpen:
endTagStart = scanner.getTokenOffset();
endTagName = undefined;
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.EndTag:
endTagName = scanner.getTokenText().toLowerCase();
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.EndTagClose:
var node = curr;
// see if we can find a matching tag
while (!node.isSameTag(endTagName) && node.parent) {
node = node.parent;
}
if (node.parent) {
while (curr !== node) {
curr.end = endTagStart;
curr.closed = false;
curr = curr.parent;
}
curr.closed = true;
curr.endTagStart = endTagStart;
curr.end = scanner.getTokenEnd();
curr = curr.parent;
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.AttributeName: {
pendingAttribute = scanner.getTokenText();
var attributes = curr.attributes;
if (!attributes) {
curr.attributes = attributes = {};
}
attributes[pendingAttribute] = null; // Support valueless attributes such as 'checked'
break;
}
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_2__.TokenType.AttributeValue: {
var value = scanner.getTokenText();
var attributes = curr.attributes;
if (attributes && pendingAttribute) {
attributes[pendingAttribute] = value;
pendingAttribute = null;
}
break;
}
}
token = scanner.scan();
}
while (curr.parent) {
curr.end = text.length;
curr.closed = false;
curr = curr.parent;
}
return {
roots: htmlDocument.children,
findNodeBefore: htmlDocument.findNodeBefore.bind(htmlDocument),
findNodeAt: htmlDocument.findNodeAt.bind(htmlDocument)
};
}
/***/ }),
/* 120 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "findFirst": () => /* binding */ findFirst,
/* harmony export */ "binarySearch": () => /* binding */ binarySearch
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
* are located before all elements where p(x) is true.
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
*/
function findFirst(array, p) {
var low = 0, high = array.length;
if (high === 0) {
return 0; // no children
}
while (low < high) {
var mid = Math.floor((low + high) / 2);
if (p(array[mid])) {
high = mid;
}
else {
low = mid + 1;
}
}
return low;
}
function binarySearch(array, key, comparator) {
var low = 0, high = array.length - 1;
while (low <= high) {
var mid = ((low + high) / 2) | 0;
var comp = comparator(array[mid], key);
if (comp < 0) {
low = mid + 1;
}
else if (comp > 0) {
high = mid - 1;
}
else {
return mid;
}
}
return -(low + 1);
}
/***/ }),
/* 121 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "VOID_ELEMENTS": () => /* binding */ VOID_ELEMENTS,
/* harmony export */ "isVoidElement": () => /* binding */ isVoidElement
/* harmony export */ });
/* harmony import */ var _utils_arrays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(120);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// As defined in https://www.w3.org/TR/html5/syntax.html#void-elements
var VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'];
function isVoidElement(e) {
return !!e && _utils_arrays__WEBPACK_IMPORTED_MODULE_0__.binarySearch(VOID_ELEMENTS, e.toLowerCase(), function (s1, s2) { return s1.localeCompare(s2); }) >= 0;
}
/***/ }),
/* 122 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "HTMLCompletion": () => /* binding */ HTMLCompletion
/* harmony export */ });
/* harmony import */ var _parser_htmlScanner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(116);
/* harmony import */ var _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(117);
/* harmony import */ var _parser_htmlEntities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(123);
/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(77);
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(124);
/* harmony import */ var _languageFacts_fact__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(121);
/* harmony import */ var _utils_object__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(125);
/* harmony import */ var _languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(126);
/* harmony import */ var _pathCompletion__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(128);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_3__.loadMessageBundle();
var HTMLCompletion = /** @class */ (function () {
function HTMLCompletion(lsOptions, dataManager) {
this.lsOptions = lsOptions;
this.dataManager = dataManager;
this.completionParticipants = [];
}
HTMLCompletion.prototype.setCompletionParticipants = function (registeredCompletionParticipants) {
this.completionParticipants = registeredCompletionParticipants || [];
};
HTMLCompletion.prototype.doComplete2 = function (document, position, htmlDocument, documentContext, settings) {
return __awaiter(this, void 0, void 0, function () {
var participant, contributedParticipants, result, pathCompletionResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) {
return [2 /*return*/, this.doComplete(document, position, htmlDocument, settings)];
}
participant = new _pathCompletion__WEBPACK_IMPORTED_MODULE_8__.PathCompletionParticipant(this.lsOptions.fileSystemProvider.readDirectory);
contributedParticipants = this.completionParticipants;
this.completionParticipants = [participant].concat(contributedParticipants);
result = this.doComplete(document, position, htmlDocument, settings);
_a.label = 1;
case 1:
_a.trys.push([1, , 3, 4]);
return [4 /*yield*/, participant.computeCompletions(document, documentContext)];
case 2:
pathCompletionResult = _a.sent();
return [2 /*return*/, {
isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete,
items: pathCompletionResult.items.concat(result.items)
}];
case 3:
this.completionParticipants = contributedParticipants;
return [7 /*endfinally*/];
case 4: return [2 /*return*/];
}
});
});
};
HTMLCompletion.prototype.doComplete = function (document, position, htmlDocument, settings) {
var result = this._doComplete(document, position, htmlDocument, settings);
return this.convertCompletionList(result);
};
HTMLCompletion.prototype._doComplete = function (document, position, htmlDocument, settings) {
var result = {
isIncomplete: false,
items: []
};
var completionParticipants = this.completionParticipants;
var dataProviders = this.dataManager.getDataProviders().filter(function (p) { return p.isApplicable(document.languageId) && (!settings || settings[p.getId()] !== false); });
var doesSupportMarkdown = this.doesSupportMarkdown();
var text = document.getText();
var offset = document.offsetAt(position);
var node = htmlDocument.findNodeBefore(offset);
if (!node) {
return result;
}
var scanner = (0,_parser_htmlScanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(text, node.start);
var currentTag = '';
var currentAttributeName;
function getReplaceRange(replaceStart, replaceEnd) {
if (replaceEnd === void 0) { replaceEnd = offset; }
if (replaceStart > offset) {
replaceStart = offset;
}
return { start: document.positionAt(replaceStart), end: document.positionAt(replaceEnd) };
}
function collectOpenTagSuggestions(afterOpenBracket, tagNameEnd) {
var range = getReplaceRange(afterOpenBracket, tagNameEnd);
dataProviders.forEach(function (provider) {
provider.provideTags().forEach(function (tag) {
result.items.push({
label: tag.name,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Property,
documentation: (0,_languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_7__.generateDocumentation)(tag, undefined, doesSupportMarkdown),
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, tag.name),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
});
});
});
return result;
}
function getLineIndent(offset) {
var start = offset;
while (start > 0) {
var ch = text.charAt(start - 1);
if ("\n\r".indexOf(ch) >= 0) {
return text.substring(start, offset);
}
if (!isWhiteSpace(ch)) {
return null;
}
start--;
}
return text.substring(0, offset);
}
function collectCloseTagSuggestions(afterOpenBracket, inOpenTag, tagNameEnd) {
if (tagNameEnd === void 0) { tagNameEnd = offset; }
var range = getReplaceRange(afterOpenBracket, tagNameEnd);
var closeTag = isFollowedBy(text, tagNameEnd, _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.WithinEndTag, _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EndTagClose) ? '' : '>';
var curr = node;
if (inOpenTag) {
curr = curr.parent; // don't suggest the own tag, it's not yet open
}
while (curr) {
var tag = curr.tag;
if (tag && (!curr.closed || curr.endTagStart && (curr.endTagStart > offset))) {
var item = {
label: '/' + tag,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Property,
filterText: '/' + tag,
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, '/' + tag + closeTag),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
};
var startIndent = getLineIndent(curr.start);
var endIndent = getLineIndent(afterOpenBracket - 1);
if (startIndent !== null && endIndent !== null && startIndent !== endIndent) {
var insertText = startIndent + '' + tag + closeTag;
item.textEdit = _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(getReplaceRange(afterOpenBracket - 1 - endIndent.length), insertText);
item.filterText = endIndent + '' + tag;
}
result.items.push(item);
return result;
}
curr = curr.parent;
}
if (inOpenTag) {
return result;
}
dataProviders.forEach(function (provider) {
provider.provideTags().forEach(function (tag) {
result.items.push({
label: '/' + tag.name,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Property,
documentation: (0,_languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_7__.generateDocumentation)(tag, undefined, doesSupportMarkdown),
filterText: '/' + tag.name + closeTag,
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, '/' + tag.name + closeTag),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
});
});
});
return result;
}
function collectAutoCloseTagSuggestion(tagCloseEnd, tag) {
if (settings && settings.hideAutoCompleteProposals) {
return result;
}
if (!(0,_languageFacts_fact__WEBPACK_IMPORTED_MODULE_5__.isVoidElement)(tag)) {
var pos = document.positionAt(tagCloseEnd);
result.items.push({
label: '' + tag + '>',
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Property,
filterText: '' + tag + '>',
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.insert(pos, '$0' + tag + '>'),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.Snippet
});
}
return result;
}
function collectTagSuggestions(tagStart, tagEnd) {
collectOpenTagSuggestions(tagStart, tagEnd);
collectCloseTagSuggestions(tagStart, true, tagEnd);
return result;
}
function collectAttributeNameSuggestions(nameStart, nameEnd) {
if (nameEnd === void 0) { nameEnd = offset; }
var replaceEnd = offset;
while (replaceEnd < nameEnd && text[replaceEnd] !== '<') { // < is a valid attribute name character, but we rather assume the attribute name ends. See #23236.
replaceEnd++;
}
var range = getReplaceRange(nameStart, replaceEnd);
var value = isFollowedBy(text, nameEnd, _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.AfterAttributeName, _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.DelimiterAssign) ? '' : '="$1"';
var seenAttributes = Object.create(null);
dataProviders.forEach(function (provider) {
provider.provideAttributes(currentTag).forEach(function (attr) {
if (seenAttributes[attr.name]) {
return;
}
seenAttributes[attr.name] = true;
var codeSnippet = attr.name;
var command;
if (attr.valueSet !== 'v' && value.length) {
codeSnippet = codeSnippet + value;
if (attr.valueSet || attr.name === 'style') {
command = {
title: 'Suggest',
command: 'editor.action.triggerSuggest'
};
}
}
result.items.push({
label: attr.name,
kind: attr.valueSet === 'handler' ? _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Function : _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Value,
documentation: (0,_languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_7__.generateDocumentation)(attr, undefined, doesSupportMarkdown),
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, codeSnippet),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.Snippet,
command: command
});
});
});
collectDataAttributesSuggestions(range, seenAttributes);
return result;
}
function collectDataAttributesSuggestions(range, seenAttributes) {
var dataAttr = 'data-';
var dataAttributes = {};
dataAttributes[dataAttr] = dataAttr + "$1=\"$2\"";
function addNodeDataAttributes(node) {
node.attributeNames.forEach(function (attr) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_4__.startsWith)(attr, dataAttr) && !dataAttributes[attr] && !seenAttributes[attr]) {
dataAttributes[attr] = attr + '="$1"';
}
});
node.children.forEach(function (child) { return addNodeDataAttributes(child); });
}
if (htmlDocument) {
htmlDocument.roots.forEach(function (root) { return addNodeDataAttributes(root); });
}
Object.keys(dataAttributes).forEach(function (attr) { return result.items.push({
label: attr,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Value,
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, dataAttributes[attr]),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.Snippet
}); });
}
function collectAttributeValueSuggestions(valueStart, valueEnd) {
if (valueEnd === void 0) { valueEnd = offset; }
var range;
var addQuotes;
var valuePrefix;
if (offset > valueStart && offset <= valueEnd && isQuote(text[valueStart])) {
// inside quoted attribute
var valueContentStart = valueStart + 1;
var valueContentEnd = valueEnd;
// valueEnd points to the char after quote, which encloses the replace range
if (valueEnd > valueStart && text[valueEnd - 1] === text[valueStart]) {
valueContentEnd--;
}
var wsBefore = getWordStart(text, offset, valueContentStart);
var wsAfter = getWordEnd(text, offset, valueContentEnd);
range = getReplaceRange(wsBefore, wsAfter);
valuePrefix = offset >= valueContentStart && offset <= valueContentEnd ? text.substring(valueContentStart, offset) : '';
addQuotes = false;
}
else {
range = getReplaceRange(valueStart, valueEnd);
valuePrefix = text.substring(valueStart, offset);
addQuotes = true;
}
if (completionParticipants.length > 0) {
var tag = currentTag.toLowerCase();
var attribute = currentAttributeName.toLowerCase();
var fullRange = getReplaceRange(valueStart, valueEnd);
for (var _i = 0, completionParticipants_1 = completionParticipants; _i < completionParticipants_1.length; _i++) {
var participant = completionParticipants_1[_i];
if (participant.onHtmlAttributeValue) {
participant.onHtmlAttributeValue({ document: document, position: position, tag: tag, attribute: attribute, value: valuePrefix, range: fullRange });
}
}
}
dataProviders.forEach(function (provider) {
provider.provideValues(currentTag, currentAttributeName).forEach(function (value) {
var insertText = addQuotes ? '"' + value.name + '"' : value.name;
result.items.push({
label: value.name,
filterText: insertText,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Unit,
documentation: (0,_languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_7__.generateDocumentation)(value, undefined, doesSupportMarkdown),
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, insertText),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
});
});
});
collectCharacterEntityProposals();
return result;
}
function scanNextForEndPos(nextToken) {
if (offset === scanner.getTokenEnd()) {
token = scanner.scan();
if (token === nextToken && scanner.getTokenOffset() === offset) {
return scanner.getTokenEnd();
}
}
return offset;
}
function collectInsideContent() {
for (var _i = 0, completionParticipants_2 = completionParticipants; _i < completionParticipants_2.length; _i++) {
var participant = completionParticipants_2[_i];
if (participant.onHtmlContent) {
participant.onHtmlContent({ document: document, position: position });
}
}
return collectCharacterEntityProposals();
}
function collectCharacterEntityProposals() {
// character entities
var k = offset - 1;
var characterStart = position.character;
while (k >= 0 && (0,_utils_strings__WEBPACK_IMPORTED_MODULE_4__.isLetterOrDigit)(text, k)) {
k--;
characterStart--;
}
if (k >= 0 && text[k] === '&') {
var range = _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.Range.create(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.Position.create(position.line, characterStart - 1), position);
for (var entity in _parser_htmlEntities__WEBPACK_IMPORTED_MODULE_2__.entities) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_4__.endsWith)(entity, ';')) {
var label = '&' + entity;
result.items.push({
label: label,
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Keyword,
documentation: localize('entity.propose', "Character entity representing '" + _parser_htmlEntities__WEBPACK_IMPORTED_MODULE_2__.entities[entity] + "'"),
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, label),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
});
}
}
}
return result;
}
function suggestDoctype(replaceStart, replaceEnd) {
var range = getReplaceRange(replaceStart, replaceEnd);
result.items.push({
label: '!DOCTYPE',
kind: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.CompletionItemKind.Property,
documentation: 'A preamble for an HTML document.',
textEdit: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TextEdit.replace(range, '!DOCTYPE html>'),
insertTextFormat: _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.InsertTextFormat.PlainText
});
}
var token = scanner.scan();
while (token !== _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EOS && scanner.getTokenOffset() <= offset) {
switch (token) {
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTagOpen:
if (scanner.getTokenEnd() === offset) {
var endPos = scanNextForEndPos(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTag);
if (position.line === 0) {
suggestDoctype(offset, endPos);
}
return collectTagSuggestions(offset, endPos);
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTag:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {
return collectOpenTagSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());
}
currentTag = scanner.getTokenText();
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.AttributeName:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {
return collectAttributeNameSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());
}
currentAttributeName = scanner.getTokenText();
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.DelimiterAssign:
if (scanner.getTokenEnd() === offset) {
var endPos = scanNextForEndPos(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.AttributeValue);
return collectAttributeValueSuggestions(offset, endPos);
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.AttributeValue:
if (scanner.getTokenOffset() <= offset && offset <= scanner.getTokenEnd()) {
return collectAttributeValueSuggestions(scanner.getTokenOffset(), scanner.getTokenEnd());
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.Whitespace:
if (offset <= scanner.getTokenEnd()) {
switch (scanner.getScannerState()) {
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.AfterOpeningStartTag:
var startPos = scanner.getTokenOffset();
var endTagPos = scanNextForEndPos(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTag);
return collectTagSuggestions(startPos, endTagPos);
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.WithinTag:
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.AfterAttributeName:
return collectAttributeNameSuggestions(scanner.getTokenEnd());
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.BeforeAttributeValue:
return collectAttributeValueSuggestions(scanner.getTokenEnd());
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.AfterOpeningEndTag:
return collectCloseTagSuggestions(scanner.getTokenOffset() - 1, false);
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.ScannerState.WithinContent:
return collectInsideContent();
}
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EndTagOpen:
if (offset <= scanner.getTokenEnd()) {
var afterOpenBracket = scanner.getTokenOffset() + 1;
var endOffset = scanNextForEndPos(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EndTag);
return collectCloseTagSuggestions(afterOpenBracket, false, endOffset);
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EndTag:
if (offset <= scanner.getTokenEnd()) {
var start = scanner.getTokenOffset() - 1;
while (start >= 0) {
var ch = text.charAt(start);
if (ch === '/') {
return collectCloseTagSuggestions(start, false, scanner.getTokenEnd());
}
else if (!isWhiteSpace(ch)) {
break;
}
start--;
}
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTagClose:
if (offset <= scanner.getTokenEnd()) {
if (currentTag) {
return collectAutoCloseTagSuggestion(scanner.getTokenEnd(), currentTag);
}
}
break;
case _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.Content:
if (offset <= scanner.getTokenEnd()) {
return collectInsideContent();
}
break;
default:
if (offset <= scanner.getTokenEnd()) {
return result;
}
break;
}
token = scanner.scan();
}
return result;
};
HTMLCompletion.prototype.doTagComplete = function (document, position, htmlDocument) {
var offset = document.offsetAt(position);
if (offset <= 0) {
return null;
}
var char = document.getText().charAt(offset - 1);
if (char === '>') {
var node = htmlDocument.findNodeBefore(offset);
if (node && node.tag && !(0,_languageFacts_fact__WEBPACK_IMPORTED_MODULE_5__.isVoidElement)(node.tag) && node.start < offset && (!node.endTagStart || node.endTagStart > offset)) {
var scanner = (0,_parser_htmlScanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(document.getText(), node.start);
var token = scanner.scan();
while (token !== _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.StartTagClose && scanner.getTokenEnd() === offset) {
return "$0" + node.tag + ">";
}
token = scanner.scan();
}
}
}
else if (char === '/') {
var node = htmlDocument.findNodeBefore(offset);
while (node && node.closed) {
node = node.parent;
}
if (node && node.tag) {
var scanner = (0,_parser_htmlScanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(document.getText(), node.start);
var token = scanner.scan();
while (token !== _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EOS && scanner.getTokenEnd() <= offset) {
if (token === _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.EndTagOpen && scanner.getTokenEnd() === offset) {
return node.tag + ">";
}
token = scanner.scan();
}
}
}
return null;
};
HTMLCompletion.prototype.convertCompletionList = function (list) {
if (!this.doesSupportMarkdown()) {
list.items.forEach(function (item) {
if (item.documentation && typeof item.documentation !== 'string') {
item.documentation = {
kind: 'plaintext',
value: item.documentation.value
};
}
});
}
return list;
};
HTMLCompletion.prototype.doesSupportMarkdown = function () {
var _a, _b, _c;
if (!(0,_utils_object__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.supportsMarkdown)) {
if (!(0,_utils_object__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.lsOptions.clientCapabilities)) {
this.supportsMarkdown = true;
return this.supportsMarkdown;
}
var documentationFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.documentationFormat;
this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(_htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.MarkupKind.Markdown) !== -1;
}
return this.supportsMarkdown;
};
return HTMLCompletion;
}());
function isQuote(s) {
return /^["']*$/.test(s);
}
function isWhiteSpace(s) {
return /^\s*$/.test(s);
}
function isFollowedBy(s, offset, intialState, expectedToken) {
var scanner = (0,_parser_htmlScanner__WEBPACK_IMPORTED_MODULE_0__.createScanner)(s, offset, intialState);
var token = scanner.scan();
while (token === _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_1__.TokenType.Whitespace) {
token = scanner.scan();
}
return token === expectedToken;
}
function getWordStart(s, offset, limit) {
while (offset > limit && !isWhiteSpace(s[offset - 1])) {
offset--;
}
return offset;
}
function getWordEnd(s, offset, limit) {
while (offset < limit && !isWhiteSpace(s[offset])) {
offset++;
}
return offset;
}
/***/ }),
/* 123 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "entities": () => /* binding */ entities
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* HTML 5 character entities
* https://www.w3.org/TR/html5/syntax.html#named-character-references
*/
var entities = {
"Aacute;": "\u00C1",
"Aacute": "\u00C1",
"aacute;": "\u00E1",
"aacute": "\u00E1",
"Abreve;": "\u0102",
"abreve;": "\u0103",
"ac;": "\u223E",
"acd;": "\u223F",
"acE;": "\u223E\u0333",
"Acirc;": "\u00C2",
"Acirc": "\u00C2",
"acirc;": "\u00E2",
"acirc": "\u00E2",
"acute;": "\u00B4",
"acute": "\u00B4",
"Acy;": "\u0410",
"acy;": "\u0430",
"AElig;": "\u00C6",
"AElig": "\u00C6",
"aelig;": "\u00E6",
"aelig": "\u00E6",
"af;": "\u2061",
"Afr;": "\uD835\uDD04",
"afr;": "\uD835\uDD1E",
"Agrave;": "\u00C0",
"Agrave": "\u00C0",
"agrave;": "\u00E0",
"agrave": "\u00E0",
"alefsym;": "\u2135",
"aleph;": "\u2135",
"Alpha;": "\u0391",
"alpha;": "\u03B1",
"Amacr;": "\u0100",
"amacr;": "\u0101",
"amalg;": "\u2A3F",
"AMP;": "\u0026",
"AMP": "\u0026",
"amp;": "\u0026",
"amp": "\u0026",
"And;": "\u2A53",
"and;": "\u2227",
"andand;": "\u2A55",
"andd;": "\u2A5C",
"andslope;": "\u2A58",
"andv;": "\u2A5A",
"ang;": "\u2220",
"ange;": "\u29A4",
"angle;": "\u2220",
"angmsd;": "\u2221",
"angmsdaa;": "\u29A8",
"angmsdab;": "\u29A9",
"angmsdac;": "\u29AA",
"angmsdad;": "\u29AB",
"angmsdae;": "\u29AC",
"angmsdaf;": "\u29AD",
"angmsdag;": "\u29AE",
"angmsdah;": "\u29AF",
"angrt;": "\u221F",
"angrtvb;": "\u22BE",
"angrtvbd;": "\u299D",
"angsph;": "\u2222",
"angst;": "\u00C5",
"angzarr;": "\u237C",
"Aogon;": "\u0104",
"aogon;": "\u0105",
"Aopf;": "\uD835\uDD38",
"aopf;": "\uD835\uDD52",
"ap;": "\u2248",
"apacir;": "\u2A6F",
"apE;": "\u2A70",
"ape;": "\u224A",
"apid;": "\u224B",
"apos;": "\u0027",
"ApplyFunction;": "\u2061",
"approx;": "\u2248",
"approxeq;": "\u224A",
"Aring;": "\u00C5",
"Aring": "\u00C5",
"aring;": "\u00E5",
"aring": "\u00E5",
"Ascr;": "\uD835\uDC9C",
"ascr;": "\uD835\uDCB6",
"Assign;": "\u2254",
"ast;": "\u002A",
"asymp;": "\u2248",
"asympeq;": "\u224D",
"Atilde;": "\u00C3",
"Atilde": "\u00C3",
"atilde;": "\u00E3",
"atilde": "\u00E3",
"Auml;": "\u00C4",
"Auml": "\u00C4",
"auml;": "\u00E4",
"auml": "\u00E4",
"awconint;": "\u2233",
"awint;": "\u2A11",
"backcong;": "\u224C",
"backepsilon;": "\u03F6",
"backprime;": "\u2035",
"backsim;": "\u223D",
"backsimeq;": "\u22CD",
"Backslash;": "\u2216",
"Barv;": "\u2AE7",
"barvee;": "\u22BD",
"Barwed;": "\u2306",
"barwed;": "\u2305",
"barwedge;": "\u2305",
"bbrk;": "\u23B5",
"bbrktbrk;": "\u23B6",
"bcong;": "\u224C",
"Bcy;": "\u0411",
"bcy;": "\u0431",
"bdquo;": "\u201E",
"becaus;": "\u2235",
"Because;": "\u2235",
"because;": "\u2235",
"bemptyv;": "\u29B0",
"bepsi;": "\u03F6",
"bernou;": "\u212C",
"Bernoullis;": "\u212C",
"Beta;": "\u0392",
"beta;": "\u03B2",
"beth;": "\u2136",
"between;": "\u226C",
"Bfr;": "\uD835\uDD05",
"bfr;": "\uD835\uDD1F",
"bigcap;": "\u22C2",
"bigcirc;": "\u25EF",
"bigcup;": "\u22C3",
"bigodot;": "\u2A00",
"bigoplus;": "\u2A01",
"bigotimes;": "\u2A02",
"bigsqcup;": "\u2A06",
"bigstar;": "\u2605",
"bigtriangledown;": "\u25BD",
"bigtriangleup;": "\u25B3",
"biguplus;": "\u2A04",
"bigvee;": "\u22C1",
"bigwedge;": "\u22C0",
"bkarow;": "\u290D",
"blacklozenge;": "\u29EB",
"blacksquare;": "\u25AA",
"blacktriangle;": "\u25B4",
"blacktriangledown;": "\u25BE",
"blacktriangleleft;": "\u25C2",
"blacktriangleright;": "\u25B8",
"blank;": "\u2423",
"blk12;": "\u2592",
"blk14;": "\u2591",
"blk34;": "\u2593",
"block;": "\u2588",
"bne;": "\u003D\u20E5",
"bnequiv;": "\u2261\u20E5",
"bNot;": "\u2AED",
"bnot;": "\u2310",
"Bopf;": "\uD835\uDD39",
"bopf;": "\uD835\uDD53",
"bot;": "\u22A5",
"bottom;": "\u22A5",
"bowtie;": "\u22C8",
"boxbox;": "\u29C9",
"boxDL;": "\u2557",
"boxDl;": "\u2556",
"boxdL;": "\u2555",
"boxdl;": "\u2510",
"boxDR;": "\u2554",
"boxDr;": "\u2553",
"boxdR;": "\u2552",
"boxdr;": "\u250C",
"boxH;": "\u2550",
"boxh;": "\u2500",
"boxHD;": "\u2566",
"boxHd;": "\u2564",
"boxhD;": "\u2565",
"boxhd;": "\u252C",
"boxHU;": "\u2569",
"boxHu;": "\u2567",
"boxhU;": "\u2568",
"boxhu;": "\u2534",
"boxminus;": "\u229F",
"boxplus;": "\u229E",
"boxtimes;": "\u22A0",
"boxUL;": "\u255D",
"boxUl;": "\u255C",
"boxuL;": "\u255B",
"boxul;": "\u2518",
"boxUR;": "\u255A",
"boxUr;": "\u2559",
"boxuR;": "\u2558",
"boxur;": "\u2514",
"boxV;": "\u2551",
"boxv;": "\u2502",
"boxVH;": "\u256C",
"boxVh;": "\u256B",
"boxvH;": "\u256A",
"boxvh;": "\u253C",
"boxVL;": "\u2563",
"boxVl;": "\u2562",
"boxvL;": "\u2561",
"boxvl;": "\u2524",
"boxVR;": "\u2560",
"boxVr;": "\u255F",
"boxvR;": "\u255E",
"boxvr;": "\u251C",
"bprime;": "\u2035",
"Breve;": "\u02D8",
"breve;": "\u02D8",
"brvbar;": "\u00A6",
"brvbar": "\u00A6",
"Bscr;": "\u212C",
"bscr;": "\uD835\uDCB7",
"bsemi;": "\u204F",
"bsim;": "\u223D",
"bsime;": "\u22CD",
"bsol;": "\u005C",
"bsolb;": "\u29C5",
"bsolhsub;": "\u27C8",
"bull;": "\u2022",
"bullet;": "\u2022",
"bump;": "\u224E",
"bumpE;": "\u2AAE",
"bumpe;": "\u224F",
"Bumpeq;": "\u224E",
"bumpeq;": "\u224F",
"Cacute;": "\u0106",
"cacute;": "\u0107",
"Cap;": "\u22D2",
"cap;": "\u2229",
"capand;": "\u2A44",
"capbrcup;": "\u2A49",
"capcap;": "\u2A4B",
"capcup;": "\u2A47",
"capdot;": "\u2A40",
"CapitalDifferentialD;": "\u2145",
"caps;": "\u2229\uFE00",
"caret;": "\u2041",
"caron;": "\u02C7",
"Cayleys;": "\u212D",
"ccaps;": "\u2A4D",
"Ccaron;": "\u010C",
"ccaron;": "\u010D",
"Ccedil;": "\u00C7",
"Ccedil": "\u00C7",
"ccedil;": "\u00E7",
"ccedil": "\u00E7",
"Ccirc;": "\u0108",
"ccirc;": "\u0109",
"Cconint;": "\u2230",
"ccups;": "\u2A4C",
"ccupssm;": "\u2A50",
"Cdot;": "\u010A",
"cdot;": "\u010B",
"cedil;": "\u00B8",
"cedil": "\u00B8",
"Cedilla;": "\u00B8",
"cemptyv;": "\u29B2",
"cent;": "\u00A2",
"cent": "\u00A2",
"CenterDot;": "\u00B7",
"centerdot;": "\u00B7",
"Cfr;": "\u212D",
"cfr;": "\uD835\uDD20",
"CHcy;": "\u0427",
"chcy;": "\u0447",
"check;": "\u2713",
"checkmark;": "\u2713",
"Chi;": "\u03A7",
"chi;": "\u03C7",
"cir;": "\u25CB",
"circ;": "\u02C6",
"circeq;": "\u2257",
"circlearrowleft;": "\u21BA",
"circlearrowright;": "\u21BB",
"circledast;": "\u229B",
"circledcirc;": "\u229A",
"circleddash;": "\u229D",
"CircleDot;": "\u2299",
"circledR;": "\u00AE",
"circledS;": "\u24C8",
"CircleMinus;": "\u2296",
"CirclePlus;": "\u2295",
"CircleTimes;": "\u2297",
"cirE;": "\u29C3",
"cire;": "\u2257",
"cirfnint;": "\u2A10",
"cirmid;": "\u2AEF",
"cirscir;": "\u29C2",
"ClockwiseContourIntegral;": "\u2232",
"CloseCurlyDoubleQuote;": "\u201D",
"CloseCurlyQuote;": "\u2019",
"clubs;": "\u2663",
"clubsuit;": "\u2663",
"Colon;": "\u2237",
"colon;": "\u003A",
"Colone;": "\u2A74",
"colone;": "\u2254",
"coloneq;": "\u2254",
"comma;": "\u002C",
"commat;": "\u0040",
"comp;": "\u2201",
"compfn;": "\u2218",
"complement;": "\u2201",
"complexes;": "\u2102",
"cong;": "\u2245",
"congdot;": "\u2A6D",
"Congruent;": "\u2261",
"Conint;": "\u222F",
"conint;": "\u222E",
"ContourIntegral;": "\u222E",
"Copf;": "\u2102",
"copf;": "\uD835\uDD54",
"coprod;": "\u2210",
"Coproduct;": "\u2210",
"COPY;": "\u00A9",
"COPY": "\u00A9",
"copy;": "\u00A9",
"copy": "\u00A9",
"copysr;": "\u2117",
"CounterClockwiseContourIntegral;": "\u2233",
"crarr;": "\u21B5",
"Cross;": "\u2A2F",
"cross;": "\u2717",
"Cscr;": "\uD835\uDC9E",
"cscr;": "\uD835\uDCB8",
"csub;": "\u2ACF",
"csube;": "\u2AD1",
"csup;": "\u2AD0",
"csupe;": "\u2AD2",
"ctdot;": "\u22EF",
"cudarrl;": "\u2938",
"cudarrr;": "\u2935",
"cuepr;": "\u22DE",
"cuesc;": "\u22DF",
"cularr;": "\u21B6",
"cularrp;": "\u293D",
"Cup;": "\u22D3",
"cup;": "\u222A",
"cupbrcap;": "\u2A48",
"CupCap;": "\u224D",
"cupcap;": "\u2A46",
"cupcup;": "\u2A4A",
"cupdot;": "\u228D",
"cupor;": "\u2A45",
"cups;": "\u222A\uFE00",
"curarr;": "\u21B7",
"curarrm;": "\u293C",
"curlyeqprec;": "\u22DE",
"curlyeqsucc;": "\u22DF",
"curlyvee;": "\u22CE",
"curlywedge;": "\u22CF",
"curren;": "\u00A4",
"curren": "\u00A4",
"curvearrowleft;": "\u21B6",
"curvearrowright;": "\u21B7",
"cuvee;": "\u22CE",
"cuwed;": "\u22CF",
"cwconint;": "\u2232",
"cwint;": "\u2231",
"cylcty;": "\u232D",
"Dagger;": "\u2021",
"dagger;": "\u2020",
"daleth;": "\u2138",
"Darr;": "\u21A1",
"dArr;": "\u21D3",
"darr;": "\u2193",
"dash;": "\u2010",
"Dashv;": "\u2AE4",
"dashv;": "\u22A3",
"dbkarow;": "\u290F",
"dblac;": "\u02DD",
"Dcaron;": "\u010E",
"dcaron;": "\u010F",
"Dcy;": "\u0414",
"dcy;": "\u0434",
"DD;": "\u2145",
"dd;": "\u2146",
"ddagger;": "\u2021",
"ddarr;": "\u21CA",
"DDotrahd;": "\u2911",
"ddotseq;": "\u2A77",
"deg;": "\u00B0",
"deg": "\u00B0",
"Del;": "\u2207",
"Delta;": "\u0394",
"delta;": "\u03B4",
"demptyv;": "\u29B1",
"dfisht;": "\u297F",
"Dfr;": "\uD835\uDD07",
"dfr;": "\uD835\uDD21",
"dHar;": "\u2965",
"dharl;": "\u21C3",
"dharr;": "\u21C2",
"DiacriticalAcute;": "\u00B4",
"DiacriticalDot;": "\u02D9",
"DiacriticalDoubleAcute;": "\u02DD",
"DiacriticalGrave;": "\u0060",
"DiacriticalTilde;": "\u02DC",
"diam;": "\u22C4",
"Diamond;": "\u22C4",
"diamond;": "\u22C4",
"diamondsuit;": "\u2666",
"diams;": "\u2666",
"die;": "\u00A8",
"DifferentialD;": "\u2146",
"digamma;": "\u03DD",
"disin;": "\u22F2",
"div;": "\u00F7",
"divide;": "\u00F7",
"divide": "\u00F7",
"divideontimes;": "\u22C7",
"divonx;": "\u22C7",
"DJcy;": "\u0402",
"djcy;": "\u0452",
"dlcorn;": "\u231E",
"dlcrop;": "\u230D",
"dollar;": "\u0024",
"Dopf;": "\uD835\uDD3B",
"dopf;": "\uD835\uDD55",
"Dot;": "\u00A8",
"dot;": "\u02D9",
"DotDot;": "\u20DC",
"doteq;": "\u2250",
"doteqdot;": "\u2251",
"DotEqual;": "\u2250",
"dotminus;": "\u2238",
"dotplus;": "\u2214",
"dotsquare;": "\u22A1",
"doublebarwedge;": "\u2306",
"DoubleContourIntegral;": "\u222F",
"DoubleDot;": "\u00A8",
"DoubleDownArrow;": "\u21D3",
"DoubleLeftArrow;": "\u21D0",
"DoubleLeftRightArrow;": "\u21D4",
"DoubleLeftTee;": "\u2AE4",
"DoubleLongLeftArrow;": "\u27F8",
"DoubleLongLeftRightArrow;": "\u27FA",
"DoubleLongRightArrow;": "\u27F9",
"DoubleRightArrow;": "\u21D2",
"DoubleRightTee;": "\u22A8",
"DoubleUpArrow;": "\u21D1",
"DoubleUpDownArrow;": "\u21D5",
"DoubleVerticalBar;": "\u2225",
"DownArrow;": "\u2193",
"Downarrow;": "\u21D3",
"downarrow;": "\u2193",
"DownArrowBar;": "\u2913",
"DownArrowUpArrow;": "\u21F5",
"DownBreve;": "\u0311",
"downdownarrows;": "\u21CA",
"downharpoonleft;": "\u21C3",
"downharpoonright;": "\u21C2",
"DownLeftRightVector;": "\u2950",
"DownLeftTeeVector;": "\u295E",
"DownLeftVector;": "\u21BD",
"DownLeftVectorBar;": "\u2956",
"DownRightTeeVector;": "\u295F",
"DownRightVector;": "\u21C1",
"DownRightVectorBar;": "\u2957",
"DownTee;": "\u22A4",
"DownTeeArrow;": "\u21A7",
"drbkarow;": "\u2910",
"drcorn;": "\u231F",
"drcrop;": "\u230C",
"Dscr;": "\uD835\uDC9F",
"dscr;": "\uD835\uDCB9",
"DScy;": "\u0405",
"dscy;": "\u0455",
"dsol;": "\u29F6",
"Dstrok;": "\u0110",
"dstrok;": "\u0111",
"dtdot;": "\u22F1",
"dtri;": "\u25BF",
"dtrif;": "\u25BE",
"duarr;": "\u21F5",
"duhar;": "\u296F",
"dwangle;": "\u29A6",
"DZcy;": "\u040F",
"dzcy;": "\u045F",
"dzigrarr;": "\u27FF",
"Eacute;": "\u00C9",
"Eacute": "\u00C9",
"eacute;": "\u00E9",
"eacute": "\u00E9",
"easter;": "\u2A6E",
"Ecaron;": "\u011A",
"ecaron;": "\u011B",
"ecir;": "\u2256",
"Ecirc;": "\u00CA",
"Ecirc": "\u00CA",
"ecirc;": "\u00EA",
"ecirc": "\u00EA",
"ecolon;": "\u2255",
"Ecy;": "\u042D",
"ecy;": "\u044D",
"eDDot;": "\u2A77",
"Edot;": "\u0116",
"eDot;": "\u2251",
"edot;": "\u0117",
"ee;": "\u2147",
"efDot;": "\u2252",
"Efr;": "\uD835\uDD08",
"efr;": "\uD835\uDD22",
"eg;": "\u2A9A",
"Egrave;": "\u00C8",
"Egrave": "\u00C8",
"egrave;": "\u00E8",
"egrave": "\u00E8",
"egs;": "\u2A96",
"egsdot;": "\u2A98",
"el;": "\u2A99",
"Element;": "\u2208",
"elinters;": "\u23E7",
"ell;": "\u2113",
"els;": "\u2A95",
"elsdot;": "\u2A97",
"Emacr;": "\u0112",
"emacr;": "\u0113",
"empty;": "\u2205",
"emptyset;": "\u2205",
"EmptySmallSquare;": "\u25FB",
"emptyv;": "\u2205",
"EmptyVerySmallSquare;": "\u25AB",
"emsp;": "\u2003",
"emsp13;": "\u2004",
"emsp14;": "\u2005",
"ENG;": "\u014A",
"eng;": "\u014B",
"ensp;": "\u2002",
"Eogon;": "\u0118",
"eogon;": "\u0119",
"Eopf;": "\uD835\uDD3C",
"eopf;": "\uD835\uDD56",
"epar;": "\u22D5",
"eparsl;": "\u29E3",
"eplus;": "\u2A71",
"epsi;": "\u03B5",
"Epsilon;": "\u0395",
"epsilon;": "\u03B5",
"epsiv;": "\u03F5",
"eqcirc;": "\u2256",
"eqcolon;": "\u2255",
"eqsim;": "\u2242",
"eqslantgtr;": "\u2A96",
"eqslantless;": "\u2A95",
"Equal;": "\u2A75",
"equals;": "\u003D",
"EqualTilde;": "\u2242",
"equest;": "\u225F",
"Equilibrium;": "\u21CC",
"equiv;": "\u2261",
"equivDD;": "\u2A78",
"eqvparsl;": "\u29E5",
"erarr;": "\u2971",
"erDot;": "\u2253",
"Escr;": "\u2130",
"escr;": "\u212F",
"esdot;": "\u2250",
"Esim;": "\u2A73",
"esim;": "\u2242",
"Eta;": "\u0397",
"eta;": "\u03B7",
"ETH;": "\u00D0",
"ETH": "\u00D0",
"eth;": "\u00F0",
"eth": "\u00F0",
"Euml;": "\u00CB",
"Euml": "\u00CB",
"euml;": "\u00EB",
"euml": "\u00EB",
"euro;": "\u20AC",
"excl;": "\u0021",
"exist;": "\u2203",
"Exists;": "\u2203",
"expectation;": "\u2130",
"ExponentialE;": "\u2147",
"exponentiale;": "\u2147",
"fallingdotseq;": "\u2252",
"Fcy;": "\u0424",
"fcy;": "\u0444",
"female;": "\u2640",
"ffilig;": "\uFB03",
"fflig;": "\uFB00",
"ffllig;": "\uFB04",
"Ffr;": "\uD835\uDD09",
"ffr;": "\uD835\uDD23",
"filig;": "\uFB01",
"FilledSmallSquare;": "\u25FC",
"FilledVerySmallSquare;": "\u25AA",
"fjlig;": "\u0066\u006A",
"flat;": "\u266D",
"fllig;": "\uFB02",
"fltns;": "\u25B1",
"fnof;": "\u0192",
"Fopf;": "\uD835\uDD3D",
"fopf;": "\uD835\uDD57",
"ForAll;": "\u2200",
"forall;": "\u2200",
"fork;": "\u22D4",
"forkv;": "\u2AD9",
"Fouriertrf;": "\u2131",
"fpartint;": "\u2A0D",
"frac12;": "\u00BD",
"frac12": "\u00BD",
"frac13;": "\u2153",
"frac14;": "\u00BC",
"frac14": "\u00BC",
"frac15;": "\u2155",
"frac16;": "\u2159",
"frac18;": "\u215B",
"frac23;": "\u2154",
"frac25;": "\u2156",
"frac34;": "\u00BE",
"frac34": "\u00BE",
"frac35;": "\u2157",
"frac38;": "\u215C",
"frac45;": "\u2158",
"frac56;": "\u215A",
"frac58;": "\u215D",
"frac78;": "\u215E",
"frasl;": "\u2044",
"frown;": "\u2322",
"Fscr;": "\u2131",
"fscr;": "\uD835\uDCBB",
"gacute;": "\u01F5",
"Gamma;": "\u0393",
"gamma;": "\u03B3",
"Gammad;": "\u03DC",
"gammad;": "\u03DD",
"gap;": "\u2A86",
"Gbreve;": "\u011E",
"gbreve;": "\u011F",
"Gcedil;": "\u0122",
"Gcirc;": "\u011C",
"gcirc;": "\u011D",
"Gcy;": "\u0413",
"gcy;": "\u0433",
"Gdot;": "\u0120",
"gdot;": "\u0121",
"gE;": "\u2267",
"ge;": "\u2265",
"gEl;": "\u2A8C",
"gel;": "\u22DB",
"geq;": "\u2265",
"geqq;": "\u2267",
"geqslant;": "\u2A7E",
"ges;": "\u2A7E",
"gescc;": "\u2AA9",
"gesdot;": "\u2A80",
"gesdoto;": "\u2A82",
"gesdotol;": "\u2A84",
"gesl;": "\u22DB\uFE00",
"gesles;": "\u2A94",
"Gfr;": "\uD835\uDD0A",
"gfr;": "\uD835\uDD24",
"Gg;": "\u22D9",
"gg;": "\u226B",
"ggg;": "\u22D9",
"gimel;": "\u2137",
"GJcy;": "\u0403",
"gjcy;": "\u0453",
"gl;": "\u2277",
"gla;": "\u2AA5",
"glE;": "\u2A92",
"glj;": "\u2AA4",
"gnap;": "\u2A8A",
"gnapprox;": "\u2A8A",
"gnE;": "\u2269",
"gne;": "\u2A88",
"gneq;": "\u2A88",
"gneqq;": "\u2269",
"gnsim;": "\u22E7",
"Gopf;": "\uD835\uDD3E",
"gopf;": "\uD835\uDD58",
"grave;": "\u0060",
"GreaterEqual;": "\u2265",
"GreaterEqualLess;": "\u22DB",
"GreaterFullEqual;": "\u2267",
"GreaterGreater;": "\u2AA2",
"GreaterLess;": "\u2277",
"GreaterSlantEqual;": "\u2A7E",
"GreaterTilde;": "\u2273",
"Gscr;": "\uD835\uDCA2",
"gscr;": "\u210A",
"gsim;": "\u2273",
"gsime;": "\u2A8E",
"gsiml;": "\u2A90",
"GT;": "\u003E",
"GT": "\u003E",
"Gt;": "\u226B",
"gt;": "\u003E",
"gt": "\u003E",
"gtcc;": "\u2AA7",
"gtcir;": "\u2A7A",
"gtdot;": "\u22D7",
"gtlPar;": "\u2995",
"gtquest;": "\u2A7C",
"gtrapprox;": "\u2A86",
"gtrarr;": "\u2978",
"gtrdot;": "\u22D7",
"gtreqless;": "\u22DB",
"gtreqqless;": "\u2A8C",
"gtrless;": "\u2277",
"gtrsim;": "\u2273",
"gvertneqq;": "\u2269\uFE00",
"gvnE;": "\u2269\uFE00",
"Hacek;": "\u02C7",
"hairsp;": "\u200A",
"half;": "\u00BD",
"hamilt;": "\u210B",
"HARDcy;": "\u042A",
"hardcy;": "\u044A",
"hArr;": "\u21D4",
"harr;": "\u2194",
"harrcir;": "\u2948",
"harrw;": "\u21AD",
"Hat;": "\u005E",
"hbar;": "\u210F",
"Hcirc;": "\u0124",
"hcirc;": "\u0125",
"hearts;": "\u2665",
"heartsuit;": "\u2665",
"hellip;": "\u2026",
"hercon;": "\u22B9",
"Hfr;": "\u210C",
"hfr;": "\uD835\uDD25",
"HilbertSpace;": "\u210B",
"hksearow;": "\u2925",
"hkswarow;": "\u2926",
"hoarr;": "\u21FF",
"homtht;": "\u223B",
"hookleftarrow;": "\u21A9",
"hookrightarrow;": "\u21AA",
"Hopf;": "\u210D",
"hopf;": "\uD835\uDD59",
"horbar;": "\u2015",
"HorizontalLine;": "\u2500",
"Hscr;": "\u210B",
"hscr;": "\uD835\uDCBD",
"hslash;": "\u210F",
"Hstrok;": "\u0126",
"hstrok;": "\u0127",
"HumpDownHump;": "\u224E",
"HumpEqual;": "\u224F",
"hybull;": "\u2043",
"hyphen;": "\u2010",
"Iacute;": "\u00CD",
"Iacute": "\u00CD",
"iacute;": "\u00ED",
"iacute": "\u00ED",
"ic;": "\u2063",
"Icirc;": "\u00CE",
"Icirc": "\u00CE",
"icirc;": "\u00EE",
"icirc": "\u00EE",
"Icy;": "\u0418",
"icy;": "\u0438",
"Idot;": "\u0130",
"IEcy;": "\u0415",
"iecy;": "\u0435",
"iexcl;": "\u00A1",
"iexcl": "\u00A1",
"iff;": "\u21D4",
"Ifr;": "\u2111",
"ifr;": "\uD835\uDD26",
"Igrave;": "\u00CC",
"Igrave": "\u00CC",
"igrave;": "\u00EC",
"igrave": "\u00EC",
"ii;": "\u2148",
"iiiint;": "\u2A0C",
"iiint;": "\u222D",
"iinfin;": "\u29DC",
"iiota;": "\u2129",
"IJlig;": "\u0132",
"ijlig;": "\u0133",
"Im;": "\u2111",
"Imacr;": "\u012A",
"imacr;": "\u012B",
"image;": "\u2111",
"ImaginaryI;": "\u2148",
"imagline;": "\u2110",
"imagpart;": "\u2111",
"imath;": "\u0131",
"imof;": "\u22B7",
"imped;": "\u01B5",
"Implies;": "\u21D2",
"in;": "\u2208",
"incare;": "\u2105",
"infin;": "\u221E",
"infintie;": "\u29DD",
"inodot;": "\u0131",
"Int;": "\u222C",
"int;": "\u222B",
"intcal;": "\u22BA",
"integers;": "\u2124",
"Integral;": "\u222B",
"intercal;": "\u22BA",
"Intersection;": "\u22C2",
"intlarhk;": "\u2A17",
"intprod;": "\u2A3C",
"InvisibleComma;": "\u2063",
"InvisibleTimes;": "\u2062",
"IOcy;": "\u0401",
"iocy;": "\u0451",
"Iogon;": "\u012E",
"iogon;": "\u012F",
"Iopf;": "\uD835\uDD40",
"iopf;": "\uD835\uDD5A",
"Iota;": "\u0399",
"iota;": "\u03B9",
"iprod;": "\u2A3C",
"iquest;": "\u00BF",
"iquest": "\u00BF",
"Iscr;": "\u2110",
"iscr;": "\uD835\uDCBE",
"isin;": "\u2208",
"isindot;": "\u22F5",
"isinE;": "\u22F9",
"isins;": "\u22F4",
"isinsv;": "\u22F3",
"isinv;": "\u2208",
"it;": "\u2062",
"Itilde;": "\u0128",
"itilde;": "\u0129",
"Iukcy;": "\u0406",
"iukcy;": "\u0456",
"Iuml;": "\u00CF",
"Iuml": "\u00CF",
"iuml;": "\u00EF",
"iuml": "\u00EF",
"Jcirc;": "\u0134",
"jcirc;": "\u0135",
"Jcy;": "\u0419",
"jcy;": "\u0439",
"Jfr;": "\uD835\uDD0D",
"jfr;": "\uD835\uDD27",
"jmath;": "\u0237",
"Jopf;": "\uD835\uDD41",
"jopf;": "\uD835\uDD5B",
"Jscr;": "\uD835\uDCA5",
"jscr;": "\uD835\uDCBF",
"Jsercy;": "\u0408",
"jsercy;": "\u0458",
"Jukcy;": "\u0404",
"jukcy;": "\u0454",
"Kappa;": "\u039A",
"kappa;": "\u03BA",
"kappav;": "\u03F0",
"Kcedil;": "\u0136",
"kcedil;": "\u0137",
"Kcy;": "\u041A",
"kcy;": "\u043A",
"Kfr;": "\uD835\uDD0E",
"kfr;": "\uD835\uDD28",
"kgreen;": "\u0138",
"KHcy;": "\u0425",
"khcy;": "\u0445",
"KJcy;": "\u040C",
"kjcy;": "\u045C",
"Kopf;": "\uD835\uDD42",
"kopf;": "\uD835\uDD5C",
"Kscr;": "\uD835\uDCA6",
"kscr;": "\uD835\uDCC0",
"lAarr;": "\u21DA",
"Lacute;": "\u0139",
"lacute;": "\u013A",
"laemptyv;": "\u29B4",
"lagran;": "\u2112",
"Lambda;": "\u039B",
"lambda;": "\u03BB",
"Lang;": "\u27EA",
"lang;": "\u27E8",
"langd;": "\u2991",
"langle;": "\u27E8",
"lap;": "\u2A85",
"Laplacetrf;": "\u2112",
"laquo;": "\u00AB",
"laquo": "\u00AB",
"Larr;": "\u219E",
"lArr;": "\u21D0",
"larr;": "\u2190",
"larrb;": "\u21E4",
"larrbfs;": "\u291F",
"larrfs;": "\u291D",
"larrhk;": "\u21A9",
"larrlp;": "\u21AB",
"larrpl;": "\u2939",
"larrsim;": "\u2973",
"larrtl;": "\u21A2",
"lat;": "\u2AAB",
"lAtail;": "\u291B",
"latail;": "\u2919",
"late;": "\u2AAD",
"lates;": "\u2AAD\uFE00",
"lBarr;": "\u290E",
"lbarr;": "\u290C",
"lbbrk;": "\u2772",
"lbrace;": "\u007B",
"lbrack;": "\u005B",
"lbrke;": "\u298B",
"lbrksld;": "\u298F",
"lbrkslu;": "\u298D",
"Lcaron;": "\u013D",
"lcaron;": "\u013E",
"Lcedil;": "\u013B",
"lcedil;": "\u013C",
"lceil;": "\u2308",
"lcub;": "\u007B",
"Lcy;": "\u041B",
"lcy;": "\u043B",
"ldca;": "\u2936",
"ldquo;": "\u201C",
"ldquor;": "\u201E",
"ldrdhar;": "\u2967",
"ldrushar;": "\u294B",
"ldsh;": "\u21B2",
"lE;": "\u2266",
"le;": "\u2264",
"LeftAngleBracket;": "\u27E8",
"LeftArrow;": "\u2190",
"Leftarrow;": "\u21D0",
"leftarrow;": "\u2190",
"LeftArrowBar;": "\u21E4",
"LeftArrowRightArrow;": "\u21C6",
"leftarrowtail;": "\u21A2",
"LeftCeiling;": "\u2308",
"LeftDoubleBracket;": "\u27E6",
"LeftDownTeeVector;": "\u2961",
"LeftDownVector;": "\u21C3",
"LeftDownVectorBar;": "\u2959",
"LeftFloor;": "\u230A",
"leftharpoondown;": "\u21BD",
"leftharpoonup;": "\u21BC",
"leftleftarrows;": "\u21C7",
"LeftRightArrow;": "\u2194",
"Leftrightarrow;": "\u21D4",
"leftrightarrow;": "\u2194",
"leftrightarrows;": "\u21C6",
"leftrightharpoons;": "\u21CB",
"leftrightsquigarrow;": "\u21AD",
"LeftRightVector;": "\u294E",
"LeftTee;": "\u22A3",
"LeftTeeArrow;": "\u21A4",
"LeftTeeVector;": "\u295A",
"leftthreetimes;": "\u22CB",
"LeftTriangle;": "\u22B2",
"LeftTriangleBar;": "\u29CF",
"LeftTriangleEqual;": "\u22B4",
"LeftUpDownVector;": "\u2951",
"LeftUpTeeVector;": "\u2960",
"LeftUpVector;": "\u21BF",
"LeftUpVectorBar;": "\u2958",
"LeftVector;": "\u21BC",
"LeftVectorBar;": "\u2952",
"lEg;": "\u2A8B",
"leg;": "\u22DA",
"leq;": "\u2264",
"leqq;": "\u2266",
"leqslant;": "\u2A7D",
"les;": "\u2A7D",
"lescc;": "\u2AA8",
"lesdot;": "\u2A7F",
"lesdoto;": "\u2A81",
"lesdotor;": "\u2A83",
"lesg;": "\u22DA\uFE00",
"lesges;": "\u2A93",
"lessapprox;": "\u2A85",
"lessdot;": "\u22D6",
"lesseqgtr;": "\u22DA",
"lesseqqgtr;": "\u2A8B",
"LessEqualGreater;": "\u22DA",
"LessFullEqual;": "\u2266",
"LessGreater;": "\u2276",
"lessgtr;": "\u2276",
"LessLess;": "\u2AA1",
"lesssim;": "\u2272",
"LessSlantEqual;": "\u2A7D",
"LessTilde;": "\u2272",
"lfisht;": "\u297C",
"lfloor;": "\u230A",
"Lfr;": "\uD835\uDD0F",
"lfr;": "\uD835\uDD29",
"lg;": "\u2276",
"lgE;": "\u2A91",
"lHar;": "\u2962",
"lhard;": "\u21BD",
"lharu;": "\u21BC",
"lharul;": "\u296A",
"lhblk;": "\u2584",
"LJcy;": "\u0409",
"ljcy;": "\u0459",
"Ll;": "\u22D8",
"ll;": "\u226A",
"llarr;": "\u21C7",
"llcorner;": "\u231E",
"Lleftarrow;": "\u21DA",
"llhard;": "\u296B",
"lltri;": "\u25FA",
"Lmidot;": "\u013F",
"lmidot;": "\u0140",
"lmoust;": "\u23B0",
"lmoustache;": "\u23B0",
"lnap;": "\u2A89",
"lnapprox;": "\u2A89",
"lnE;": "\u2268",
"lne;": "\u2A87",
"lneq;": "\u2A87",
"lneqq;": "\u2268",
"lnsim;": "\u22E6",
"loang;": "\u27EC",
"loarr;": "\u21FD",
"lobrk;": "\u27E6",
"LongLeftArrow;": "\u27F5",
"Longleftarrow;": "\u27F8",
"longleftarrow;": "\u27F5",
"LongLeftRightArrow;": "\u27F7",
"Longleftrightarrow;": "\u27FA",
"longleftrightarrow;": "\u27F7",
"longmapsto;": "\u27FC",
"LongRightArrow;": "\u27F6",
"Longrightarrow;": "\u27F9",
"longrightarrow;": "\u27F6",
"looparrowleft;": "\u21AB",
"looparrowright;": "\u21AC",
"lopar;": "\u2985",
"Lopf;": "\uD835\uDD43",
"lopf;": "\uD835\uDD5D",
"loplus;": "\u2A2D",
"lotimes;": "\u2A34",
"lowast;": "\u2217",
"lowbar;": "\u005F",
"LowerLeftArrow;": "\u2199",
"LowerRightArrow;": "\u2198",
"loz;": "\u25CA",
"lozenge;": "\u25CA",
"lozf;": "\u29EB",
"lpar;": "\u0028",
"lparlt;": "\u2993",
"lrarr;": "\u21C6",
"lrcorner;": "\u231F",
"lrhar;": "\u21CB",
"lrhard;": "\u296D",
"lrm;": "\u200E",
"lrtri;": "\u22BF",
"lsaquo;": "\u2039",
"Lscr;": "\u2112",
"lscr;": "\uD835\uDCC1",
"Lsh;": "\u21B0",
"lsh;": "\u21B0",
"lsim;": "\u2272",
"lsime;": "\u2A8D",
"lsimg;": "\u2A8F",
"lsqb;": "\u005B",
"lsquo;": "\u2018",
"lsquor;": "\u201A",
"Lstrok;": "\u0141",
"lstrok;": "\u0142",
"LT;": "\u003C",
"LT": "\u003C",
"Lt;": "\u226A",
"lt;": "\u003C",
"lt": "\u003C",
"ltcc;": "\u2AA6",
"ltcir;": "\u2A79",
"ltdot;": "\u22D6",
"lthree;": "\u22CB",
"ltimes;": "\u22C9",
"ltlarr;": "\u2976",
"ltquest;": "\u2A7B",
"ltri;": "\u25C3",
"ltrie;": "\u22B4",
"ltrif;": "\u25C2",
"ltrPar;": "\u2996",
"lurdshar;": "\u294A",
"luruhar;": "\u2966",
"lvertneqq;": "\u2268\uFE00",
"lvnE;": "\u2268\uFE00",
"macr;": "\u00AF",
"macr": "\u00AF",
"male;": "\u2642",
"malt;": "\u2720",
"maltese;": "\u2720",
"Map;": "\u2905",
"map;": "\u21A6",
"mapsto;": "\u21A6",
"mapstodown;": "\u21A7",
"mapstoleft;": "\u21A4",
"mapstoup;": "\u21A5",
"marker;": "\u25AE",
"mcomma;": "\u2A29",
"Mcy;": "\u041C",
"mcy;": "\u043C",
"mdash;": "\u2014",
"mDDot;": "\u223A",
"measuredangle;": "\u2221",
"MediumSpace;": "\u205F",
"Mellintrf;": "\u2133",
"Mfr;": "\uD835\uDD10",
"mfr;": "\uD835\uDD2A",
"mho;": "\u2127",
"micro;": "\u00B5",
"micro": "\u00B5",
"mid;": "\u2223",
"midast;": "\u002A",
"midcir;": "\u2AF0",
"middot;": "\u00B7",
"middot": "\u00B7",
"minus;": "\u2212",
"minusb;": "\u229F",
"minusd;": "\u2238",
"minusdu;": "\u2A2A",
"MinusPlus;": "\u2213",
"mlcp;": "\u2ADB",
"mldr;": "\u2026",
"mnplus;": "\u2213",
"models;": "\u22A7",
"Mopf;": "\uD835\uDD44",
"mopf;": "\uD835\uDD5E",
"mp;": "\u2213",
"Mscr;": "\u2133",
"mscr;": "\uD835\uDCC2",
"mstpos;": "\u223E",
"Mu;": "\u039C",
"mu;": "\u03BC",
"multimap;": "\u22B8",
"mumap;": "\u22B8",
"nabla;": "\u2207",
"Nacute;": "\u0143",
"nacute;": "\u0144",
"nang;": "\u2220\u20D2",
"nap;": "\u2249",
"napE;": "\u2A70\u0338",
"napid;": "\u224B\u0338",
"napos;": "\u0149",
"napprox;": "\u2249",
"natur;": "\u266E",
"natural;": "\u266E",
"naturals;": "\u2115",
"nbsp;": "\u00A0",
"nbsp": "\u00A0",
"nbump;": "\u224E\u0338",
"nbumpe;": "\u224F\u0338",
"ncap;": "\u2A43",
"Ncaron;": "\u0147",
"ncaron;": "\u0148",
"Ncedil;": "\u0145",
"ncedil;": "\u0146",
"ncong;": "\u2247",
"ncongdot;": "\u2A6D\u0338",
"ncup;": "\u2A42",
"Ncy;": "\u041D",
"ncy;": "\u043D",
"ndash;": "\u2013",
"ne;": "\u2260",
"nearhk;": "\u2924",
"neArr;": "\u21D7",
"nearr;": "\u2197",
"nearrow;": "\u2197",
"nedot;": "\u2250\u0338",
"NegativeMediumSpace;": "\u200B",
"NegativeThickSpace;": "\u200B",
"NegativeThinSpace;": "\u200B",
"NegativeVeryThinSpace;": "\u200B",
"nequiv;": "\u2262",
"nesear;": "\u2928",
"nesim;": "\u2242\u0338",
"NestedGreaterGreater;": "\u226B",
"NestedLessLess;": "\u226A",
"NewLine;": "\u000A",
"nexist;": "\u2204",
"nexists;": "\u2204",
"Nfr;": "\uD835\uDD11",
"nfr;": "\uD835\uDD2B",
"ngE;": "\u2267\u0338",
"nge;": "\u2271",
"ngeq;": "\u2271",
"ngeqq;": "\u2267\u0338",
"ngeqslant;": "\u2A7E\u0338",
"nges;": "\u2A7E\u0338",
"nGg;": "\u22D9\u0338",
"ngsim;": "\u2275",
"nGt;": "\u226B\u20D2",
"ngt;": "\u226F",
"ngtr;": "\u226F",
"nGtv;": "\u226B\u0338",
"nhArr;": "\u21CE",
"nharr;": "\u21AE",
"nhpar;": "\u2AF2",
"ni;": "\u220B",
"nis;": "\u22FC",
"nisd;": "\u22FA",
"niv;": "\u220B",
"NJcy;": "\u040A",
"njcy;": "\u045A",
"nlArr;": "\u21CD",
"nlarr;": "\u219A",
"nldr;": "\u2025",
"nlE;": "\u2266\u0338",
"nle;": "\u2270",
"nLeftarrow;": "\u21CD",
"nleftarrow;": "\u219A",
"nLeftrightarrow;": "\u21CE",
"nleftrightarrow;": "\u21AE",
"nleq;": "\u2270",
"nleqq;": "\u2266\u0338",
"nleqslant;": "\u2A7D\u0338",
"nles;": "\u2A7D\u0338",
"nless;": "\u226E",
"nLl;": "\u22D8\u0338",
"nlsim;": "\u2274",
"nLt;": "\u226A\u20D2",
"nlt;": "\u226E",
"nltri;": "\u22EA",
"nltrie;": "\u22EC",
"nLtv;": "\u226A\u0338",
"nmid;": "\u2224",
"NoBreak;": "\u2060",
"NonBreakingSpace;": "\u00A0",
"Nopf;": "\u2115",
"nopf;": "\uD835\uDD5F",
"Not;": "\u2AEC",
"not;": "\u00AC",
"not": "\u00AC",
"NotCongruent;": "\u2262",
"NotCupCap;": "\u226D",
"NotDoubleVerticalBar;": "\u2226",
"NotElement;": "\u2209",
"NotEqual;": "\u2260",
"NotEqualTilde;": "\u2242\u0338",
"NotExists;": "\u2204",
"NotGreater;": "\u226F",
"NotGreaterEqual;": "\u2271",
"NotGreaterFullEqual;": "\u2267\u0338",
"NotGreaterGreater;": "\u226B\u0338",
"NotGreaterLess;": "\u2279",
"NotGreaterSlantEqual;": "\u2A7E\u0338",
"NotGreaterTilde;": "\u2275",
"NotHumpDownHump;": "\u224E\u0338",
"NotHumpEqual;": "\u224F\u0338",
"notin;": "\u2209",
"notindot;": "\u22F5\u0338",
"notinE;": "\u22F9\u0338",
"notinva;": "\u2209",
"notinvb;": "\u22F7",
"notinvc;": "\u22F6",
"NotLeftTriangle;": "\u22EA",
"NotLeftTriangleBar;": "\u29CF\u0338",
"NotLeftTriangleEqual;": "\u22EC",
"NotLess;": "\u226E",
"NotLessEqual;": "\u2270",
"NotLessGreater;": "\u2278",
"NotLessLess;": "\u226A\u0338",
"NotLessSlantEqual;": "\u2A7D\u0338",
"NotLessTilde;": "\u2274",
"NotNestedGreaterGreater;": "\u2AA2\u0338",
"NotNestedLessLess;": "\u2AA1\u0338",
"notni;": "\u220C",
"notniva;": "\u220C",
"notnivb;": "\u22FE",
"notnivc;": "\u22FD",
"NotPrecedes;": "\u2280",
"NotPrecedesEqual;": "\u2AAF\u0338",
"NotPrecedesSlantEqual;": "\u22E0",
"NotReverseElement;": "\u220C",
"NotRightTriangle;": "\u22EB",
"NotRightTriangleBar;": "\u29D0\u0338",
"NotRightTriangleEqual;": "\u22ED",
"NotSquareSubset;": "\u228F\u0338",
"NotSquareSubsetEqual;": "\u22E2",
"NotSquareSuperset;": "\u2290\u0338",
"NotSquareSupersetEqual;": "\u22E3",
"NotSubset;": "\u2282\u20D2",
"NotSubsetEqual;": "\u2288",
"NotSucceeds;": "\u2281",
"NotSucceedsEqual;": "\u2AB0\u0338",
"NotSucceedsSlantEqual;": "\u22E1",
"NotSucceedsTilde;": "\u227F\u0338",
"NotSuperset;": "\u2283\u20D2",
"NotSupersetEqual;": "\u2289",
"NotTilde;": "\u2241",
"NotTildeEqual;": "\u2244",
"NotTildeFullEqual;": "\u2247",
"NotTildeTilde;": "\u2249",
"NotVerticalBar;": "\u2224",
"npar;": "\u2226",
"nparallel;": "\u2226",
"nparsl;": "\u2AFD\u20E5",
"npart;": "\u2202\u0338",
"npolint;": "\u2A14",
"npr;": "\u2280",
"nprcue;": "\u22E0",
"npre;": "\u2AAF\u0338",
"nprec;": "\u2280",
"npreceq;": "\u2AAF\u0338",
"nrArr;": "\u21CF",
"nrarr;": "\u219B",
"nrarrc;": "\u2933\u0338",
"nrarrw;": "\u219D\u0338",
"nRightarrow;": "\u21CF",
"nrightarrow;": "\u219B",
"nrtri;": "\u22EB",
"nrtrie;": "\u22ED",
"nsc;": "\u2281",
"nsccue;": "\u22E1",
"nsce;": "\u2AB0\u0338",
"Nscr;": "\uD835\uDCA9",
"nscr;": "\uD835\uDCC3",
"nshortmid;": "\u2224",
"nshortparallel;": "\u2226",
"nsim;": "\u2241",
"nsime;": "\u2244",
"nsimeq;": "\u2244",
"nsmid;": "\u2224",
"nspar;": "\u2226",
"nsqsube;": "\u22E2",
"nsqsupe;": "\u22E3",
"nsub;": "\u2284",
"nsubE;": "\u2AC5\u0338",
"nsube;": "\u2288",
"nsubset;": "\u2282\u20D2",
"nsubseteq;": "\u2288",
"nsubseteqq;": "\u2AC5\u0338",
"nsucc;": "\u2281",
"nsucceq;": "\u2AB0\u0338",
"nsup;": "\u2285",
"nsupE;": "\u2AC6\u0338",
"nsupe;": "\u2289",
"nsupset;": "\u2283\u20D2",
"nsupseteq;": "\u2289",
"nsupseteqq;": "\u2AC6\u0338",
"ntgl;": "\u2279",
"Ntilde;": "\u00D1",
"Ntilde": "\u00D1",
"ntilde;": "\u00F1",
"ntilde": "\u00F1",
"ntlg;": "\u2278",
"ntriangleleft;": "\u22EA",
"ntrianglelefteq;": "\u22EC",
"ntriangleright;": "\u22EB",
"ntrianglerighteq;": "\u22ED",
"Nu;": "\u039D",
"nu;": "\u03BD",
"num;": "\u0023",
"numero;": "\u2116",
"numsp;": "\u2007",
"nvap;": "\u224D\u20D2",
"nVDash;": "\u22AF",
"nVdash;": "\u22AE",
"nvDash;": "\u22AD",
"nvdash;": "\u22AC",
"nvge;": "\u2265\u20D2",
"nvgt;": "\u003E\u20D2",
"nvHarr;": "\u2904",
"nvinfin;": "\u29DE",
"nvlArr;": "\u2902",
"nvle;": "\u2264\u20D2",
"nvlt;": "\u003C\u20D2",
"nvltrie;": "\u22B4\u20D2",
"nvrArr;": "\u2903",
"nvrtrie;": "\u22B5\u20D2",
"nvsim;": "\u223C\u20D2",
"nwarhk;": "\u2923",
"nwArr;": "\u21D6",
"nwarr;": "\u2196",
"nwarrow;": "\u2196",
"nwnear;": "\u2927",
"Oacute;": "\u00D3",
"Oacute": "\u00D3",
"oacute;": "\u00F3",
"oacute": "\u00F3",
"oast;": "\u229B",
"ocir;": "\u229A",
"Ocirc;": "\u00D4",
"Ocirc": "\u00D4",
"ocirc;": "\u00F4",
"ocirc": "\u00F4",
"Ocy;": "\u041E",
"ocy;": "\u043E",
"odash;": "\u229D",
"Odblac;": "\u0150",
"odblac;": "\u0151",
"odiv;": "\u2A38",
"odot;": "\u2299",
"odsold;": "\u29BC",
"OElig;": "\u0152",
"oelig;": "\u0153",
"ofcir;": "\u29BF",
"Ofr;": "\uD835\uDD12",
"ofr;": "\uD835\uDD2C",
"ogon;": "\u02DB",
"Ograve;": "\u00D2",
"Ograve": "\u00D2",
"ograve;": "\u00F2",
"ograve": "\u00F2",
"ogt;": "\u29C1",
"ohbar;": "\u29B5",
"ohm;": "\u03A9",
"oint;": "\u222E",
"olarr;": "\u21BA",
"olcir;": "\u29BE",
"olcross;": "\u29BB",
"oline;": "\u203E",
"olt;": "\u29C0",
"Omacr;": "\u014C",
"omacr;": "\u014D",
"Omega;": "\u03A9",
"omega;": "\u03C9",
"Omicron;": "\u039F",
"omicron;": "\u03BF",
"omid;": "\u29B6",
"ominus;": "\u2296",
"Oopf;": "\uD835\uDD46",
"oopf;": "\uD835\uDD60",
"opar;": "\u29B7",
"OpenCurlyDoubleQuote;": "\u201C",
"OpenCurlyQuote;": "\u2018",
"operp;": "\u29B9",
"oplus;": "\u2295",
"Or;": "\u2A54",
"or;": "\u2228",
"orarr;": "\u21BB",
"ord;": "\u2A5D",
"order;": "\u2134",
"orderof;": "\u2134",
"ordf;": "\u00AA",
"ordf": "\u00AA",
"ordm;": "\u00BA",
"ordm": "\u00BA",
"origof;": "\u22B6",
"oror;": "\u2A56",
"orslope;": "\u2A57",
"orv;": "\u2A5B",
"oS;": "\u24C8",
"Oscr;": "\uD835\uDCAA",
"oscr;": "\u2134",
"Oslash;": "\u00D8",
"Oslash": "\u00D8",
"oslash;": "\u00F8",
"oslash": "\u00F8",
"osol;": "\u2298",
"Otilde;": "\u00D5",
"Otilde": "\u00D5",
"otilde;": "\u00F5",
"otilde": "\u00F5",
"Otimes;": "\u2A37",
"otimes;": "\u2297",
"otimesas;": "\u2A36",
"Ouml;": "\u00D6",
"Ouml": "\u00D6",
"ouml;": "\u00F6",
"ouml": "\u00F6",
"ovbar;": "\u233D",
"OverBar;": "\u203E",
"OverBrace;": "\u23DE",
"OverBracket;": "\u23B4",
"OverParenthesis;": "\u23DC",
"par;": "\u2225",
"para;": "\u00B6",
"para": "\u00B6",
"parallel;": "\u2225",
"parsim;": "\u2AF3",
"parsl;": "\u2AFD",
"part;": "\u2202",
"PartialD;": "\u2202",
"Pcy;": "\u041F",
"pcy;": "\u043F",
"percnt;": "\u0025",
"period;": "\u002E",
"permil;": "\u2030",
"perp;": "\u22A5",
"pertenk;": "\u2031",
"Pfr;": "\uD835\uDD13",
"pfr;": "\uD835\uDD2D",
"Phi;": "\u03A6",
"phi;": "\u03C6",
"phiv;": "\u03D5",
"phmmat;": "\u2133",
"phone;": "\u260E",
"Pi;": "\u03A0",
"pi;": "\u03C0",
"pitchfork;": "\u22D4",
"piv;": "\u03D6",
"planck;": "\u210F",
"planckh;": "\u210E",
"plankv;": "\u210F",
"plus;": "\u002B",
"plusacir;": "\u2A23",
"plusb;": "\u229E",
"pluscir;": "\u2A22",
"plusdo;": "\u2214",
"plusdu;": "\u2A25",
"pluse;": "\u2A72",
"PlusMinus;": "\u00B1",
"plusmn;": "\u00B1",
"plusmn": "\u00B1",
"plussim;": "\u2A26",
"plustwo;": "\u2A27",
"pm;": "\u00B1",
"Poincareplane;": "\u210C",
"pointint;": "\u2A15",
"Popf;": "\u2119",
"popf;": "\uD835\uDD61",
"pound;": "\u00A3",
"pound": "\u00A3",
"Pr;": "\u2ABB",
"pr;": "\u227A",
"prap;": "\u2AB7",
"prcue;": "\u227C",
"prE;": "\u2AB3",
"pre;": "\u2AAF",
"prec;": "\u227A",
"precapprox;": "\u2AB7",
"preccurlyeq;": "\u227C",
"Precedes;": "\u227A",
"PrecedesEqual;": "\u2AAF",
"PrecedesSlantEqual;": "\u227C",
"PrecedesTilde;": "\u227E",
"preceq;": "\u2AAF",
"precnapprox;": "\u2AB9",
"precneqq;": "\u2AB5",
"precnsim;": "\u22E8",
"precsim;": "\u227E",
"Prime;": "\u2033",
"prime;": "\u2032",
"primes;": "\u2119",
"prnap;": "\u2AB9",
"prnE;": "\u2AB5",
"prnsim;": "\u22E8",
"prod;": "\u220F",
"Product;": "\u220F",
"profalar;": "\u232E",
"profline;": "\u2312",
"profsurf;": "\u2313",
"prop;": "\u221D",
"Proportion;": "\u2237",
"Proportional;": "\u221D",
"propto;": "\u221D",
"prsim;": "\u227E",
"prurel;": "\u22B0",
"Pscr;": "\uD835\uDCAB",
"pscr;": "\uD835\uDCC5",
"Psi;": "\u03A8",
"psi;": "\u03C8",
"puncsp;": "\u2008",
"Qfr;": "\uD835\uDD14",
"qfr;": "\uD835\uDD2E",
"qint;": "\u2A0C",
"Qopf;": "\u211A",
"qopf;": "\uD835\uDD62",
"qprime;": "\u2057",
"Qscr;": "\uD835\uDCAC",
"qscr;": "\uD835\uDCC6",
"quaternions;": "\u210D",
"quatint;": "\u2A16",
"quest;": "\u003F",
"questeq;": "\u225F",
"QUOT;": "\u0022",
"QUOT": "\u0022",
"quot;": "\u0022",
"quot": "\u0022",
"rAarr;": "\u21DB",
"race;": "\u223D\u0331",
"Racute;": "\u0154",
"racute;": "\u0155",
"radic;": "\u221A",
"raemptyv;": "\u29B3",
"Rang;": "\u27EB",
"rang;": "\u27E9",
"rangd;": "\u2992",
"range;": "\u29A5",
"rangle;": "\u27E9",
"raquo;": "\u00BB",
"raquo": "\u00BB",
"Rarr;": "\u21A0",
"rArr;": "\u21D2",
"rarr;": "\u2192",
"rarrap;": "\u2975",
"rarrb;": "\u21E5",
"rarrbfs;": "\u2920",
"rarrc;": "\u2933",
"rarrfs;": "\u291E",
"rarrhk;": "\u21AA",
"rarrlp;": "\u21AC",
"rarrpl;": "\u2945",
"rarrsim;": "\u2974",
"Rarrtl;": "\u2916",
"rarrtl;": "\u21A3",
"rarrw;": "\u219D",
"rAtail;": "\u291C",
"ratail;": "\u291A",
"ratio;": "\u2236",
"rationals;": "\u211A",
"RBarr;": "\u2910",
"rBarr;": "\u290F",
"rbarr;": "\u290D",
"rbbrk;": "\u2773",
"rbrace;": "\u007D",
"rbrack;": "\u005D",
"rbrke;": "\u298C",
"rbrksld;": "\u298E",
"rbrkslu;": "\u2990",
"Rcaron;": "\u0158",
"rcaron;": "\u0159",
"Rcedil;": "\u0156",
"rcedil;": "\u0157",
"rceil;": "\u2309",
"rcub;": "\u007D",
"Rcy;": "\u0420",
"rcy;": "\u0440",
"rdca;": "\u2937",
"rdldhar;": "\u2969",
"rdquo;": "\u201D",
"rdquor;": "\u201D",
"rdsh;": "\u21B3",
"Re;": "\u211C",
"real;": "\u211C",
"realine;": "\u211B",
"realpart;": "\u211C",
"reals;": "\u211D",
"rect;": "\u25AD",
"REG;": "\u00AE",
"REG": "\u00AE",
"reg;": "\u00AE",
"reg": "\u00AE",
"ReverseElement;": "\u220B",
"ReverseEquilibrium;": "\u21CB",
"ReverseUpEquilibrium;": "\u296F",
"rfisht;": "\u297D",
"rfloor;": "\u230B",
"Rfr;": "\u211C",
"rfr;": "\uD835\uDD2F",
"rHar;": "\u2964",
"rhard;": "\u21C1",
"rharu;": "\u21C0",
"rharul;": "\u296C",
"Rho;": "\u03A1",
"rho;": "\u03C1",
"rhov;": "\u03F1",
"RightAngleBracket;": "\u27E9",
"RightArrow;": "\u2192",
"Rightarrow;": "\u21D2",
"rightarrow;": "\u2192",
"RightArrowBar;": "\u21E5",
"RightArrowLeftArrow;": "\u21C4",
"rightarrowtail;": "\u21A3",
"RightCeiling;": "\u2309",
"RightDoubleBracket;": "\u27E7",
"RightDownTeeVector;": "\u295D",
"RightDownVector;": "\u21C2",
"RightDownVectorBar;": "\u2955",
"RightFloor;": "\u230B",
"rightharpoondown;": "\u21C1",
"rightharpoonup;": "\u21C0",
"rightleftarrows;": "\u21C4",
"rightleftharpoons;": "\u21CC",
"rightrightarrows;": "\u21C9",
"rightsquigarrow;": "\u219D",
"RightTee;": "\u22A2",
"RightTeeArrow;": "\u21A6",
"RightTeeVector;": "\u295B",
"rightthreetimes;": "\u22CC",
"RightTriangle;": "\u22B3",
"RightTriangleBar;": "\u29D0",
"RightTriangleEqual;": "\u22B5",
"RightUpDownVector;": "\u294F",
"RightUpTeeVector;": "\u295C",
"RightUpVector;": "\u21BE",
"RightUpVectorBar;": "\u2954",
"RightVector;": "\u21C0",
"RightVectorBar;": "\u2953",
"ring;": "\u02DA",
"risingdotseq;": "\u2253",
"rlarr;": "\u21C4",
"rlhar;": "\u21CC",
"rlm;": "\u200F",
"rmoust;": "\u23B1",
"rmoustache;": "\u23B1",
"rnmid;": "\u2AEE",
"roang;": "\u27ED",
"roarr;": "\u21FE",
"robrk;": "\u27E7",
"ropar;": "\u2986",
"Ropf;": "\u211D",
"ropf;": "\uD835\uDD63",
"roplus;": "\u2A2E",
"rotimes;": "\u2A35",
"RoundImplies;": "\u2970",
"rpar;": "\u0029",
"rpargt;": "\u2994",
"rppolint;": "\u2A12",
"rrarr;": "\u21C9",
"Rrightarrow;": "\u21DB",
"rsaquo;": "\u203A",
"Rscr;": "\u211B",
"rscr;": "\uD835\uDCC7",
"Rsh;": "\u21B1",
"rsh;": "\u21B1",
"rsqb;": "\u005D",
"rsquo;": "\u2019",
"rsquor;": "\u2019",
"rthree;": "\u22CC",
"rtimes;": "\u22CA",
"rtri;": "\u25B9",
"rtrie;": "\u22B5",
"rtrif;": "\u25B8",
"rtriltri;": "\u29CE",
"RuleDelayed;": "\u29F4",
"ruluhar;": "\u2968",
"rx;": "\u211E",
"Sacute;": "\u015A",
"sacute;": "\u015B",
"sbquo;": "\u201A",
"Sc;": "\u2ABC",
"sc;": "\u227B",
"scap;": "\u2AB8",
"Scaron;": "\u0160",
"scaron;": "\u0161",
"sccue;": "\u227D",
"scE;": "\u2AB4",
"sce;": "\u2AB0",
"Scedil;": "\u015E",
"scedil;": "\u015F",
"Scirc;": "\u015C",
"scirc;": "\u015D",
"scnap;": "\u2ABA",
"scnE;": "\u2AB6",
"scnsim;": "\u22E9",
"scpolint;": "\u2A13",
"scsim;": "\u227F",
"Scy;": "\u0421",
"scy;": "\u0441",
"sdot;": "\u22C5",
"sdotb;": "\u22A1",
"sdote;": "\u2A66",
"searhk;": "\u2925",
"seArr;": "\u21D8",
"searr;": "\u2198",
"searrow;": "\u2198",
"sect;": "\u00A7",
"sect": "\u00A7",
"semi;": "\u003B",
"seswar;": "\u2929",
"setminus;": "\u2216",
"setmn;": "\u2216",
"sext;": "\u2736",
"Sfr;": "\uD835\uDD16",
"sfr;": "\uD835\uDD30",
"sfrown;": "\u2322",
"sharp;": "\u266F",
"SHCHcy;": "\u0429",
"shchcy;": "\u0449",
"SHcy;": "\u0428",
"shcy;": "\u0448",
"ShortDownArrow;": "\u2193",
"ShortLeftArrow;": "\u2190",
"shortmid;": "\u2223",
"shortparallel;": "\u2225",
"ShortRightArrow;": "\u2192",
"ShortUpArrow;": "\u2191",
"shy;": "\u00AD",
"shy": "\u00AD",
"Sigma;": "\u03A3",
"sigma;": "\u03C3",
"sigmaf;": "\u03C2",
"sigmav;": "\u03C2",
"sim;": "\u223C",
"simdot;": "\u2A6A",
"sime;": "\u2243",
"simeq;": "\u2243",
"simg;": "\u2A9E",
"simgE;": "\u2AA0",
"siml;": "\u2A9D",
"simlE;": "\u2A9F",
"simne;": "\u2246",
"simplus;": "\u2A24",
"simrarr;": "\u2972",
"slarr;": "\u2190",
"SmallCircle;": "\u2218",
"smallsetminus;": "\u2216",
"smashp;": "\u2A33",
"smeparsl;": "\u29E4",
"smid;": "\u2223",
"smile;": "\u2323",
"smt;": "\u2AAA",
"smte;": "\u2AAC",
"smtes;": "\u2AAC\uFE00",
"SOFTcy;": "\u042C",
"softcy;": "\u044C",
"sol;": "\u002F",
"solb;": "\u29C4",
"solbar;": "\u233F",
"Sopf;": "\uD835\uDD4A",
"sopf;": "\uD835\uDD64",
"spades;": "\u2660",
"spadesuit;": "\u2660",
"spar;": "\u2225",
"sqcap;": "\u2293",
"sqcaps;": "\u2293\uFE00",
"sqcup;": "\u2294",
"sqcups;": "\u2294\uFE00",
"Sqrt;": "\u221A",
"sqsub;": "\u228F",
"sqsube;": "\u2291",
"sqsubset;": "\u228F",
"sqsubseteq;": "\u2291",
"sqsup;": "\u2290",
"sqsupe;": "\u2292",
"sqsupset;": "\u2290",
"sqsupseteq;": "\u2292",
"squ;": "\u25A1",
"Square;": "\u25A1",
"square;": "\u25A1",
"SquareIntersection;": "\u2293",
"SquareSubset;": "\u228F",
"SquareSubsetEqual;": "\u2291",
"SquareSuperset;": "\u2290",
"SquareSupersetEqual;": "\u2292",
"SquareUnion;": "\u2294",
"squarf;": "\u25AA",
"squf;": "\u25AA",
"srarr;": "\u2192",
"Sscr;": "\uD835\uDCAE",
"sscr;": "\uD835\uDCC8",
"ssetmn;": "\u2216",
"ssmile;": "\u2323",
"sstarf;": "\u22C6",
"Star;": "\u22C6",
"star;": "\u2606",
"starf;": "\u2605",
"straightepsilon;": "\u03F5",
"straightphi;": "\u03D5",
"strns;": "\u00AF",
"Sub;": "\u22D0",
"sub;": "\u2282",
"subdot;": "\u2ABD",
"subE;": "\u2AC5",
"sube;": "\u2286",
"subedot;": "\u2AC3",
"submult;": "\u2AC1",
"subnE;": "\u2ACB",
"subne;": "\u228A",
"subplus;": "\u2ABF",
"subrarr;": "\u2979",
"Subset;": "\u22D0",
"subset;": "\u2282",
"subseteq;": "\u2286",
"subseteqq;": "\u2AC5",
"SubsetEqual;": "\u2286",
"subsetneq;": "\u228A",
"subsetneqq;": "\u2ACB",
"subsim;": "\u2AC7",
"subsub;": "\u2AD5",
"subsup;": "\u2AD3",
"succ;": "\u227B",
"succapprox;": "\u2AB8",
"succcurlyeq;": "\u227D",
"Succeeds;": "\u227B",
"SucceedsEqual;": "\u2AB0",
"SucceedsSlantEqual;": "\u227D",
"SucceedsTilde;": "\u227F",
"succeq;": "\u2AB0",
"succnapprox;": "\u2ABA",
"succneqq;": "\u2AB6",
"succnsim;": "\u22E9",
"succsim;": "\u227F",
"SuchThat;": "\u220B",
"Sum;": "\u2211",
"sum;": "\u2211",
"sung;": "\u266A",
"Sup;": "\u22D1",
"sup;": "\u2283",
"sup1;": "\u00B9",
"sup1": "\u00B9",
"sup2;": "\u00B2",
"sup2": "\u00B2",
"sup3;": "\u00B3",
"sup3": "\u00B3",
"supdot;": "\u2ABE",
"supdsub;": "\u2AD8",
"supE;": "\u2AC6",
"supe;": "\u2287",
"supedot;": "\u2AC4",
"Superset;": "\u2283",
"SupersetEqual;": "\u2287",
"suphsol;": "\u27C9",
"suphsub;": "\u2AD7",
"suplarr;": "\u297B",
"supmult;": "\u2AC2",
"supnE;": "\u2ACC",
"supne;": "\u228B",
"supplus;": "\u2AC0",
"Supset;": "\u22D1",
"supset;": "\u2283",
"supseteq;": "\u2287",
"supseteqq;": "\u2AC6",
"supsetneq;": "\u228B",
"supsetneqq;": "\u2ACC",
"supsim;": "\u2AC8",
"supsub;": "\u2AD4",
"supsup;": "\u2AD6",
"swarhk;": "\u2926",
"swArr;": "\u21D9",
"swarr;": "\u2199",
"swarrow;": "\u2199",
"swnwar;": "\u292A",
"szlig;": "\u00DF",
"szlig": "\u00DF",
"Tab;": "\u0009",
"target;": "\u2316",
"Tau;": "\u03A4",
"tau;": "\u03C4",
"tbrk;": "\u23B4",
"Tcaron;": "\u0164",
"tcaron;": "\u0165",
"Tcedil;": "\u0162",
"tcedil;": "\u0163",
"Tcy;": "\u0422",
"tcy;": "\u0442",
"tdot;": "\u20DB",
"telrec;": "\u2315",
"Tfr;": "\uD835\uDD17",
"tfr;": "\uD835\uDD31",
"there4;": "\u2234",
"Therefore;": "\u2234",
"therefore;": "\u2234",
"Theta;": "\u0398",
"theta;": "\u03B8",
"thetasym;": "\u03D1",
"thetav;": "\u03D1",
"thickapprox;": "\u2248",
"thicksim;": "\u223C",
"ThickSpace;": "\u205F\u200A",
"thinsp;": "\u2009",
"ThinSpace;": "\u2009",
"thkap;": "\u2248",
"thksim;": "\u223C",
"THORN;": "\u00DE",
"THORN": "\u00DE",
"thorn;": "\u00FE",
"thorn": "\u00FE",
"Tilde;": "\u223C",
"tilde;": "\u02DC",
"TildeEqual;": "\u2243",
"TildeFullEqual;": "\u2245",
"TildeTilde;": "\u2248",
"times;": "\u00D7",
"times": "\u00D7",
"timesb;": "\u22A0",
"timesbar;": "\u2A31",
"timesd;": "\u2A30",
"tint;": "\u222D",
"toea;": "\u2928",
"top;": "\u22A4",
"topbot;": "\u2336",
"topcir;": "\u2AF1",
"Topf;": "\uD835\uDD4B",
"topf;": "\uD835\uDD65",
"topfork;": "\u2ADA",
"tosa;": "\u2929",
"tprime;": "\u2034",
"TRADE;": "\u2122",
"trade;": "\u2122",
"triangle;": "\u25B5",
"triangledown;": "\u25BF",
"triangleleft;": "\u25C3",
"trianglelefteq;": "\u22B4",
"triangleq;": "\u225C",
"triangleright;": "\u25B9",
"trianglerighteq;": "\u22B5",
"tridot;": "\u25EC",
"trie;": "\u225C",
"triminus;": "\u2A3A",
"TripleDot;": "\u20DB",
"triplus;": "\u2A39",
"trisb;": "\u29CD",
"tritime;": "\u2A3B",
"trpezium;": "\u23E2",
"Tscr;": "\uD835\uDCAF",
"tscr;": "\uD835\uDCC9",
"TScy;": "\u0426",
"tscy;": "\u0446",
"TSHcy;": "\u040B",
"tshcy;": "\u045B",
"Tstrok;": "\u0166",
"tstrok;": "\u0167",
"twixt;": "\u226C",
"twoheadleftarrow;": "\u219E",
"twoheadrightarrow;": "\u21A0",
"Uacute;": "\u00DA",
"Uacute": "\u00DA",
"uacute;": "\u00FA",
"uacute": "\u00FA",
"Uarr;": "\u219F",
"uArr;": "\u21D1",
"uarr;": "\u2191",
"Uarrocir;": "\u2949",
"Ubrcy;": "\u040E",
"ubrcy;": "\u045E",
"Ubreve;": "\u016C",
"ubreve;": "\u016D",
"Ucirc;": "\u00DB",
"Ucirc": "\u00DB",
"ucirc;": "\u00FB",
"ucirc": "\u00FB",
"Ucy;": "\u0423",
"ucy;": "\u0443",
"udarr;": "\u21C5",
"Udblac;": "\u0170",
"udblac;": "\u0171",
"udhar;": "\u296E",
"ufisht;": "\u297E",
"Ufr;": "\uD835\uDD18",
"ufr;": "\uD835\uDD32",
"Ugrave;": "\u00D9",
"Ugrave": "\u00D9",
"ugrave;": "\u00F9",
"ugrave": "\u00F9",
"uHar;": "\u2963",
"uharl;": "\u21BF",
"uharr;": "\u21BE",
"uhblk;": "\u2580",
"ulcorn;": "\u231C",
"ulcorner;": "\u231C",
"ulcrop;": "\u230F",
"ultri;": "\u25F8",
"Umacr;": "\u016A",
"umacr;": "\u016B",
"uml;": "\u00A8",
"uml": "\u00A8",
"UnderBar;": "\u005F",
"UnderBrace;": "\u23DF",
"UnderBracket;": "\u23B5",
"UnderParenthesis;": "\u23DD",
"Union;": "\u22C3",
"UnionPlus;": "\u228E",
"Uogon;": "\u0172",
"uogon;": "\u0173",
"Uopf;": "\uD835\uDD4C",
"uopf;": "\uD835\uDD66",
"UpArrow;": "\u2191",
"Uparrow;": "\u21D1",
"uparrow;": "\u2191",
"UpArrowBar;": "\u2912",
"UpArrowDownArrow;": "\u21C5",
"UpDownArrow;": "\u2195",
"Updownarrow;": "\u21D5",
"updownarrow;": "\u2195",
"UpEquilibrium;": "\u296E",
"upharpoonleft;": "\u21BF",
"upharpoonright;": "\u21BE",
"uplus;": "\u228E",
"UpperLeftArrow;": "\u2196",
"UpperRightArrow;": "\u2197",
"Upsi;": "\u03D2",
"upsi;": "\u03C5",
"upsih;": "\u03D2",
"Upsilon;": "\u03A5",
"upsilon;": "\u03C5",
"UpTee;": "\u22A5",
"UpTeeArrow;": "\u21A5",
"upuparrows;": "\u21C8",
"urcorn;": "\u231D",
"urcorner;": "\u231D",
"urcrop;": "\u230E",
"Uring;": "\u016E",
"uring;": "\u016F",
"urtri;": "\u25F9",
"Uscr;": "\uD835\uDCB0",
"uscr;": "\uD835\uDCCA",
"utdot;": "\u22F0",
"Utilde;": "\u0168",
"utilde;": "\u0169",
"utri;": "\u25B5",
"utrif;": "\u25B4",
"uuarr;": "\u21C8",
"Uuml;": "\u00DC",
"Uuml": "\u00DC",
"uuml;": "\u00FC",
"uuml": "\u00FC",
"uwangle;": "\u29A7",
"vangrt;": "\u299C",
"varepsilon;": "\u03F5",
"varkappa;": "\u03F0",
"varnothing;": "\u2205",
"varphi;": "\u03D5",
"varpi;": "\u03D6",
"varpropto;": "\u221D",
"vArr;": "\u21D5",
"varr;": "\u2195",
"varrho;": "\u03F1",
"varsigma;": "\u03C2",
"varsubsetneq;": "\u228A\uFE00",
"varsubsetneqq;": "\u2ACB\uFE00",
"varsupsetneq;": "\u228B\uFE00",
"varsupsetneqq;": "\u2ACC\uFE00",
"vartheta;": "\u03D1",
"vartriangleleft;": "\u22B2",
"vartriangleright;": "\u22B3",
"Vbar;": "\u2AEB",
"vBar;": "\u2AE8",
"vBarv;": "\u2AE9",
"Vcy;": "\u0412",
"vcy;": "\u0432",
"VDash;": "\u22AB",
"Vdash;": "\u22A9",
"vDash;": "\u22A8",
"vdash;": "\u22A2",
"Vdashl;": "\u2AE6",
"Vee;": "\u22C1",
"vee;": "\u2228",
"veebar;": "\u22BB",
"veeeq;": "\u225A",
"vellip;": "\u22EE",
"Verbar;": "\u2016",
"verbar;": "\u007C",
"Vert;": "\u2016",
"vert;": "\u007C",
"VerticalBar;": "\u2223",
"VerticalLine;": "\u007C",
"VerticalSeparator;": "\u2758",
"VerticalTilde;": "\u2240",
"VeryThinSpace;": "\u200A",
"Vfr;": "\uD835\uDD19",
"vfr;": "\uD835\uDD33",
"vltri;": "\u22B2",
"vnsub;": "\u2282\u20D2",
"vnsup;": "\u2283\u20D2",
"Vopf;": "\uD835\uDD4D",
"vopf;": "\uD835\uDD67",
"vprop;": "\u221D",
"vrtri;": "\u22B3",
"Vscr;": "\uD835\uDCB1",
"vscr;": "\uD835\uDCCB",
"vsubnE;": "\u2ACB\uFE00",
"vsubne;": "\u228A\uFE00",
"vsupnE;": "\u2ACC\uFE00",
"vsupne;": "\u228B\uFE00",
"Vvdash;": "\u22AA",
"vzigzag;": "\u299A",
"Wcirc;": "\u0174",
"wcirc;": "\u0175",
"wedbar;": "\u2A5F",
"Wedge;": "\u22C0",
"wedge;": "\u2227",
"wedgeq;": "\u2259",
"weierp;": "\u2118",
"Wfr;": "\uD835\uDD1A",
"wfr;": "\uD835\uDD34",
"Wopf;": "\uD835\uDD4E",
"wopf;": "\uD835\uDD68",
"wp;": "\u2118",
"wr;": "\u2240",
"wreath;": "\u2240",
"Wscr;": "\uD835\uDCB2",
"wscr;": "\uD835\uDCCC",
"xcap;": "\u22C2",
"xcirc;": "\u25EF",
"xcup;": "\u22C3",
"xdtri;": "\u25BD",
"Xfr;": "\uD835\uDD1B",
"xfr;": "\uD835\uDD35",
"xhArr;": "\u27FA",
"xharr;": "\u27F7",
"Xi;": "\u039E",
"xi;": "\u03BE",
"xlArr;": "\u27F8",
"xlarr;": "\u27F5",
"xmap;": "\u27FC",
"xnis;": "\u22FB",
"xodot;": "\u2A00",
"Xopf;": "\uD835\uDD4F",
"xopf;": "\uD835\uDD69",
"xoplus;": "\u2A01",
"xotime;": "\u2A02",
"xrArr;": "\u27F9",
"xrarr;": "\u27F6",
"Xscr;": "\uD835\uDCB3",
"xscr;": "\uD835\uDCCD",
"xsqcup;": "\u2A06",
"xuplus;": "\u2A04",
"xutri;": "\u25B3",
"xvee;": "\u22C1",
"xwedge;": "\u22C0",
"Yacute;": "\u00DD",
"Yacute": "\u00DD",
"yacute;": "\u00FD",
"yacute": "\u00FD",
"YAcy;": "\u042F",
"yacy;": "\u044F",
"Ycirc;": "\u0176",
"ycirc;": "\u0177",
"Ycy;": "\u042B",
"ycy;": "\u044B",
"yen;": "\u00A5",
"yen": "\u00A5",
"Yfr;": "\uD835\uDD1C",
"yfr;": "\uD835\uDD36",
"YIcy;": "\u0407",
"yicy;": "\u0457",
"Yopf;": "\uD835\uDD50",
"yopf;": "\uD835\uDD6A",
"Yscr;": "\uD835\uDCB4",
"yscr;": "\uD835\uDCCE",
"YUcy;": "\u042E",
"yucy;": "\u044E",
"Yuml;": "\u0178",
"yuml;": "\u00FF",
"yuml": "\u00FF",
"Zacute;": "\u0179",
"zacute;": "\u017A",
"Zcaron;": "\u017D",
"zcaron;": "\u017E",
"Zcy;": "\u0417",
"zcy;": "\u0437",
"Zdot;": "\u017B",
"zdot;": "\u017C",
"zeetrf;": "\u2128",
"ZeroWidthSpace;": "\u200B",
"Zeta;": "\u0396",
"zeta;": "\u03B6",
"Zfr;": "\u2128",
"zfr;": "\uD835\uDD37",
"ZHcy;": "\u0416",
"zhcy;": "\u0436",
"zigrarr;": "\u21DD",
"Zopf;": "\u2124",
"zopf;": "\uD835\uDD6B",
"Zscr;": "\uD835\uDCB5",
"zscr;": "\uD835\uDCCF",
"zwj;": "\u200D",
"zwnj;": "\u200C"
};
/***/ }),
/* 124 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "startsWith": () => /* binding */ startsWith,
/* harmony export */ "endsWith": () => /* binding */ endsWith,
/* harmony export */ "commonPrefixLength": () => /* binding */ commonPrefixLength,
/* harmony export */ "repeat": () => /* binding */ repeat,
/* harmony export */ "isLetterOrDigit": () => /* binding */ isLetterOrDigit
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function startsWith(haystack, needle) {
if (haystack.length < needle.length) {
return false;
}
for (var i = 0; i < needle.length; i++) {
if (haystack[i] !== needle[i]) {
return false;
}
}
return true;
}
/**
* Determines if haystack ends with needle.
*/
function endsWith(haystack, needle) {
var diff = haystack.length - needle.length;
if (diff > 0) {
return haystack.lastIndexOf(needle) === diff;
}
else if (diff === 0) {
return haystack === needle;
}
else {
return false;
}
}
/**
* @returns the length of the common prefix of the two strings.
*/
function commonPrefixLength(a, b) {
var i;
var len = Math.min(a.length, b.length);
for (i = 0; i < len; i++) {
if (a.charCodeAt(i) !== b.charCodeAt(i)) {
return i;
}
}
return len;
}
function repeat(value, count) {
var s = '';
while (count > 0) {
if ((count & 1) === 1) {
s += value;
}
value += value;
count = count >>> 1;
}
return s;
}
var _a = 'a'.charCodeAt(0);
var _z = 'z'.charCodeAt(0);
var _A = 'A'.charCodeAt(0);
var _Z = 'Z'.charCodeAt(0);
var _0 = '0'.charCodeAt(0);
var _9 = '9'.charCodeAt(0);
function isLetterOrDigit(text, index) {
var c = text.charCodeAt(index);
return (_a <= c && c <= _z) || (_A <= c && c <= _Z) || (_0 <= c && c <= _9);
}
/***/ }),
/* 125 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "isDefined": () => /* binding */ isDefined
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function isDefined(obj) {
return typeof obj !== 'undefined';
}
/***/ }),
/* 126 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "HTMLDataProvider": () => /* binding */ HTMLDataProvider,
/* harmony export */ "generateDocumentation": () => /* binding */ generateDocumentation
/* harmony export */ });
/* harmony import */ var _utils_markup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(127);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var HTMLDataProvider = /** @class */ (function () {
/**
* Currently, unversioned data uses the V1 implementation
* In the future when the provider handles multiple versions of HTML custom data,
* use the latest implementation for unversioned data
*/
function HTMLDataProvider(id, customData) {
var _this = this;
this.id = id;
this._tags = [];
this._tagMap = {};
this._valueSetMap = {};
this._tags = customData.tags || [];
this._globalAttributes = customData.globalAttributes || [];
this._tags.forEach(function (t) {
_this._tagMap[t.name.toLowerCase()] = t;
});
if (customData.valueSets) {
customData.valueSets.forEach(function (vs) {
_this._valueSetMap[vs.name] = vs.values;
});
}
}
HTMLDataProvider.prototype.isApplicable = function () {
return true;
};
HTMLDataProvider.prototype.getId = function () {
return this.id;
};
HTMLDataProvider.prototype.provideTags = function () {
return this._tags;
};
HTMLDataProvider.prototype.provideAttributes = function (tag) {
var attributes = [];
var processAttribute = function (a) {
attributes.push(a);
};
var tagEntry = this._tagMap[tag.toLowerCase()];
if (tagEntry) {
tagEntry.attributes.forEach(processAttribute);
}
this._globalAttributes.forEach(processAttribute);
return attributes;
};
HTMLDataProvider.prototype.provideValues = function (tag, attribute) {
var _this = this;
var values = [];
attribute = attribute.toLowerCase();
var processAttributes = function (attributes) {
attributes.forEach(function (a) {
if (a.name.toLowerCase() === attribute) {
if (a.values) {
a.values.forEach(function (v) {
values.push(v);
});
}
if (a.valueSet) {
if (_this._valueSetMap[a.valueSet]) {
_this._valueSetMap[a.valueSet].forEach(function (v) {
values.push(v);
});
}
}
}
});
};
var tagEntry = this._tagMap[tag.toLowerCase()];
if (!tagEntry) {
return [];
}
processAttributes(tagEntry.attributes);
processAttributes(this._globalAttributes);
return values;
};
return HTMLDataProvider;
}());
/**
* Generate Documentation used in hover/complete
* From `documentation` and `references`
*/
function generateDocumentation(item, settings, doesSupportMarkdown) {
if (settings === void 0) { settings = {}; }
var result = {
kind: doesSupportMarkdown ? 'markdown' : 'plaintext',
value: ''
};
if (item.description && settings.documentation !== false) {
var normalizedDescription = (0,_utils_markup__WEBPACK_IMPORTED_MODULE_0__.normalizeMarkupContent)(item.description);
if (normalizedDescription) {
result.value += normalizedDescription.value;
}
}
if (item.references && item.references.length > 0 && settings.references !== false) {
if (result.value.length) {
result.value += "\n\n";
}
if (doesSupportMarkdown) {
result.value += item.references.map(function (r) {
return "[" + r.name + "](" + r.url + ")";
}).join(' | ');
}
else {
result.value += item.references.map(function (r) {
return r.name + ": " + r.url;
}).join('\n');
}
}
if (result.value === '') {
return undefined;
}
return result;
}
/***/ }),
/* 127 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "normalizeMarkupContent": () => /* binding */ normalizeMarkupContent
/* harmony export */ });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
function normalizeMarkupContent(input) {
if (!input) {
return undefined;
}
if (typeof input === 'string') {
return {
kind: 'markdown',
value: input
};
}
return {
kind: 'markdown',
value: input.value
};
}
/***/ }),
/* 128 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "PathCompletionParticipant": () => /* binding */ PathCompletionParticipant
/* harmony export */ });
/* harmony import */ var _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(117);
/* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(124);
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var PathCompletionParticipant = /** @class */ (function () {
function PathCompletionParticipant(readDirectory) {
this.readDirectory = readDirectory;
this.atributeCompletions = [];
}
PathCompletionParticipant.prototype.onHtmlAttributeValue = function (context) {
if (isPathAttribute(context.tag, context.attribute)) {
this.atributeCompletions.push(context);
}
};
PathCompletionParticipant.prototype.computeCompletions = function (document, documentContext) {
return __awaiter(this, void 0, void 0, function () {
var result, _i, _a, attributeCompletion, fullValue, replaceRange, suggestions, _b, suggestions_1, item;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
result = { items: [], isIncomplete: false };
_i = 0, _a = this.atributeCompletions;
_c.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 5];
attributeCompletion = _a[_i];
fullValue = stripQuotes(document.getText(attributeCompletion.range));
if (!isCompletablePath(fullValue)) return [3 /*break*/, 4];
if (!(fullValue === '.' || fullValue === '..')) return [3 /*break*/, 2];
result.isIncomplete = true;
return [3 /*break*/, 4];
case 2:
replaceRange = pathToReplaceRange(attributeCompletion.value, fullValue, attributeCompletion.range);
return [4 /*yield*/, this.providePathSuggestions(attributeCompletion.value, replaceRange, document, documentContext)];
case 3:
suggestions = _c.sent();
for (_b = 0, suggestions_1 = suggestions; _b < suggestions_1.length; _b++) {
item = suggestions_1[_b];
result.items.push(item);
}
_c.label = 4;
case 4:
_i++;
return [3 /*break*/, 1];
case 5: return [2 /*return*/, result];
}
});
});
};
PathCompletionParticipant.prototype.providePathSuggestions = function (valueBeforeCursor, replaceRange, document, documentContext) {
return __awaiter(this, void 0, void 0, function () {
var valueBeforeLastSlash, parentDir, result, infos, _i, infos_1, _a, name, type, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf('/') + 1);
parentDir = documentContext.resolveReference(valueBeforeLastSlash || '.', document.uri);
if (!parentDir) return [3 /*break*/, 4];
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
result = [];
return [4 /*yield*/, this.readDirectory(parentDir)];
case 2:
infos = _b.sent();
for (_i = 0, infos_1 = infos; _i < infos_1.length; _i++) {
_a = infos_1[_i], name = _a[0], type = _a[1];
// Exclude paths that start with `.`
if (name.charCodeAt(0) !== CharCode_dot) {
result.push(createCompletionItem(name, type === _htmlLanguageTypes__WEBPACK_IMPORTED_MODULE_0__.FileType.Directory, replaceRange));
}
}
return [2 /*return*/, result];
case 3:
e_1 = _b.sent();
return [3 /*break*/, 4];
case 4: return [2 /*return*/, []];
}
});
});
};
return PathCompletionParticipant;
}());
var CharCode_dot = '.'.charCodeAt(0);
function stripQuotes(fullValue) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(fullValue, "'") || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(fullValue, "\"")) {
return fullValue.slice(1, -1);
}
else {
return fullValue;
}
}
function isCompletablePath(value) {
if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(value, 'http') || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(value, 'https') || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_1__.startsWith)(value, '//')) {
return false;
}
return true;
}
function isPathAttribute(tag, attr) {
var a = PATH_TAG_AND_ATTR[tag];
if (a) {
if (typeof a === 'string') {
return a === attr;
}
else {
return a.indexOf(attr) !== -1;
}
}
return false;
}
function pathToReplaceRange(valueBeforeCursor, fullValue, range) {
var replaceRange;
var lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/');
if (lastIndexOfSlash === -1) {
replaceRange = shiftRange(range, 1, -1);
}
else {
// For cases where cursor is in the middle of attribute value, like