X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-html%2Flib%2Fserver.js;h=be282093260dbe8fa88981fab034300372120c3d;hp=437267ba9a5403ae73eafd404824c905a875846f;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-html/lib/server.js b/.config/coc/extensions/node_modules/coc-html/lib/server.js index 437267ba..be282093 100644 --- a/.config/coc/extensions/node_modules/coc-html/lib/server.js +++ b/.config/coc/extensions/node_modules/coc-html/lib/server.js @@ -1,51698 +1,51496 @@ -(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 32); -/******/ }) -/************************************************************************/ -/******/ ([ +(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 */ -/***/ (function(module, exports) { +/***/ ((module) => { -module.exports = require("path"); +module.exports = require("path");; /***/ }), -/* 4 */, -/* 5 */, -/* 6 */, -/* 7 */, -/* 8 */, -/* 9 */, -/* 10 */, -/* 11 */, -/* 12 */, -/* 13 */, -/* 14 */ -/***/ (function(module, exports) { +/* 4 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + -module.exports = require("os"); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +const node_1 = __webpack_require__(5); +__export(__webpack_require__(5)); +__export(__webpack_require__(24)); +function createProtocolConnection(input, output, logger, options) { + return node_1.createMessageConnection(input, output, logger, options); +} +exports.createProtocolConnection = createProtocolConnection; +//# sourceMappingURL=main.js.map /***/ }), -/* 15 */ -/***/ (function(module, exports) { +/* 5 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = require("crypto"); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ----------------------------------------------------------------------------------------- */ -/***/ }), -/* 16 */ -/***/ (function(module, exports) { -module.exports = require("net"); +module.exports = __webpack_require__(6); /***/ }), -/* 17 */, -/* 18 */, -/* 19 */, -/* 20 */, -/* 21 */, -/* 22 */, -/* 23 */, -/* 24 */, -/* 25 */, -/* 26 */, -/* 27 */, -/* 28 */, -/* 29 */, -/* 30 */, -/* 31 */, -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { +/* 6 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/*--------------------------------------------------------------------------------------------- - * 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) { - 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const vscode_languageserver_1 = __webpack_require__(33); -const languageModes_1 = __webpack_require__(71); -const formatting_1 = __webpack_require__(147); -const arrays_1 = __webpack_require__(143); -const documentContext_1 = __webpack_require__(148); -const vscode_uri_1 = __webpack_require__(110); -const runner_1 = __webpack_require__(149); -const htmlFolding_1 = __webpack_require__(150); -const customData_1 = __webpack_require__(151); -const selectionRanges_1 = __webpack_require__(152); -const semanticTokens_1 = __webpack_require__(154); -var TagCloseRequest; -(function (TagCloseRequest) { - TagCloseRequest.type = new vscode_languageserver_1.RequestType('html/tag'); -})(TagCloseRequest || (TagCloseRequest = {})); -var MatchingTagPositionRequest; -(function (MatchingTagPositionRequest) { - MatchingTagPositionRequest.type = new vscode_languageserver_1.RequestType('html/matchingTagPosition'); -})(MatchingTagPositionRequest || (MatchingTagPositionRequest = {})); -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.RequestType('html/semanticTokenLegend'); -})(SemanticTokenLegendRequest || (SemanticTokenLegendRequest = {})); -// Create a connection for the server -const connection = vscode_languageserver_1.createConnection(); -console.log = connection.console.log.bind(connection.console); -console.error = connection.console.error.bind(connection.console); -process.on('unhandledRejection', (e) => { - console.error(runner_1.formatError(`Unhandled exception`, e)); -}); -process.on('uncaughtException', (e) => { - console.error(runner_1.formatError(`Unhandled exception`, e)); -}); -// 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; -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() }); - } - } - const dataPaths = params.initializationOptions.dataPaths; - const providers = customData_1.getDataProviders(dataPaths); - const workspace = { - get settings() { return globalSettings; }, - get folders() { return workspaceFolders; } - }; - languageModes = languageModes_1.getLanguageModes(initializationOptions ? initializationOptions.embeddedLanguages : { css: true, javascript: true }, workspace, params.capabilities, providers); - 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 params.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: params.initializationOptions.provideFormatter === true, - documentLinkProvider: { resolveProvider: false }, - documentSymbolProvider: true, - definitionProvider: true, - signatureHelpProvider: { triggerCharacters: ['('] }, - referencesProvider: true, - colorProvider: {}, - foldingRangeProvider: true, - selectionRangeProvider: true, - renameProvider: 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); - }); +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* -------------------------------------------------------------------------------------------- + * 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__(11); +const path = __webpack_require__(3); +const os = __webpack_require__(21); +const crypto_1 = __webpack_require__(22); +const net_1 = __webpack_require__(23); +__export(__webpack_require__(11)); +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)); } -}); -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' }, { language: 'htmldjango' }]; - formatterRegistration = connection.client.register(vscode_languageserver_1.DocumentRangeFormattingRequest.type, { documentSelector }); - } - } - else if (formatterRegistration) { - formatterRegistration.then(r => r.dispose()); - formatterRegistration = null; +} +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); } } -}); -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]; + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); } } -function triggerValidation(textDocument) { - cleanPendingValidation(textDocument); - pendingValidationRequests[textDocument.uri] = setTimeout(() => { - delete pendingValidationRequests[textDocument.uri]; - validateTextDocument(textDocument); - }, validationDelayMs); +exports.IPCMessageWriter = IPCMessageWriter; +class SocketMessageReader extends api_1.ReadableStreamMessageReader { + constructor(socket, encoding = 'utf-8') { + super(ril_1.default().stream.asReadableStream(socket), encoding); + } } -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; +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(); } - 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 - modes.forEach(mode => { - if (mode.doValidation && isValidationEnabled(mode.getId(), settings)) { - arrays_1.pushAll(diagnostics, mode.doValidation(latestTextDocument, settings)); - } - }); - connection.sendDiagnostics({ uri: latestTextDocument.uri, diagnostics }); - } - } - } - catch (e) { - connection.console.error(runner_1.formatError(`Error while validating ${textDocument.uri}`, e)); - } +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; +function generateRandomPipeName() { + const randomSuffix = crypto_1.randomBytes(21).toString('hex'); + if (process.platform === 'win32') { + return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; + } + else { + // Mac/Unix: use socket file + return path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`); + } +} +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; } + }); + }); }); } -connection.onCompletion((textDocumentPosition, token) => __awaiter(this, void 0, void 0, function* () { - return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { - const document = documents.get(textDocumentPosition.textDocument.uri); - if (!document) { - return null; +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 isMessageReader(value) { + return value.listen !== undefined && value.read === undefined; +} +function isMessageWriter(value) { + return value.write !== undefined && value.end === undefined; +} +function createMessageConnection(input, output, logger, options) { + if (!logger) { + logger = api_1.NullLogger; + } + const reader = isMessageReader(input) ? input : new StreamMessageReader(input); + const writer = isMessageWriter(output) ? output : new StreamMessageWriter(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 disposable_1 = __webpack_require__(9); +const util_1 = __webpack_require__(10); +const DefaultSize = 8192; +const CR = Buffer.from('\r', 'ascii')[0]; +const LF = Buffer.from('\n', 'ascii')[0]; +const CRLF = '\r\n'; +class MessageBuffer { + constructor(encoding = 'utf-8') { + this._encoding = encoding; + this.index = 0; + this.buffer = Buffer.allocUnsafe(DefaultSize); + } + get encoding() { + return this._encoding; + } + append(chunk) { + let toAppend; + if (typeof chunk === 'string') { + toAppend = Buffer.from(chunk, this._encoding); } - const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position); - if (!mode || !mode.doComplete) { - return { isIncomplete: true, items: [] }; + else { + toAppend = chunk; } - 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() } }); + if (this.buffer.length - this.index >= toAppend.length) { + this.buffer.set(toAppend, this.index); } - const settings = yield getDocumentSettings(document, () => doComplete.length > 2); - const result = doComplete(document, textDocumentPosition.position, settings); - return result; - }), null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token); -})); -connection.onCompletionResolve((item, token) => { - return runner_1.runSafe(() => { - 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(() => { - const document = documents.get(textDocumentPosition.textDocument.uri); - if (document) { - const mode = languageModes.getModeAtPosition(document, textDocumentPosition.position); - if (mode && mode.doHover) { - return mode.doHover(document, textDocumentPosition.position); + else { + var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize; + if (this.index === 0) { + this.buffer = Buffer.allocUnsafe(newSize); + this.buffer.set(toAppend); } - } - return null; - }, null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token); -}); -connection.onDocumentHighlight((documentHighlightParams, token) => { - return runner_1.runSafe(() => { - 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); + else { + this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize); } } - return []; - }, [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token); -}); -connection.onDefinition((definitionParams, token) => { - return runner_1.runSafe(() => { - 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); - } + this.index += toAppend.length; + } + tryReadHeaders() { + let current = 0; + while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) { + current++; } - return []; - }, null, `Error while computing definitions for ${definitionParams.textDocument.uri}`, token); -}); -connection.onReferences((referenceParams, token) => { - return runner_1.runSafe(() => { - 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); - } + // No header / body separator found (e.g CRLFCRLF) + if (current + 3 >= this.index) { + return undefined; } - return []; - }, [], `Error while computing references for ${referenceParams.textDocument.uri}`, token); -}); -connection.onSignatureHelp((signatureHelpParms, token) => { - return runner_1.runSafe(() => { - 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); + const result = new Map(); + const headers = this.buffer.toString('ascii', 0, current).split(CRLF); + headers.forEach((header) => { + let index = header.indexOf(':'); + if (index === -1) { + throw new Error('Message header must separate key and value using :'); } + let key = header.substr(0, index); + let value = header.substr(index + 1).trim(); + result.set(key, value); + }); + let nextStart = current + 4; + this.buffer = this.buffer.slice(nextStart); + this.index = this.index - nextStart; + return result; + } + tryReadBody(length) { + if (this.index < length) { + return undefined; } - 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.runSafeAsync(() => __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(() => { - const document = documents.get(documentLinkParam.textDocument.uri); - const links = []; - if (document) { - const documentContext = documentContext_1.getDocumentContext(document.uri, workspaceFolders); - languageModes.getAllModesInDocument(document).forEach(m => { - if (m.findDocumentLinks) { - arrays_1.pushAll(links, m.findDocumentLinks(document, documentContext)); - } - }); - } - return links; - }, [], `Error while document links for ${documentLinkParam.textDocument.uri}`, token); -}); -connection.onDocumentSymbol((documentSymbolParms, token) => { - return runner_1.runSafe(() => { - const document = documents.get(documentSymbolParms.textDocument.uri); - const symbols = []; - if (document) { - languageModes.getAllModesInDocument(document).forEach(m => { - if (m.findDocumentSymbols) { - arrays_1.pushAll(symbols, 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(() => { - const infos = []; - const document = documents.get(params.textDocument.uri); - if (document) { - languageModes.getAllModesInDocument(document).forEach(m => { - if (m.findDocumentColors) { - arrays_1.pushAll(infos, m.findDocumentColors(document)); + const result = Buffer.alloc(length); + this.buffer.copy(result, 0, 0, length); + const nextStart = length; + this.buffer.copy(this.buffer, 0, nextStart); + this.index = this.index - nextStart; + return result; + } + get numberOfBytes() { + return this.index; + } +} +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(); } - }); - } - 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(() => { - 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(() => { - 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); + else { + reject(error); } + }; + if (typeof data === 'string') { + this.stream.write(data, encoding, callback); } - } - return null; - }, null, `Error while computing tag close actions for ${params.textDocument.uri}`, token); -}); -connection.onFoldingRanges((params, token) => { - return runner_1.runSafe(() => { - 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(() => { - 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(() => { - const document = documents.get(params.textDocument.uri); - const position = params.position; - if (document) { - const htmlMode = languageModes.getMode('html'); - if (htmlMode && htmlMode.doRename) { - return htmlMode.doRename(document, position, params.newName); + else { + this.stream.write(data, callback); } - } - return null; - }, null, `Error while computing rename for ${params.textDocument.uri}`, token); -}); -connection.onRequest(MatchingTagPositionRequest.type, (params, token) => { - return runner_1.runSafe(() => { - 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.findMatchingTagPosition) { - return mode.findMatchingTagPosition(document, pos); + }); + } + 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) => { + return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset)); + } + }), + decoder: Object.freeze({ + name: 'application/json', + decode: (buffer, options) => { + if (buffer instanceof Buffer) { + return Promise.resolve(JSON.parse(buffer.toString(options.charset))); } - } - } - return null; - }, null, `Error while computing matching tag position for ${params.textDocument.uri}`, token); -}); -connection.onRequest(MatchingTagPositionRequest.type, (params, token) => { - return runner_1.runSafe(() => { - 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.findMatchingTagPosition) { - return mode.findMatchingTagPosition(document, pos); + else { + return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer))); } } + }) + }), + stream: Object.freeze({ + asReadableStream: (socket) => new ReadableStreamWrapper(socket), + asWritableStream: (socket) => new WritableStreamWrapper(socket) + }), + 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); } - return null; - }, null, `Error while computing matching tag position for ${params.textDocument.uri}`, token); + }) }); -let semanticTokensProvider; -function getSemanticTokenProvider() { - if (!semanticTokensProvider) { - semanticTokensProvider = semanticTokens_1.newSemanticTokenProvider(languageModes); - } - return semanticTokensProvider; +function RIL() { + return _ril; } -connection.onRequest(SemanticTokenRequest.type, (params, token) => { - return runner_1.runSafe(() => { - 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, (_params, token) => { - return runner_1.runSafe(() => { - return getSemanticTokenProvider().legend; - }, null, `Error while computing semantic tokens legend`, token); -}); -// Listen on the connection -connection.listen(); - - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -/// - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -const vscode_languageserver_protocol_1 = __webpack_require__(34); -exports.Event = vscode_languageserver_protocol_1.Event; -const configuration_1 = __webpack_require__(60); -const workspaceFolders_1 = __webpack_require__(62); -const progress_1 = __webpack_require__(63); -const Is = __webpack_require__(61); -const UUID = __webpack_require__(64); -// ------------- Reexport the API surface of the language worker API ---------------------- -__export(__webpack_require__(34)); -const fm = __webpack_require__(65); -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 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. - 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(); -function null2Undefined(value) { - if (value === null) { - return void 0; - } - 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 mananged 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. - * - * @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 === void 0) { - 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 occurences 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 = 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(`Unregistering 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(`Unregistering 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 = workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl)); -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 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 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; -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(arg1, arg2, arg3, arg4) { - let factories; - let input; - let output; - let strategy; - if (arg1 !== void 0 && arg1.__brand === 'features') { - factories = arg1; - arg1 = arg2; - arg2 = arg3; - arg3 = arg4; - } - if (vscode_languageserver_protocol_1.ConnectionStrategy.is(arg1)) { - strategy = arg1; - } - else { - input = arg1; - output = arg2; - strategy = arg3; - } - return _createConnection(input, output, strategy, factories); -} -exports.createConnection = createConnection; -function _createConnection(input, output, strategy, 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 vscode_languageserver_protocol_1.IPCMessageReader(process); - output = new vscode_languageserver_protocol_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 = vscode_languageserver_protocol_1.createServerSocketTransport(port); - input = transport[0]; - output = transport[1]; - } - else if (pipeName) { - let transport = vscode_languageserver_protocol_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', () => { - process.exit(shutdownReceived ? 0 : 1); - }); - inputStream.on('close', () => { - process.exit(shutdownReceived ? 0 : 1); - }); - } - const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl()); - const connection = vscode_languageserver_protocol_1.createProtocolConnection(input, output, logger, strategy); - 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)); - }), - 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) => { - const processId = params.processId; - if (Is.number(processId) && exitTimer === void 0) { - // 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); - } - 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 === void 0 || 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, () => { - 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 (shutdownReceived) { - process.exit(0); - } - else { - process.exit(1); - } - } - }); - connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => { - tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value); - }); - return protocolConnection; -} -// Export the protocol currently in proposed state. -const callHierarchy_proposed_1 = __webpack_require__(69); -const st = __webpack_require__(70); -var ProposedFeatures; -(function (ProposedFeatures) { - ProposedFeatures.all = { - __brand: 'features', - languages: combineLanguagesFeatures(callHierarchy_proposed_1.CallHierarchyFeature, st.SemanticTokensFeature) - }; - ProposedFeatures.SemanticTokensBuilder = st.SemanticTokensBuilder; -})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {})); -//# sourceMappingURL=main.js.map +(function (RIL) { + function install() { + ral_1.default.install(_ril); + } + RIL.install = install; +})(RIL || (RIL = {})); +exports.default = RIL; +//# sourceMappingURL=ril.js.map /***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { +/* 8 */ +/***/ ((__unused_webpack_module, exports) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -const vscode_jsonrpc_1 = __webpack_require__(35); -exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes; -exports.ResponseError = vscode_jsonrpc_1.ResponseError; -exports.CancellationToken = vscode_jsonrpc_1.CancellationToken; -exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource; -exports.Disposable = vscode_jsonrpc_1.Disposable; -exports.Event = vscode_jsonrpc_1.Event; -exports.Emitter = vscode_jsonrpc_1.Emitter; -exports.Trace = vscode_jsonrpc_1.Trace; -exports.TraceFormat = vscode_jsonrpc_1.TraceFormat; -exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification; -exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification; -exports.RequestType = vscode_jsonrpc_1.RequestType; -exports.RequestType0 = vscode_jsonrpc_1.RequestType0; -exports.NotificationType = vscode_jsonrpc_1.NotificationType; -exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0; -exports.MessageReader = vscode_jsonrpc_1.MessageReader; -exports.MessageWriter = vscode_jsonrpc_1.MessageWriter; -exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy; -exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader; -exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter; -exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader; -exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter; -exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport; -exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport; -exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName; -exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport; -exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport; -exports.ProgressType = vscode_jsonrpc_1.ProgressType; -__export(__webpack_require__(45)); -__export(__webpack_require__(46)); -const callHierarchy = __webpack_require__(58); -const st = __webpack_require__(59); -var Proposed; -(function (Proposed) { - let CallHierarchyPrepareRequest; - (function (CallHierarchyPrepareRequest) { - CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method; - CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type; - })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {})); - let CallHierarchyIncomingCallsRequest; - (function (CallHierarchyIncomingCallsRequest) { - CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method; - CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type; - })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {})); - let CallHierarchyOutgoingCallsRequest; - (function (CallHierarchyOutgoingCallsRequest) { - CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method; - CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type; - })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {})); - Proposed.SemanticTokenTypes = st.SemanticTokenTypes; - Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers; - Proposed.SemanticTokens = st.SemanticTokens; - let SemanticTokensRequest; - (function (SemanticTokensRequest) { - SemanticTokensRequest.method = st.SemanticTokensRequest.method; - SemanticTokensRequest.type = st.SemanticTokensRequest.type; - })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {})); - let SemanticTokensEditsRequest; - (function (SemanticTokensEditsRequest) { - SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method; - SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type; - })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {})); - let SemanticTokensRangeRequest; - (function (SemanticTokensRangeRequest) { - SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method; - SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type; - })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {})); -})(Proposed = exports.Proposed || (exports.Proposed = {})); -function createProtocolConnection(reader, writer, logger, strategy) { - return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy); -} -exports.createProtocolConnection = createProtocolConnection; +/* -------------------------------------------------------------------------------------------- + * 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 /***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { +/* 9 */ +/***/ ((__unused_webpack_module, exports) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -/// - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -const Is = __webpack_require__(36); -const messages_1 = __webpack_require__(37); -exports.RequestType = messages_1.RequestType; -exports.RequestType0 = messages_1.RequestType0; -exports.RequestType1 = messages_1.RequestType1; -exports.RequestType2 = messages_1.RequestType2; -exports.RequestType3 = messages_1.RequestType3; -exports.RequestType4 = messages_1.RequestType4; -exports.RequestType5 = messages_1.RequestType5; -exports.RequestType6 = messages_1.RequestType6; -exports.RequestType7 = messages_1.RequestType7; -exports.RequestType8 = messages_1.RequestType8; -exports.RequestType9 = messages_1.RequestType9; -exports.ResponseError = messages_1.ResponseError; -exports.ErrorCodes = messages_1.ErrorCodes; -exports.NotificationType = messages_1.NotificationType; -exports.NotificationType0 = messages_1.NotificationType0; -exports.NotificationType1 = messages_1.NotificationType1; -exports.NotificationType2 = messages_1.NotificationType2; -exports.NotificationType3 = messages_1.NotificationType3; -exports.NotificationType4 = messages_1.NotificationType4; -exports.NotificationType5 = messages_1.NotificationType5; -exports.NotificationType6 = messages_1.NotificationType6; -exports.NotificationType7 = messages_1.NotificationType7; -exports.NotificationType8 = messages_1.NotificationType8; -exports.NotificationType9 = messages_1.NotificationType9; -const messageReader_1 = __webpack_require__(38); -exports.MessageReader = messageReader_1.MessageReader; -exports.StreamMessageReader = messageReader_1.StreamMessageReader; -exports.IPCMessageReader = messageReader_1.IPCMessageReader; -exports.SocketMessageReader = messageReader_1.SocketMessageReader; -const messageWriter_1 = __webpack_require__(40); -exports.MessageWriter = messageWriter_1.MessageWriter; -exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter; -exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter; -exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter; -const events_1 = __webpack_require__(39); -exports.Disposable = events_1.Disposable; -exports.Event = events_1.Event; -exports.Emitter = events_1.Emitter; -const cancellation_1 = __webpack_require__(41); -exports.CancellationTokenSource = cancellation_1.CancellationTokenSource; -exports.CancellationToken = cancellation_1.CancellationToken; -const linkedMap_1 = __webpack_require__(42); -__export(__webpack_require__(43)); -__export(__webpack_require__(44)); -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; -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('$/setTraceNotification'); -})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); -var LogTraceNotification; -(function (LogTraceNotification) { - LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification'); -})(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) { - let candidate = value; - return candidate && Is.func(candidate.cancelUndispatched); - } - ConnectionStrategy.is = is; -})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); -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, strategy) { - let sequenceNumber = 0; - let notificationSquenceNumber = 0; - let unknownResponseSquenceNumber = 0; - const version = '2.0'; - let starRequestHandler = undefined; - let requestHandlers = Object.create(null); - let starNotificationHandler = undefined; - let notificationHandlers = Object.create(null); - let 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; - let errorEmitter = new events_1.Emitter(); - let closeEmitter = new events_1.Emitter(); - let unhandledNotificationEmitter = new events_1.Emitter(); - let unhandledProgressEmitter = new events_1.Emitter(); - let disposeEmitter = new events_1.Emitter(); - function createRequestQueueKey(id) { - 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 = setImmediate(() => { - timer = undefined; - processMessageQueue(); - }); - } - function processMessageQueue() { - if (messageQueue.size === 0) { - return; - } - let 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(); - } - } - let 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) { - let key = createRequestQueueKey(message.params.id); - let toCancel = messageQueue.get(key); - if (messages_1.isRequestMessage(toCancel)) { - let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); - if (response && (response.error !== void 0 || response.result !== void 0)) { - 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) { - let message = { - jsonrpc: version, - id: requestMessage.id - }; - if (resultOrError instanceof messages_1.ResponseError) { - message.error = resultOrError.toJson(); - } - else { - message.result = resultOrError === void 0 ? null : resultOrError; - } - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - function replyError(error, method, startTime) { - let 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 === void 0) { - result = null; - } - let message = { - jsonrpc: version, - id: requestMessage.id, - result: result - }; - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - traceReceivedRequest(requestMessage); - let element = requestHandlers[requestMessage.method]; - let type; - let requestHandler; - if (element) { - type = element.type; - requestHandler = element.handler; - } - let startTime = Date.now(); - if (requestHandler || starRequestHandler) { - let cancellationSource = new cancellation_1.CancellationTokenSource(); - let tokenKey = String(requestMessage.id); - requestTokens[tokenKey] = cancellationSource; - try { - let handlerResult; - if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) { - handlerResult = requestHandler - ? requestHandler(cancellationSource.token) - : starRequestHandler(requestMessage.method, cancellationSource.token); - } - else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) { - handlerResult = requestHandler - ? requestHandler(...requestMessage.params, cancellationSource.token) - : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token); - } - else { - handlerResult = requestHandler - ? requestHandler(requestMessage.params, cancellationSource.token) - : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); - } - let 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 { - let key = String(responseMessage.id); - let responsePromise = responsePromises[key]; - traceReceivedResponse(responseMessage, responsePromise); - if (responsePromise) { - delete responsePromises[key]; - try { - if (responseMessage.error) { - let error = responseMessage.error; - responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); - } - else if (responseMessage.result !== void 0) { - 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) => { - let id = params.id; - let source = requestTokens[String(id)]; - if (source) { - source.cancel(); - } - }; - } - else { - let element = notificationHandlers[message.method]; - if (element) { - notificationHandler = element.handler; - type = element.type; - } - } - if (notificationHandler || starNotificationHandler) { - try { - traceReceivedNotification(message); - if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) { - notificationHandler ? notificationHandler() : starNotificationHandler(message.method); - } - else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) { - notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params); - } - else { - notificationHandler ? notificationHandler(message.params) : 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 - let responseMessage = message; - if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) { - let key = String(responseMessage.id); - let 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 === void 0) { - 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 === void 0) { - data = 'No result returned.\n\n'; - } - } - } - if (responsePromise) { - let 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 === void 0) { - return null; - } - else { - return param; - } - } - function computeMessageParams(type, params) { - let result; - let numberOfParams = type.numberOfParams; - switch (numberOfParams) { - case 0: - result = null; - break; - case 1: - result = undefinedToNull(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; - } - let connection = { - sendNotification: (type, ...params) => { - throwIfClosedOrDisposed(); - let method; - let messageParams; - if (Is.string(type)) { - method = type; - switch (params.length) { - case 0: - messageParams = null; - break; - case 1: - messageParams = params[0]; - break; - default: - messageParams = params; - break; - } - } - else { - method = type.method; - messageParams = computeMessageParams(type, params); - } - let notificationMessage = { - jsonrpc: version, - method: method, - params: messageParams - }; - traceSendingNotification(notificationMessage); - messageWriter.write(notificationMessage); - }, - onNotification: (type, handler) => { - throwIfClosedOrDisposed(); - if (Is.func(type)) { - starNotificationHandler = type; - } - else if (handler) { - if (Is.string(type)) { - notificationHandlers[type] = { type: undefined, handler }; - } - else { - notificationHandlers[type.method] = { type, handler }; - } - } - }, - 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, ...params) => { - throwIfClosedOrDisposed(); - throwIfNotListening(); - let method; - let messageParams; - let token = undefined; - if (Is.string(type)) { - method = type; - switch (params.length) { - case 0: - messageParams = null; - break; - case 1: - // The cancellation token is optional so it can also be undefined. - if (cancellation_1.CancellationToken.is(params[0])) { - messageParams = null; - token = params[0]; - } - else { - messageParams = undefinedToNull(params[0]); - } - break; - default: - const last = params.length - 1; - if (cancellation_1.CancellationToken.is(params[last])) { - token = params[last]; - if (params.length === 2) { - messageParams = undefinedToNull(params[0]); - } - else { - messageParams = params.slice(0, last).map(value => undefinedToNull(value)); - } - } - else { - messageParams = params.map(value => undefinedToNull(value)); - } - break; - } - } - else { - method = type.method; - messageParams = computeMessageParams(type, params); - let numberOfParams = type.numberOfParams; - token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; - } - let id = sequenceNumber++; - let result = new Promise((resolve, reject) => { - let requestMessage = { - jsonrpc: version, - id: id, - method: method, - params: messageParams - }; - let responsePromise = { method: method, timerStart: Date.now(), resolve, reject }; - 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; - } - }); - if (token) { - token.onCancellationRequested(() => { - connection.sendNotification(CancelNotification.type, { id }); - }); - } - return result; - }, - onRequest: (type, handler) => { - throwIfClosedOrDisposed(); - if (Is.func(type)) { - starRequestHandler = type; - } - else if (handler) { - if (Is.string(type)) { - requestHandlers[type] = { type: undefined, handler }; - } - else { - requestHandlers[type.method] = { type, handler }; - } - } - }, - trace: (_value, _tracer, sendNotificationOrTraceOptions) => { - let _sendNotification = false; - let _traceFormat = TraceFormat.Text; - if (sendNotificationOrTraceOptions !== void 0) { - 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, - dispose: () => { - if (isDisposed()) { - return; - } - state = ConnectionState.Disposed; - disposeEmitter.fire(undefined); - let 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 - 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; -} -function isMessageReader(value) { - return value.listen !== void 0 && value.read === void 0; -} -function isMessageWriter(value) { - return value.write !== void 0 && value.end === void 0; -} -function createMessageConnection(input, output, logger, strategy) { - if (!logger) { - logger = exports.NullLogger; - } - let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input); - let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output); - return _createMessageConnection(reader, writer, logger, strategy); -} -exports.createMessageConnection = createMessageConnection; +/*--------------------------------------------------------------------------------------------- + * 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 })); +var Disposable; +(function (Disposable) { + function create(func) { + return { + dispose: func + }; + } + Disposable.create = create; +})(Disposable = exports.Disposable || (exports.Disposable = {})); +//# sourceMappingURL=disposable.js.map /***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -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; +/* 10 */ +/***/ ((module) => { +module.exports = require("util");; /***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { +/* 11 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 is = __webpack_require__(36); -/** - * 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; - ErrorCodes.serverErrorStart = -32099; - ErrorCodes.serverErrorEnd = -32000; - ErrorCodes.ServerNotInitialized = -32002; - ErrorCodes.UnknownErrorCode = -32001; - // Defined by the protocol. - ErrorCodes.RequestCancelled = -32800; - ErrorCodes.ContentModified = -32801; - // Defined by VSCode library. - ErrorCodes.MessageWriteError = 1; - ErrorCodes.MessageReadError = 2; -})(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; -/** - * An abstract implementation of a MessageType. - */ -class AbstractMessageType { - constructor(_method, _numberOfParams) { - this._method = _method; - this._numberOfParams = _numberOfParams; - } - get method() { - return this._method; - } - get numberOfParams() { - return this._numberOfParams; - } -} -exports.AbstractMessageType = AbstractMessageType; -/** - * Classes to type request response pairs - * - * The type parameter RO will be removed in the next major version - * of the JSON RPC library since it is a LSP concept and doesn't - * belong here. For now it is tagged as default never. - */ -class RequestType0 extends AbstractMessageType { - constructor(method) { - super(method, 0); - } -} -exports.RequestType0 = RequestType0; -class RequestType extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.RequestType = RequestType; -class RequestType1 extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.RequestType1 = RequestType1; -class RequestType2 extends AbstractMessageType { - constructor(method) { - super(method, 2); - } -} -exports.RequestType2 = RequestType2; -class RequestType3 extends AbstractMessageType { - constructor(method) { - super(method, 3); - } -} -exports.RequestType3 = RequestType3; -class RequestType4 extends AbstractMessageType { - constructor(method) { - super(method, 4); - } -} -exports.RequestType4 = RequestType4; -class RequestType5 extends AbstractMessageType { - constructor(method) { - super(method, 5); - } -} -exports.RequestType5 = RequestType5; -class RequestType6 extends AbstractMessageType { - constructor(method) { - super(method, 6); - } -} -exports.RequestType6 = RequestType6; -class RequestType7 extends AbstractMessageType { - constructor(method) { - super(method, 7); - } -} -exports.RequestType7 = RequestType7; -class RequestType8 extends AbstractMessageType { - constructor(method) { - super(method, 8); - } -} -exports.RequestType8 = RequestType8; -class RequestType9 extends AbstractMessageType { - constructor(method) { - super(method, 9); - } -} -exports.RequestType9 = RequestType9; -/** - * The type parameter RO will be removed in the next major version - * of the JSON RPC library since it is a LSP concept and doesn't - * belong here. For now it is tagged as default never. - */ -class NotificationType extends AbstractMessageType { - constructor(method) { - super(method, 1); - this._ = undefined; - } -} -exports.NotificationType = NotificationType; -class NotificationType0 extends AbstractMessageType { - constructor(method) { - super(method, 0); - } -} -exports.NotificationType0 = NotificationType0; -class NotificationType1 extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.NotificationType1 = NotificationType1; -class NotificationType2 extends AbstractMessageType { - constructor(method) { - super(method, 2); - } -} -exports.NotificationType2 = NotificationType2; -class NotificationType3 extends AbstractMessageType { - constructor(method) { - super(method, 3); - } -} -exports.NotificationType3 = NotificationType3; -class NotificationType4 extends AbstractMessageType { - constructor(method) { - super(method, 4); - } -} -exports.NotificationType4 = NotificationType4; -class NotificationType5 extends AbstractMessageType { - constructor(method) { - super(method, 5); - } -} -exports.NotificationType5 = NotificationType5; -class NotificationType6 extends AbstractMessageType { - constructor(method) { - super(method, 6); - } -} -exports.NotificationType6 = NotificationType6; -class NotificationType7 extends AbstractMessageType { - constructor(method) { - super(method, 7); - } -} -exports.NotificationType7 = NotificationType7; -class NotificationType8 extends AbstractMessageType { - constructor(method) { - super(method, 8); - } -} -exports.NotificationType8 = NotificationType8; -class NotificationType9 extends AbstractMessageType { - constructor(method) { - super(method, 9); - } -} -exports.NotificationType9 = NotificationType9; -/** - * Tests if the given message is a request message - */ -function isRequestMessage(message) { - let 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) { - let 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) { - let candidate = message; - return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); -} -exports.isResponseMessage = isResponseMessage; +/* -------------------------------------------------------------------------------------------- + * 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 messages_1 = __webpack_require__(12); +exports.RequestType = messages_1.RequestType; +exports.RequestType0 = messages_1.RequestType0; +exports.RequestType1 = messages_1.RequestType1; +exports.RequestType2 = messages_1.RequestType2; +exports.RequestType3 = messages_1.RequestType3; +exports.RequestType4 = messages_1.RequestType4; +exports.RequestType5 = messages_1.RequestType5; +exports.RequestType6 = messages_1.RequestType6; +exports.RequestType7 = messages_1.RequestType7; +exports.RequestType8 = messages_1.RequestType8; +exports.RequestType9 = messages_1.RequestType9; +exports.ResponseError = messages_1.ResponseError; +exports.ErrorCodes = messages_1.ErrorCodes; +exports.NotificationType = messages_1.NotificationType; +exports.NotificationType0 = messages_1.NotificationType0; +exports.NotificationType1 = messages_1.NotificationType1; +exports.NotificationType2 = messages_1.NotificationType2; +exports.NotificationType3 = messages_1.NotificationType3; +exports.NotificationType4 = messages_1.NotificationType4; +exports.NotificationType5 = messages_1.NotificationType5; +exports.NotificationType6 = messages_1.NotificationType6; +exports.NotificationType7 = messages_1.NotificationType7; +exports.NotificationType8 = messages_1.NotificationType8; +exports.NotificationType9 = messages_1.NotificationType9; +const disposable_1 = __webpack_require__(9); +exports.Disposable = disposable_1.Disposable; +const events_1 = __webpack_require__(14); +exports.Event = events_1.Event; +exports.Emitter = events_1.Emitter; +const cancellation_1 = __webpack_require__(15); +exports.CancellationTokenSource = cancellation_1.CancellationTokenSource; +exports.CancellationToken = cancellation_1.CancellationToken; +const messageReader_1 = __webpack_require__(16); +exports.MessageReader = messageReader_1.MessageReader; +exports.AbstractMessageReader = messageReader_1.AbstractMessageReader; +exports.ReadableStreamMessageReader = messageReader_1.ReadableStreamMessageReader; +const messageWriter_1 = __webpack_require__(17); +exports.MessageWriter = messageWriter_1.MessageWriter; +exports.AbstractMessageWriter = messageWriter_1.AbstractMessageWriter; +exports.WriteableStreamMessageWriter = messageWriter_1.WriteableStreamMessageWriter; +const connection_1 = __webpack_require__(19); +exports.ConnectionStrategy = connection_1.ConnectionStrategy; +exports.ConnectionOptions = connection_1.ConnectionOptions; +exports.NullLogger = connection_1.NullLogger; +exports.createMessageConnection = connection_1.createMessageConnection; +exports.ProgressType = connection_1.ProgressType; +exports.Trace = connection_1.Trace; +exports.TraceFormat = connection_1.TraceFormat; +exports.SetTraceNotification = connection_1.SetTraceNotification; +exports.LogTraceNotification = connection_1.LogTraceNotification; +exports.ConnectionErrors = connection_1.ConnectionErrors; +exports.ConnectionError = connection_1.ConnectionError; +exports.CancellationReceiverStrategy = connection_1.CancellationReceiverStrategy; +exports.CancellationSenderStrategy = connection_1.CancellationSenderStrategy; +exports.CancellationStrategy = connection_1.CancellationStrategy; +const ral_1 = __webpack_require__(8); +exports.RAL = ral_1.default; +//# sourceMappingURL=api.js.map /***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { +/* 12 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 events_1 = __webpack_require__(39); -const Is = __webpack_require__(36); -let DefaultSize = 8192; -let CR = Buffer.from('\r', 'ascii')[0]; -let LF = Buffer.from('\n', 'ascii')[0]; -let CRLF = '\r\n'; -class MessageBuffer { - constructor(encoding = 'utf8') { - this.encoding = encoding; - this.index = 0; - this.buffer = Buffer.allocUnsafe(DefaultSize); - } - append(chunk) { - var toAppend = chunk; - if (typeof (chunk) === 'string') { - var str = chunk; - var bufferLen = Buffer.byteLength(str, this.encoding); - toAppend = Buffer.allocUnsafe(bufferLen); - toAppend.write(str, 0, bufferLen, this.encoding); - } - if (this.buffer.length - this.index >= toAppend.length) { - toAppend.copy(this.buffer, this.index, 0, toAppend.length); - } - else { - var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize; - if (this.index === 0) { - this.buffer = Buffer.allocUnsafe(newSize); - toAppend.copy(this.buffer, 0, 0, toAppend.length); - } - else { - this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize); - } - } - this.index += toAppend.length; - } - tryReadHeaders() { - let result = undefined; - let current = 0; - while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) { - current++; - } - // No header / body separator found (e.g CRLFCRLF) - if (current + 3 >= this.index) { - return result; - } - result = Object.create(null); - let headers = this.buffer.toString('ascii', 0, current).split(CRLF); - headers.forEach((header) => { - let index = header.indexOf(':'); - if (index === -1) { - throw new Error('Message header must separate key and value using :'); - } - let key = header.substr(0, index); - let value = header.substr(index + 1).trim(); - result[key] = value; - }); - let nextStart = current + 4; - this.buffer = this.buffer.slice(nextStart); - this.index = this.index - nextStart; - return result; - } - tryReadContent(length) { - if (this.index < length) { - return null; - } - let result = this.buffer.toString(this.encoding, 0, length); - let nextStart = length; - this.buffer.copy(this.buffer, 0, nextStart); - this.index = this.index - nextStart; - return result; - } - get numberOfBytes() { - return this.index; - } -} -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; -class StreamMessageReader extends AbstractMessageReader { - constructor(readable, encoding = 'utf8') { - super(); - this.readable = readable; - this.buffer = new MessageBuffer(encoding); - this._partialMessageTimeout = 10000; - } - 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; - this.readable.on('data', (data) => { - this.onData(data); - }); - this.readable.on('error', (error) => this.fireError(error)); - this.readable.on('close', () => this.fireClose()); - } - onData(data) { - this.buffer.append(data); - while (true) { - if (this.nextMessageLength === -1) { - let headers = this.buffer.tryReadHeaders(); - if (!headers) { - return; - } - let contentLength = headers['Content-Length']; - if (!contentLength) { - throw new Error('Header must provide a Content-Length property.'); - } - let length = parseInt(contentLength); - if (isNaN(length)) { - throw new Error('Content-Length value must be a number.'); - } - this.nextMessageLength = length; - // Take the encoding form the header. For compatibility - // treat both utf-8 and utf8 as node utf8 - } - var msg = this.buffer.tryReadContent(this.nextMessageLength); - if (msg === null) { - /** We haven't received the full message yet. */ - this.setPartialMessageTimer(); - return; - } - this.clearPartialMessageTimer(); - this.nextMessageLength = -1; - this.messageToken++; - var json = JSON.parse(msg); - this.callback(json); - } - } - clearPartialMessageTimer() { - if (this.partialMessageTimer) { - clearTimeout(this.partialMessageTimer); - this.partialMessageTimer = undefined; - } - } - setPartialMessageTimer() { - this.clearPartialMessageTimer(); - if (this._partialMessageTimeout <= 0) { - return; - } - this.partialMessageTimer = 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.StreamMessageReader = StreamMessageReader; -class IPCMessageReader extends 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); - } -} -exports.IPCMessageReader = IPCMessageReader; -class SocketMessageReader extends StreamMessageReader { - constructor(socket, encoding = 'utf-8') { - super(socket, encoding); - } -} -exports.SocketMessageReader = SocketMessageReader; +/* -------------------------------------------------------------------------------------------- + * 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 is = __webpack_require__(13); +/** + * 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; + ErrorCodes.serverErrorStart = -32099; + ErrorCodes.serverErrorEnd = -32000; + ErrorCodes.ServerNotInitialized = -32002; + ErrorCodes.UnknownErrorCode = -32001; + // Defined by the protocol. + ErrorCodes.RequestCancelled = -32800; + ErrorCodes.ContentModified = -32801; + // Defined by VSCode library. + ErrorCodes.MessageWriteError = 1; + ErrorCodes.MessageReadError = 2; +})(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; +/** + * An abstract implementation of a MessageType. + */ +class AbstractMessageSignature { + constructor(_method, _numberOfParams) { + this._method = _method; + this._numberOfParams = _numberOfParams; + } + get method() { + return this._method; + } + get numberOfParams() { + return this._numberOfParams; + } +} +exports.AbstractMessageSignature = AbstractMessageSignature; +/** + * Classes to type request response pairs + * + * The type parameter RO will be removed in the next major version + * of the JSON RPC library since it is a LSP concept and doesn't + * belong here. For now it is tagged as default never. + */ +class RequestType0 extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } +} +exports.RequestType0 = RequestType0; +class RequestType extends AbstractMessageSignature { + constructor(method) { + super(method, 1); + } +} +exports.RequestType = RequestType; +class RequestType1 extends AbstractMessageSignature { + constructor(method) { + super(method, 1); + } +} +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; +/** + * The type parameter RO will be removed in the next major version + * of the JSON RPC library since it is a LSP concept and doesn't + * belong here. For now it is tagged as default never. + */ +class NotificationType extends AbstractMessageSignature { + constructor(method) { + super(method, 1); + this._ = undefined; + } +} +exports.NotificationType = NotificationType; +class NotificationType0 extends AbstractMessageSignature { + constructor(method) { + super(method, 0); + } +} +exports.NotificationType0 = NotificationType0; +class NotificationType1 extends AbstractMessageSignature { + constructor(method) { + super(method, 1); + } +} +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 /***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { +/* 13 */ +/***/ ((__unused_webpack_module, exports) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -var Disposable; -(function (Disposable) { - function create(func) { - return { - dispose: func - }; - } - Disposable.create = create; -})(Disposable = exports.Disposable || (exports.Disposable = {})); -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; - } - var foundCallbackWithDifferentContext = false; - for (var 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 []; - } - var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); - for (var 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 - 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); - let result; - result = { - dispose: () => { - 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 () { }; +/* -------------------------------------------------------------------------------------------- + * 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 })); +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 /***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { +/* 14 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 events_1 = __webpack_require__(39); -const Is = __webpack_require__(36); -let ContentLength = 'Content-Length: '; -let 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; -class StreamMessageWriter extends AbstractMessageWriter { - constructor(writable, encoding = 'utf8') { - super(); - this.writable = writable; - this.encoding = encoding; - this.errorCount = 0; - this.writable.on('error', (error) => this.fireError(error)); - this.writable.on('close', () => this.fireClose()); - } - write(msg) { - let json = JSON.stringify(msg); - let contentLength = Buffer.byteLength(json, this.encoding); - let headers = [ - ContentLength, contentLength.toString(), CRLF, - CRLF - ]; - try { - // Header must be written in ASCII encoding - this.writable.write(headers.join(''), 'ascii'); - // Now write the content. This can be written in any encoding - this.writable.write(json, this.encoding); - this.errorCount = 0; - } - catch (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - } -} -exports.StreamMessageWriter = StreamMessageWriter; -class IPCMessageWriter extends AbstractMessageWriter { - constructor(process) { - super(); - this.process = process; - this.errorCount = 0; - this.queue = []; - this.sending = false; - let eventEmitter = this.process; - eventEmitter.on('error', (error) => this.fireError(error)); - eventEmitter.on('close', () => this.fireClose); - } - write(msg) { - if (!this.sending && this.queue.length === 0) { - // See https://github.com/nodejs/node/issues/7657 - this.doWriteMessage(msg); - } - else { - this.queue.push(msg); - } - } - doWriteMessage(msg) { - try { - if (this.process.send) { - this.sending = true; - this.process.send(msg, undefined, undefined, (error) => { - this.sending = false; - if (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - else { - this.errorCount = 0; - } - if (this.queue.length > 0) { - this.doWriteMessage(this.queue.shift()); - } - }); - } - } - catch (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - } -} -exports.IPCMessageWriter = IPCMessageWriter; -class SocketMessageWriter extends AbstractMessageWriter { - constructor(socket, encoding = 'utf8') { - super(); - this.socket = socket; - this.queue = []; - this.sending = false; - this.encoding = encoding; - this.errorCount = 0; - this.socket.on('error', (error) => this.fireError(error)); - this.socket.on('close', () => this.fireClose()); - } - dispose() { - super.dispose(); - this.socket.destroy(); - } - write(msg) { - if (!this.sending && this.queue.length === 0) { - // See https://github.com/nodejs/node/issues/7657 - this.doWriteMessage(msg); - } - else { - this.queue.push(msg); - } - } - doWriteMessage(msg) { - let json = JSON.stringify(msg); - let contentLength = Buffer.byteLength(json, this.encoding); - let headers = [ - ContentLength, contentLength.toString(), CRLF, - CRLF - ]; - try { - // Header must be written in ASCII encoding - this.sending = true; - this.socket.write(headers.join(''), 'ascii', (error) => { - if (error) { - this.handleError(error, msg); - } - try { - // Now write the content. This can be written in any encoding - this.socket.write(json, this.encoding, (error) => { - this.sending = false; - if (error) { - this.handleError(error, msg); - } - else { - this.errorCount = 0; - } - if (this.queue.length > 0) { - this.doWriteMessage(this.queue.shift()); - } - }); - } - catch (error) { - this.handleError(error, msg); - } - }); - } - catch (error) { - this.handleError(error, msg); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } -} -exports.SocketMessageWriter = SocketMessageWriter; +/* -------------------------------------------------------------------------------------------- + * 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); +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 /***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { +/* 15 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/*--------------------------------------------------------------------------------------------- - * 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 events_1 = __webpack_require__(39); -const Is = __webpack_require__(36); -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) { - let 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) { - let handle = setTimeout(callback.bind(context), 0); - return { dispose() { 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; +/*--------------------------------------------------------------------------------------------- + * 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 Is = __webpack_require__(13); +const events_1 = __webpack_require__(14); +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 /***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/*--------------------------------------------------------------------------------------------- - * 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 }); -var Touch; -(function (Touch) { - Touch.None = 0; - Touch.First = 1; - Touch.Last = 2; -})(Touch = exports.Touch || (exports.Touch = {})); -class LinkedMap { - constructor() { - this._map = new Map(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - } - clear() { - this._map.clear(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - } - isEmpty() { - return !this._head && !this._tail; - } - get size() { - return this._size; - } - has(key) { - return this._map.has(key); - } - get(key) { - const item = this._map.get(key); - if (!item) { - return undefined; - } - 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++; - } - } - delete(key) { - const item = this._map.get(key); - if (!item) { - return false; - } - this._map.delete(key); - this.removeItem(item); - this._size--; - return true; - } - 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) { - let current = this._head; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } - else { - callbackfn(current.value, current.key, this); - } - current = current.next; - } - } - forEachReverse(callbackfn, thisArg) { - let current = this._tail; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } - else { - callbackfn(current.value, current.key, this); - } - current = current.previous; - } - } - values() { - let result = []; - let current = this._head; - while (current) { - result.push(current.value); - current = current.next; - } - return result; - } - keys() { - let result = []; - let current = this._head; - while (current) { - result.push(current.key); - current = current.next; - } - return result; - } - /* JSON RPC run on es5 which has no Symbol.iterator - public keys(): IterableIterator { - let current = this._head; - let iterator: IterableIterator = { - [Symbol.iterator]() { - return iterator; - }, - next():IteratorResult { - if (current) { - let result = { value: current.key, done: false }; - current = current.next; - return result; - } else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - - public values(): IterableIterator { - let current = this._head; - let iterator: IterableIterator = { - [Symbol.iterator]() { - return iterator; - }, - next():IteratorResult { - if (current) { - let result = { value: current.value, done: false }; - current = current.next; - return result; - } else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - */ - 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; - } - 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; - } - removeItem(item) { - if (item === this._head && item === this._tail) { - this._head = undefined; - this._tail = undefined; - } - else if (item === this._head) { - this._head = item.next; - } - else if (item === this._tail) { - 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; - } - } - 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; - } - 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; - } - } -} -exports.LinkedMap = LinkedMap; - +/* 16 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 path_1 = __webpack_require__(3); -const os_1 = __webpack_require__(14); -const crypto_1 = __webpack_require__(15); -const net_1 = __webpack_require__(16); -const messageReader_1 = __webpack_require__(38); -const messageWriter_1 = __webpack_require__(40); -function generateRandomPipeName() { - const randomSuffix = crypto_1.randomBytes(21).toString('hex'); - if (process.platform === 'win32') { - return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; - } - else { - // Mac/Unix: use socket file - return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`); - } -} -exports.generateRandomPipeName = generateRandomPipeName; -function createClientPipeTransport(pipeName, encoding = 'utf-8') { - let connectResolve; - let connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - let server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.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 messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerPipeTransport = createServerPipeTransport; - - -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 net_1 = __webpack_require__(16); -const messageReader_1 = __webpack_require__(38); -const messageWriter_1 = __webpack_require__(40); -function createClientSocketTransport(port, encoding = 'utf-8') { - let connectResolve; - let connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - let server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.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 messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerSocketTransport = createServerSocketTransport; - - -/***/ }), -/* 45 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; }); -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ - -/** - * 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) { - return { line: line, character: character }; - } - Position.create = create; - /** - * Checks whether the given liternal conforms to the [Position](#Position) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(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.number(one) && Is.number(two) && Is.number(three) && Is.number(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.number(candidate.red) - && Is.number(candidate.green) - && Is.number(candidate.blue) - && Is.number(candidate.alpha); - } - 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.number(candidate.startLine) && Is.number(candidate.startLine) - && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter)) - && (Is.undefined(candidate.endCharacter) || Is.number(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 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 candidate = value; - return Is.defined(candidate) - && Range.is(candidate.range) - && Is.string(candidate.message) - && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) - && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) - && (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 = {})); -/** - * 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) - && VersionedTextDocumentIdentifier.is(candidate.textDocument) - && Array.isArray(candidate.edits); - } - TextDocumentEdit.is = is; -})(TextDocumentEdit || (TextDocumentEdit = {})); -var CreateFile; -(function (CreateFile) { - function create(uri, options) { - var result = { - kind: 'create', - uri: uri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - return result; - } - CreateFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && - (candidate.options === void 0 || - ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists)))); - } - CreateFile.is = is; -})(CreateFile || (CreateFile = {})); -var RenameFile; -(function (RenameFile) { - function create(oldUri, newUri, options) { - var result = { - kind: 'rename', - oldUri: oldUri, - newUri: newUri - }; - if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { - result.options = options; - } - 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 === void 0 || - ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists)))); - } - RenameFile.is = is; -})(RenameFile || (RenameFile = {})); -var DeleteFile; -(function (DeleteFile) { - function create(uri, options) { - var result = { - kind: 'delete', - uri: uri - }; - if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { - result.options = options; - } - return result; - } - DeleteFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && - (candidate.options === void 0 || - ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists)))); - } - DeleteFile.is = is; -})(DeleteFile || (DeleteFile = {})); -var WorkspaceEdit; -(function (WorkspaceEdit) { - function is(value) { - var candidate = value; - return candidate && - (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && - (candidate.documentChanges === void 0 || 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) { - this.edits = edits; - } - TextEditChangeImpl.prototype.insert = function (position, newText) { - this.edits.push(TextEdit.insert(position, newText)); - }; - TextEditChangeImpl.prototype.replace = function (range, newText) { - this.edits.push(TextEdit.replace(range, newText)); - }; - TextEditChangeImpl.prototype.delete = function (range) { - this.edits.push(TextEdit.del(range)); - }; - 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); - }; - return TextEditChangeImpl; -}()); -/** - * 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) { - this._workspaceEdit = workspaceEdit; - if (workspaceEdit.documentChanges) { - workspaceEdit.documentChanges.forEach(function (change) { - if (TextDocumentEdit.is(change)) { - var textEditChange = new TextEditChangeImpl(change.edits); - _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; - }); - } - } - } - Object.defineProperty(WorkspaceChange.prototype, "edit", { - /** - * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal - * use to be returned from a workspace edit operation like rename. - */ - get: function () { - return this._workspaceEdit; - }, - enumerable: true, - configurable: true - }); - WorkspaceChange.prototype.getTextEditChange = function (key) { - if (VersionedTextDocumentIdentifier.is(key)) { - if (!this._workspaceEdit) { - this._workspaceEdit = { - documentChanges: [] - }; - } - if (!this._workspaceEdit.documentChanges) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var textDocument = key; - 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._textEditChanges[textDocument.uri] = result; - } - return result; - } - else { - if (!this._workspaceEdit) { - this._workspaceEdit = { - changes: Object.create(null) - }; - } - if (!this._workspaceEdit.changes) { - 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.createFile = function (uri, options) { - this.checkDocumentChanges(); - this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options)); - }; - WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) { - this.checkDocumentChanges(); - this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options)); - }; - WorkspaceChange.prototype.deleteFile = function (uri, options) { - this.checkDocumentChanges(); - this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options)); - }; - WorkspaceChange.prototype.checkDocumentChanges = function () { - if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) { - throw new Error('Workspace edit is not configured for document changes.'); - } - }; - 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) && (candidate.version === null || Is.number(candidate.version)); - } - VersionedTextDocumentIdentifier.is = is; -})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); -/** - * 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.number(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://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md - */ - 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 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 === void 0 || 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.15 - */ -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 !== void 0) { - 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 === void 0 || Is.string(candidate.detail)) && - (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && - (candidate.children === void 0 || Array.isArray(candidate.children)); - } - 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 !== void 0 && 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 === void 0 || Is.typedArray(candidate.only, Is.string)); - } - CodeActionContext.is = is; -})(CodeActionContext || (CodeActionContext = {})); -var CodeAction; -(function (CodeAction) { - function create(title, commandOrEdit, kind) { - var result = { title: title }; - if (Command.is(commandOrEdit)) { - result.command = commandOrEdit; - } - else { - result.edit = commandOrEdit; - } - if (kind !== void 0) { - result.kind = kind; - } - return result; - } - CodeAction.create = create; - function is(value) { - var candidate = value; - return candidate && Is.string(candidate.title) && - (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && - (candidate.kind === void 0 || Is.string(candidate.kind)) && - (candidate.edit !== void 0 || candidate.command !== void 0) && - (candidate.command === void 0 || Command.is(candidate.command)) && - (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && - (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); - } - 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.number(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.number(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 = {})); -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 (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: true, - 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 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 = {})); - - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 Is = __webpack_require__(47); -const vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -const protocol_implementation_1 = __webpack_require__(49); -exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest; -const protocol_typeDefinition_1 = __webpack_require__(50); -exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest; -const protocol_workspaceFolders_1 = __webpack_require__(51); -exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest; -exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; -const protocol_configuration_1 = __webpack_require__(52); -exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest; -const protocol_colorProvider_1 = __webpack_require__(53); -exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest; -exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest; -const protocol_foldingRange_1 = __webpack_require__(54); -exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest; -const protocol_declaration_1 = __webpack_require__(55); -exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest; -const protocol_selectionRange_1 = __webpack_require__(56); -exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest; -const protocol_progress_1 = __webpack_require__(57); -exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress; -exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest; -exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification; -// @ts-ignore: to avoid inlining LocatioLink 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 startegy 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 intialized 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 = {})); -/** - * 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); - /** @deprecated Use CompletionRequest.type */ - CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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); - /** @deprecated Use DefinitionRequest.type */ - DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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); - /** @deprecated Use ReferencesRequest.type */ - ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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); - /** @deprecated Use DocumentHighlightRequest.type */ - DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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); - /** @deprecated Use DocumentSymbolRequest.type */ - DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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); - /** @deprecated Use CodeActionRequest.type */ - CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {})); -/** - * 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); - /** @deprecated Use WorkspaceSymbolRequest.type */ - WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); -/** - * A request to provide code lens for the given text document. - */ -var CodeLensRequest; -(function (CodeLensRequest) { - CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens'); - /** @deprecated Use CodeLensRequest.type */ - CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {})); -/** - * A request to resolve a command for a given code lens. - */ -var CodeLensResolveRequest; -(function (CodeLensResolveRequest) { - CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve'); -})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); -/** - * A request to provide document links - */ -var DocumentLinkRequest; -(function (DocumentLinkRequest) { - DocumentLinkRequest.method = 'textDocument/documentLink'; - DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method); - /** @deprecated Use DocumentLinkRequest.type */ - DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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.type = new messages_1.ProtocolRequestType('documentLink/resolve'); -})(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 = {})); -/** - * 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. - */ -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 = {})); - - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -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; - - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -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); - } -} -exports.ProtocolRequestType = ProtocolRequestType; -class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType { - constructor(method) { - super(method); - } -} -exports.ProtocolNotificationType = ProtocolNotificationType; -class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 { - constructor(method) { - super(method); - } -} -exports.ProtocolNotificationType0 = ProtocolNotificationType0; - - -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -// @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); - /** @deprecated Use ImplementationRequest.type */ - ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {})); - - -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -// @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); - /** @deprecated Use TypeDefinitionRequest.type */ - TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); - - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 messages_1 = __webpack_require__(48); -/** - * 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 = {})); - - -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 messages_1 = __webpack_require__(48); -/** - * 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 = {})); - - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -/** - * 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); - /** @deprecated Use DocumentColorRequest.type */ - DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(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 = {})); - - -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/*--------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -/** - * 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); - /** @deprecated Use FoldingRangeRequest.type */ - FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); - - -/***/ }), -/* 55 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -// @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); - /** @deprecated Use DeclarationRequest.type */ - DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {})); - - -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/*--------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -/** - * 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); - /** @deprecated Use SelectionRangeRequest.type */ - SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType(); -})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); - - -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_jsonrpc_1 = __webpack_require__(35); -const messages_1 = __webpack_require__(48); -var WorkDoneProgress; -(function (WorkDoneProgress) { - WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType(); -})(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 = {})); - - -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -const messages_1 = __webpack_require__(48); -/** - * 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 - Proposed state - */ -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 - Proposed state - */ -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 - Proposed state - */ -var CallHierarchyOutgoingCallsRequest; -(function (CallHierarchyOutgoingCallsRequest) { - CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls'; - CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method); -})(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {})); - - -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 messages_1 = __webpack_require__(48); -/** - * 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 - Proposed state - */ -var SemanticTokenTypes; -(function (SemanticTokenTypes) { - SemanticTokenTypes["comment"] = "comment"; - SemanticTokenTypes["keyword"] = "keyword"; - SemanticTokenTypes["string"] = "string"; - SemanticTokenTypes["number"] = "number"; - SemanticTokenTypes["regexp"] = "regexp"; - SemanticTokenTypes["operator"] = "operator"; - SemanticTokenTypes["namespace"] = "namespace"; - SemanticTokenTypes["type"] = "type"; - SemanticTokenTypes["struct"] = "struct"; - SemanticTokenTypes["class"] = "class"; - SemanticTokenTypes["interface"] = "interface"; - SemanticTokenTypes["enum"] = "enum"; - SemanticTokenTypes["typeParameter"] = "typeParameter"; - SemanticTokenTypes["function"] = "function"; - SemanticTokenTypes["member"] = "member"; - SemanticTokenTypes["property"] = "property"; - SemanticTokenTypes["marco"] = "marco"; - SemanticTokenTypes["variable"] = "variable"; - SemanticTokenTypes["parameter"] = "parameter"; - SemanticTokenTypes["label"] = "label"; -})(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 - Proposed state - */ -var SemanticTokenModifiers; -(function (SemanticTokenModifiers) { - SemanticTokenModifiers["documentation"] = "documentation"; - SemanticTokenModifiers["declaration"] = "declaration"; - SemanticTokenModifiers["definition"] = "definition"; - SemanticTokenModifiers["reference"] = "reference"; - SemanticTokenModifiers["static"] = "static"; - SemanticTokenModifiers["abstract"] = "abstract"; - SemanticTokenModifiers["deprecated"] = "deprected"; - SemanticTokenModifiers["async"] = "async"; - SemanticTokenModifiers["volatile"] = "volatile"; - SemanticTokenModifiers["final"] = "final"; -})(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {})); -/** - * @since 3.16.0 - Proposed state - */ -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 = {})); -/** - * @since 3.16.0 - Proposed state - */ -var SemanticTokensRequest; -(function (SemanticTokensRequest) { - SemanticTokensRequest.method = 'textDocument/semanticTokens'; - SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method); -})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); -/** - * @since 3.16.0 - Proposed state - */ -var SemanticTokensEditsRequest; -(function (SemanticTokensEditsRequest) { - SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits'; - SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method); -})(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {})); -/** - * @since 3.16.0 - Proposed state - */ -var SemanticTokensRangeRequest; -(function (SemanticTokensRangeRequest) { - SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range'; - SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method); -})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); - - -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_languageserver_protocol_1 = __webpack_require__(34); -const Is = __webpack_require__(61); -exports.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]; - }); - } - }; -}; -//# sourceMappingURL=configuration.js.map - -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -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 - -/***/ }), -/* 62 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_languageserver_protocol_1 = __webpack_require__(34); -exports.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; - } - }; -}; -//# sourceMappingURL=workspaceFolders.js.map - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_languageserver_protocol_1 = __webpack_require__(34); -const uuid_1 = __webpack_require__(64); -class WorkDoneProgressImpl { - constructor(_connection, _token) { - this._connection = _connection; - this._token = _token; - WorkDoneProgressImpl.Instances.set(this._token, this); - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - 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() { - WorkDoneProgressImpl.Instances.delete(this._token); - this._source.dispose(); - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' }); - } - cancel() { - this._source.cancel(); - } -} -WorkDoneProgressImpl.Instances = new Map(); -class NullProgress { - constructor() { - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - begin() { - } - report() { - } - done() { - } -} -function attachWorkDone(connection, params) { - if (params === undefined || params.workDoneToken === undefined) { - return new NullProgress(); - } - const token = params.workDoneToken; - delete params.workDoneToken; - return new WorkDoneProgressImpl(connection, token); -} -exports.attachWorkDone = attachWorkDone; -exports.ProgressFeature = (Base) => { - return class extends Base { - 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 = WorkDoneProgressImpl.Instances.get(params.token); - if (progress !== undefined) { - progress.cancel(); - } - }); - } - } - attachWorkDoneProgress(token) { - if (token === undefined) { - return new NullProgress(); - } - else { - return new WorkDoneProgressImpl(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 WorkDoneProgressImpl(this.connection, token); - return result; - }); - } - else { - return Promise.resolve(new NullProgress()); - } - } - }; -}; -var ResultProgress; -(function (ResultProgress) { - ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType(); -})(ResultProgress || (ResultProgress = {})); -class ResultProgressImpl { - 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 ResultProgressImpl(connection, token); -} -exports.attachPartialResult = attachPartialResult; -//# sourceMappingURL=progress.js.map - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/*--------------------------------------------------------------------------------------------- - * 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 }); -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 - -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(__filename) {/* -------------------------------------------------------------------------------------------- - * 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 url = __webpack_require__(66); -const path = __webpack_require__(3); -const fs = __webpack_require__(67); -const child_process_1 = __webpack_require__(68); -/** - * @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 -/* WEBPACK VAR INJECTION */}.call(this, "/index.js")) - -/***/ }), -/* 66 */ -/***/ (function(module, exports) { - -module.exports = require("url"); - -/***/ }), -/* 67 */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), -/* 68 */ -/***/ (function(module, exports) { - -module.exports = require("child_process"); - -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_languageserver_protocol_1 = __webpack_require__(34); -exports.CallHierarchyFeature = (Base) => { - return class extends Base { - get callHierarchy() { - return { - onPrepare: (handler) => { - this.connection.onRequest(vscode_languageserver_protocol_1.Proposed.CallHierarchyPrepareRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); - }); - }, - onIncomingCalls: (handler) => { - const type = vscode_languageserver_protocol_1.Proposed.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.Proposed.CallHierarchyOutgoingCallsRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; -}; -//# sourceMappingURL=callHierarchy.proposed.js.map - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 vscode_languageserver_protocol_1 = __webpack_require__(34); -exports.SemanticTokensFeature = (Base) => { - return class extends Base { - get semanticTokens() { - return { - on: (handler) => { - const type = vscode_languageserver_protocol_1.Proposed.SemanticTokensRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onEdits: (handler) => { - const type = vscode_languageserver_protocol_1.Proposed.SemanticTokensEditsRequest.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.Proposed.SemanticTokensRangeRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; -}; -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=sematicTokens.proposed.js.map - -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -const vscode_css_languageservice_1 = __webpack_require__(72); -const vscode_html_languageservice_1 = __webpack_require__(111); -const languageModelCache_1 = __webpack_require__(137); -const cssMode_1 = __webpack_require__(138); -const embeddedSupport_1 = __webpack_require__(139); -const htmlMode_1 = __webpack_require__(140); -const javascriptMode_1 = __webpack_require__(144); -__export(__webpack_require__(111)); -function getLanguageModes(supportedLanguages, workspace, clientCapabilities, customDataProviders) { - const htmlLanguageService = vscode_html_languageservice_1.getLanguageService({ customDataProviders, clientCapabilities }); - const cssLanguageService = vscode_css_languageservice_1.getCSSLanguageService({ clientCapabilities }); - 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'); - modes['typescript'] = javascriptMode_1.getJavaScriptMode(documentRegions, 'typescript'); +/* -------------------------------------------------------------------------------------------- + * 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 Is = __webpack_require__(13); +const events_1 = __webpack_require__(14); +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'}`); + } } - return { - getModeAtPosition(document, position) { - let languageId = documentRegions.get(document).getLanguageAtPosition(position); - if (languageId) { - return modes[languageId]; +} +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); } - 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); + if (options.contentDecoders !== undefined) { + for (const decoder of options.contentDecoders) { + contentDecoders.set(decoder.name, decoder); } } - return result; - }, - getAllModes() { - let result = []; - for (let languageId in modes) { - let mode = modes[languageId]; - if (mode) { - result.push(mode); + 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); } } - return result; - }, - getMode(languageId) { - return modes[languageId]; - }, - onDocumentRemoved(document) { - modelCaches.forEach(mc => mc.onDocumentRemoved(document)); - for (let mode in modes) { - modes[mode].onDocumentRemoved(document); + } + 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; } - }, - dispose() { - modelCaches.forEach(mc => mc.dispose()); - modelCaches = []; - for (let mode in modes) { - modes[mode].dispose(); + const body = this.buffer.tryReadBody(this.nextMessageLength); + if (body === undefined) { + /** We haven't received the full message yet. */ + this.setPartialMessageTimer(); + return; } - modes = {}; + 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.getLanguageModes = getLanguageModes; - +exports.ReadableStreamMessageReader = ReadableStreamMessageReader; +//# sourceMappingURL=messageReader.js.map /***/ }), -/* 72 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCSSLanguageService", function() { return getCSSLanguageService; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSCSSLanguageService", function() { return getSCSSLanguageService; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLESSLanguageService", function() { return getLESSLanguageService; }); -/* harmony import */ var _parser_cssParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(73); -/* harmony import */ var _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(86); -/* harmony import */ var _services_cssHover__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(92); -/* harmony import */ var _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(94); -/* harmony import */ var _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95); -/* harmony import */ var _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(97); -/* harmony import */ var _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(100); -/* harmony import */ var _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(103); -/* harmony import */ var _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(104); -/* harmony import */ var _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(106); -/* harmony import */ var _services_cssFolding__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(107); -/* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(78); -/* harmony import */ var _services_cssSelectionRange__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(108); -/* harmony import */ var _services_scssNavigation__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(109); -/* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(90); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["TextDocument"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Position"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Range"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Location"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["LocationLink"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Color"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["ColorInformation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["ColorPresentation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["FoldingRangeKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["FoldingRange"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DiagnosticRelatedInformation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DiagnosticSeverity"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DiagnosticTag"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Diagnostic"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Command"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["TextEdit"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["TextDocumentEdit"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CreateFile"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["RenameFile"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DeleteFile"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["WorkspaceEdit"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["WorkspaceChange"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["TextDocumentIdentifier"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["VersionedTextDocumentIdentifier"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["TextDocumentItem"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["MarkupKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["MarkupContent"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CompletionItemKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["InsertTextFormat"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CompletionItemTag"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CompletionItem"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CompletionList"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["MarkedString"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["Hover"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["ParameterInformation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["SignatureInformation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DocumentHighlightKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DocumentHighlight"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["SymbolKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["SymbolTag"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["SymbolInformation"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DocumentSymbol"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CodeActionKind"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CodeActionContext"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CodeAction"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["CodeLens"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["FormattingOptions"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["DocumentLink"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["SelectionRange"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["EOL"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ClientCapabilities", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["ClientCapabilities"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FileType", function() { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_14__["FileType"]; }); - -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - - - - - - - - - - - - - - +/* 17 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -function createFacade(parser, completion, hover, navigation, codeActions, validation) { - return { - configure: function (settings) { - validation.configure(settings); - completion.configure(settings); - }, - doValidation: validation.doValidation.bind(validation), - parseStylesheet: parser.parseStylesheet.bind(parser), - doComplete: completion.doComplete.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), - findColorSymbols: function (d, s) { return navigation.findDocumentColors(d, s).map(function (s) { return s.range; }); }, - 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_12__["getSelectionRanges"] - }; -} -function handleCustomData(options) { - if (options && options.customDataProviders) { - _languageFacts_facts__WEBPACK_IMPORTED_MODULE_11__["cssDataManager"].addDataProviders(options.customDataProviders); +/* -------------------------------------------------------------------------------------------- + * 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 Is = __webpack_require__(13); +const semaphore_1 = __webpack_require__(18); +const events_1 = __webpack_require__(14); +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'}`); + } } } -function getCSSLanguageService(options) { - handleCustomData(options); - return createFacade(new _parser_cssParser__WEBPACK_IMPORTED_MODULE_0__["Parser"](), new _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__["CSSCompletion"](null, options && options.clientCapabilities), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__["CSSHover"](options && options.clientCapabilities), new _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__["CSSNavigation"](), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__["CSSCodeActions"](), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__["CSSValidation"]()); -} -function getSCSSLanguageService(options) { - handleCustomData(options); - return createFacade(new _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__["SCSSParser"](), new _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__["SCSSCompletion"](options && options.clientCapabilities), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__["CSSHover"](options && options.clientCapabilities), new _services_scssNavigation__WEBPACK_IMPORTED_MODULE_13__["SCSSNavigation"](options && options.fileSystemProvider), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__["CSSCodeActions"](), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__["CSSValidation"]()); -} -function getLESSLanguageService(options) { - handleCustomData(options); - return createFacade(new _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__["LESSParser"](), new _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__["LESSCompletion"](options && options.clientCapabilities), new _services_cssHover__WEBPACK_IMPORTED_MODULE_2__["CSSHover"](options && options.clientCapabilities), new _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__["CSSNavigation"](), new _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__["CSSCodeActions"](), new _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__["CSSValidation"]()); +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) { + 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; + }); + } + doWrite(msg, headers, data) { + return this.writeSemaphore.lock(async () => { + try { + await this.writable.write(headers.join(''), 'ascii'); + return this.writable.write(data); + } + catch (error) { + this.handleError(error, msg); + } + }); + } + handleError(error, msg) { + this.errorCount++; + this.fireError(error, msg, this.errorCount); + } } - +exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; +//# sourceMappingURL=messageWriter.js.map /***/ }), -/* 73 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; }); -/* harmony import */ var _cssScanner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(74); -/* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75); -/* harmony import */ var _cssErrors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(76); -/* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(78); -/* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(81); -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - - - +/* 18 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/// -/// 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; +/* -------------------------------------------------------------------------------------------- + * 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); +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(); + }); } - 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.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; + get active() { + return this._active; + } + runNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; } - 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; - } - } + ral_1.default().timer.setImmediate(() => this.doRunNext()); + } + doRunNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; } - return false; - }; - Parser.prototype.accept = function (type) { - if (type === this.token.type) { - this.consumeToken(); - return true; + const next = this._waiting.shift(); + this._active++; + if (this._active > this._capacity) { + throw new Error(`To many thunks active`); } - return false; - }; - Parser.prototype.acceptIdent = function (text) { - if (this.peekIdent(text)) { - this.consumeToken(); - return true; + 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(); + } } - return false; - }; - Parser.prototype.acceptKeyword = function (text) { - if (this.peekKeyword(text)) { - this.consumeToken(); - return true; + catch (err) { + this._active--; + next.reject(err); + this.runNext(); } - return false; - }; - Parser.prototype.acceptDelim = function (text) { - if (this.peekDelim(text)) { - this.consumeToken(); - return true; + } +} +exports.Semaphore = Semaphore; +//# sourceMappingURL=semaphore.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 })); +const ral_1 = __webpack_require__(8); +const Is = __webpack_require__(13); +const messages_1 = __webpack_require__(12); +const linkedMap_1 = __webpack_require__(20); +const events_1 = __webpack_require__(14); +const cancellation_1 = __webpack_require__(15); +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; +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; } - return false; - }; - Parser.prototype.acceptRegexp = function (regEx) { - if (regEx.test(this.token.text)) { - this.consumeToken(); - return true; + else { + return TraceFormat.Text; + } + } + TraceFormat.fromString = fromString; +})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); +var SetTraceNotification; +(function (SetTraceNotification) { + SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification'); +})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); +var LogTraceNotification; +(function (LogTraceNotification) { + LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification'); +})(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(); } - 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; + }); + 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) { + return 'req-' + id.toString(); + } + function createResponseQueueKey(id) { + if (id === null) { + return 'res-unknown-' + (++unknownResponseSquenceNumber).toString(); } - 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 { + 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 (resyncStopTokens && resyncStopTokens.indexOf(this.token.type) !== -1) { - return true; + else if (messages_1.isNotificationMessage(message)) { + handleNotification(message); + } + else if (messages_1.isResponseMessage(message)) { + handleResponse(message); } else { - if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].EOF) { - return false; - } - this.token = this.scanner.scan(); + handleInvalidMessage(message); } } - }; - 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 - } + finally { + triggerMessageQueue(); } - 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; + } + 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); } - if (resyncTokens || resyncStopTokens) { - this.resync(resyncTokens, resyncStopTokens); + finally { + triggerMessageQueue(); } }; - 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; + 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 { - node.textProvider = function (offset, length) { return input.substr(offset, length); }; + message.result = resultOrError === undefined ? null : resultOrError; } + traceSendingResponse(message, method, startTime); + messageWriter.write(message); } - 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); - } + 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 (requestMessage.params === undefined || (type !== undefined && type.numberOfParams === 0)) { + handlerResult = requestHandler + ? requestHandler(cancellationSource.token) + : starRequestHandler(requestMessage.method, cancellationSource.token); } - 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; + else if (Is.array(requestMessage.params) && (type === undefined || type.numberOfParams > 1)) { + handlerResult = requestHandler + ? requestHandler(...requestMessage.params, cancellationSource.token) + : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token); + } + else { + handlerResult = requestHandler + ? requestHandler(requestMessage.params, cancellationSource.token) + : 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); } - } 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); + 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 { - this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].RuleOrSelectorExpected); + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } - 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); - } + else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); } - 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; + } + function handleResponse(responseMessage) { + if (isDisposed()) { + // See handle request. + return; } - 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); + 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.`); } } - return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); - }; - Parser.prototype._parseRuleSetDeclaration = function () { - // https://www.w3.org/TR/css-syntax-3/#consume-a-list-of-declarations0 - return this._parseAtApply() - || this._tryParseCustomPropertyDeclaration() - || this._parseDeclaration() - || this._parseUnknownAtRule(); - }; - /** - * 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); + 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.`); + } + } + } } - 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: - return false; - case _cssNodes__WEBPACK_IMPORTED_MODULE_1__["NodeType"].ExtendsReference: - case _cssNodes__WEBPACK_IMPORTED_MODULE_1__["NodeType"].MixinContent: - 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(); + } + function handleNotification(message) { + if (isDisposed()) { + // See handle request. + return; } - 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; + 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(); + } + }; } - var decl = parseDeclaration(); - while (node.addChild(decl)) { - if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].CurlyR)) { - break; + else { + const element = notificationHandlers[message.method]; + if (element) { + notificationHandler = element.handler; + type = element.type; } - 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]); + } + if (notificationHandler || starNotificationHandler) { + try { + traceReceivedNotification(message); + if (message.params === undefined || (type !== undefined && type.numberOfParams === 0)) { + notificationHandler ? notificationHandler() : starNotificationHandler(message.method); + } + else if (Is.array(message.params) && (type === undefined || type.numberOfParams > 1)) { + notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params); + } + else { + notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params); + } } - // 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; + 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.`); + } } - while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon)) { - // accept empty statements + } + 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.')); } - 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]); + } + function traceSendingRequest(message) { + if (trace === Trace.Off || !tracer) { + return; } - 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]); + 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); } - 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()); + else { + logLSPMessage('send-request', message); } - while (node.addChild(this._parseSimpleSelector())) { - hasContent = true; - node.addChild(this._parseCombinator()); // optional + } + function traceSendingNotification(message) { + if (trace === Trace.Off || !tracer) { + return; } - return hasContent ? this.finish(node) : null; - }; - Parser.prototype._parseDeclaration = function (resyncStopTokens) { - var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__["Declaration"]); - if (!node.setProperty(this._parseProperty())) { - return null; + 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); } - if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].Colon)) { - var stopTokens = resyncStopTokens ? __spreadArrays(resyncStopTokens, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon]) : [_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon]; - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].ColonExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].Colon], stopTokens); + else { + logLSPMessage('send-notification', message); } - if (this.prevToken) { - node.colonPosition = this.prevToken.offset; + } + function traceSendingResponse(message, method, startTime) { + if (trace === Trace.Off || !tracer) { + return; } - if (!node.setValue(this._parseExpr())) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].PropertyValueExpected); + 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); } - 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 + else { + logLSPMessage('send-response', message); } - return this.finish(node); - }; - Parser.prototype._tryParseCustomPropertyDeclaration = function () { - if (!this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].Ident, /^--/)) { - return null; + } + function traceReceivedRequest(message) { + if (trace === Trace.Off || !tracer) { + return; } - var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__["CustomPropertyDeclaration"]); - if (!node.setProperty(this._parseProperty())) { - return null; + 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); } - 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]); + else { + logLSPMessage('receive-request', message); } - if (this.prevToken) { - node.colonPosition = this.prevToken.offset; + } + function traceReceivedNotification(message) { + if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { + return; } - 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); + 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'; } } - this.restoreAtMark(mark); + tracer.log(`Received notification '${message.method}'.`, data); } - // try tp parse as expression - var expression = this._parseExpr(); - if (expression && !expression.isErroneous(true)) { - this._parsePrio(); - if (this.peek(_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); - } + else { + logLSPMessage('receive-notification', message); } - this.restoreAtMark(mark); - node.addChild(this._parseCustomPropertyValue()); - node.addChild(this._parsePrio()); - if (Object(_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); + } + function traceReceivedResponse(message, responsePromise) { + if (trace === Trace.Off || !tracer) { + return; } - 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 () { - var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__["Node"]); - var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 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: - // 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 (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; - 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; + 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 (parensDepth > 0) { - error = _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].RightParenthesisExpected; + else if (message.error === undefined) { + data = 'No result returned.\n\n'; } - return this.finish(node, error); + } } - this.consumeToken(); - } - return this.finish(node); - }; - Parser.prototype._tryToParseDeclaration = function () { - 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(); - } - 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 (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); } } - 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; + else { + logLSPMessage('receive-response', message); } - 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); + } + function logLSPMessage(type, message) { + if (!tracer || trace === Trace.Off) { + return; } - if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon)) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].SemiColonExpected); + const lspMessage = { + isLSPMessage: true, + type, + message, + timestamp: Date.now() + }; + tracer.log(lspMessage); + } + function throwIfClosedOrDisposed() { + if (isClosed()) { + throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); } - return this.finish(node); - }; - Parser.prototype._parseImport = function () { - if (!this.peekKeyword('@import')) { - return null; + if (isDisposed()) { + throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); } - 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); + } + function throwIfListening() { + if (isListening()) { + throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); } - if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].EOF)) { - node.setMedialist(this._parseMediaQueryList()); + } + function throwIfNotListening() { + if (!isListening()) { + throw new Error('Call listen() first.'); } - 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')) { + } + function undefinedToNull(param) { + if (param === undefined) { 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]); - } + else { + return param; } - if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].SemiColon)) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].SemiColonExpected); + } + function computeMessageParams(type, params) { + let result; + const numberOfParams = type.numberOfParams; + switch (numberOfParams) { + case 0: + result = null; + break; + case 1: + result = undefinedToNull(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 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 result; + } + const connection = { + sendNotification: (type, ...params) => { + throwIfClosedOrDisposed(); + let method; + let messageParams; + if (Is.string(type)) { + method = type; + switch (params.length) { + case 0: + messageParams = null; + break; + case 1: + messageParams = params[0]; + break; + default: + messageParams = params; + break; } } - } - 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; + else { + method = type.method; + messageParams = computeMessageParams(type, params); } - if (!node.addChild(this._tryToParseDeclaration())) { - if (!this._parseSupportsCondition()) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].ConditionExpected); - } + const notificationMessage = { + jsonrpc: version, + method: method, + params: messageParams + }; + traceSendingNotification(notificationMessage); + messageWriter.write(notificationMessage); + }, + onNotification: (type, handler) => { + throwIfClosedOrDisposed(); + if (Is.func(type)) { + starNotificationHandler = type; } - 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], []); + else if (handler) { + if (Is.string(type)) { + notificationHandlers[type] = { type: undefined, handler }; + } + else { + notificationHandlers[type.method] = { type, handler }; + } } - if (this.prevToken) { - node.rParent = this.prevToken.offset; + }, + onProgress: (_type, token, handler) => { + if (progressHandlers.has(token)) { + throw new Error(`Progress handler for token ${token} already registered`); } - 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(); + progressHandlers.set(token, handler); + return { + dispose: () => { + progressHandlers.delete(token); + } + }; + }, + sendProgress: (_type, token, value) => { + connection.sendNotification(ProgressNotification.type, { token, value }); + }, + onUnhandledProgress: unhandledProgressEmitter.event, + sendRequest: (type, ...params) => { + throwIfClosedOrDisposed(); + throwIfNotListening(); + let method; + let messageParams; + let token = undefined; + if (Is.string(type)) { + method = type; + switch (params.length) { + case 0: + messageParams = null; + break; + case 1: + // The cancellation token is optional so it can also be undefined. + if (cancellation_1.CancellationToken.is(params[0])) { + messageParams = null; + token = params[0]; + } + else { + messageParams = undefinedToNull(params[0]); + } + break; + default: + const last = params.length - 1; + if (cancellation_1.CancellationToken.is(params[last])) { + token = params[last]; + if (params.length === 2) { + messageParams = undefinedToNull(params[0]); + } + else { + messageParams = params.slice(0, last).map(value => undefinedToNull(value)); + } + } + else { + messageParams = params.map(value => undefinedToNull(value)); + } + break; } - return this.finish(node); } else { - this.restoreAtMark(pos); + 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); + }); } - } - 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); + 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(); + if (Is.func(type)) { + starRequestHandler = type; } - } - 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 + else if (handler) { + if (Is.string(type)) { + requestHandlers[type] = { type: undefined, handler }; + } + else { + requestHandlers[type.method] = { type, handler }; + } } - if (!node.addChild(this._parseIdent())) { - return null; + }, + 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; + } } - 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; + trace = _value; + traceFormat = _traceFormat; + if (trace === Trace.Off) { + tracer = undefined; } - 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; + else { + tracer = _tracer; } - if (!node.addChild(this._parseMediaFeatureName())) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].IdentifierExpected, [], resyncStopToken); + if (_sendNotification && !isClosed() && !isDisposed()) { + connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); } - 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); - } + }, + onError: errorEmitter.event, + onClose: closeEmitter.event, + onUnhandledNotification: unhandledNotificationEmitter.event, + onDispose: disposeEmitter.event, + dispose: () => { + if (isDisposed()) { + return; } - if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].ParenthesisR)) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].RightParenthesisExpected, [], resyncStopToken); + 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(); } - 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); - } + 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'); } - 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; + connection.onNotification(LogTraceNotification.type, (params) => { + if (trace === Trace.Off || !tracer) { + return; } - 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]); + 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); } - 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; + else { + unhandledProgressEmitter.fire(params); } - 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 connection; +} +exports.createMessageConnection = createMessageConnection; +//# sourceMappingURL=connection.js.map + +/***/ }), +/* 20 */ +/***/ ((__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 })); +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; } - 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; + if (touch !== Touch.None) { + this.touch(item, touch); } - 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; + 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); + } } - 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++; + else { + item = { key, value, next: undefined, previous: undefined }; + switch (touch) { + case Touch.None: + this.addItemLast(item); break; - case _cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].ParenthesisR: - parensDepth--; - if (parensDepth < 0) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].LeftParenthesisExpected); - } + case Touch.First: + this.addItemFirst(item); break; - case _cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].BracketL: - bracketsDepth++; + case Touch.Last: + this.addItemLast(item); break; - case _cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].BracketR: - bracketsDepth--; - if (bracketsDepth < 0) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].LeftSquareBracketExpected); - } + default: + this.addItemLast(item); break; } - this.consumeToken(); + this._map.set(key, item); + this._size++; } - 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 this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return undefined; } - 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); + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return undefined; } - else { - return null; + if (!this._head || !this._tail) { + throw new Error('Invalid list'); } - }; - Parser.prototype._parseUnaryOperator = function () { - if (!this.peekDelim('+') && !this.peekDelim('-')) { - return null; + 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; } - 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); + } + 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 }; } - 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); + }; + 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 }; + } } - this.restoreAtMark(mark); + }; + 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; } - 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++; + if (newSize === 0) { + this.clear(); + return; } - while ((c === 0 || !this.hasWhitespace()) && node.addChild(this._parseSimpleSelectorBody())) { - c++; + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; } - 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; + this._head = current; + this._size = currentSize; + if (current) { + current.previous = undefined; } - 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); - } + 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 { - this.consumeToken(); // TokenType.Hash + item.next = this._head; + this._head.previous = item; } - return this.finish(node); - }; - Parser.prototype._parseClass = function () { - // class: '.' IDENT ; - if (!this.peekDelim('.')) { - return null; + this._head = item; + this._state++; + } + addItemLast(item) { + // First time Insert + if (!this._head && !this._tail) { + this._head = item; } - 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); + else if (!this._tail) { + throw new Error('Invalid list'); } - 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; + else { + item.previous = this._tail; + this._tail.next = item; } - 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 + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = undefined; + this._tail = undefined; } - if (!this.acceptDelim('|')) { - this.restoreAtMark(pos); - return null; + 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; } - 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; + 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; } - 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); + else { + const next = item.next; + const previous = item.previous; + if (!next || !previous) { + throw new Error('Invalid list'); + } + next.previous = previous; + previous.next = next; } - if (node.setOperator(this._parseOperator())) { - node.setValue(this._parseBinaryExpr()); - this.acceptIdent('i'); // case insensitive matching + item.next = undefined; + item.previous = undefined; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error('Invalid list'); } - if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].BracketR)) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].RightSquareBracketExpected); + if ((touch !== Touch.First && touch !== Touch.Last)) { + return; } - 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); - } + if (touch === Touch.First) { + if (item === this._head) { + return; } - 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; + 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++; } - // optional, support :: - if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].Colon) && this.hasWhitespace()) { - this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].IdentifierExpected); + } + 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); } - if (!node.addChild(this._parseIdent())) { - this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].IdentifierExpected); + } +} +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)); } - return node; - }; - Parser.prototype._tryParsePrio = function () { - var mark = this.mark(); - var prio = this._parsePrio(); - if (prio) { - return prio; + } +} +exports.LRUCache = LRUCache; +//# sourceMappingURL=linkedMap.js.map + +/***/ }), +/* 21 */ +/***/ ((module) => { + +module.exports = require("os");; + +/***/ }), +/* 22 */ +/***/ ((module) => { + +module.exports = require("crypto");; + +/***/ }), +/* 23 */ +/***/ ((module) => { + +module.exports = require("net");; + +/***/ }), +/* 24 */ +/***/ ((__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. + * ------------------------------------------------------------------------------------------ */ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +__export(__webpack_require__(6)); +__export(__webpack_require__(25)); +__export(__webpack_require__(26)); +__export(__webpack_require__(27)); +var connection_1 = __webpack_require__(39); +exports.createProtocolConnection = connection_1.createProtocolConnection; +const st = __webpack_require__(40); +var Proposed; +(function (Proposed) { + Proposed.SemanticTokenTypes = st.SemanticTokenTypes; + Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers; + Proposed.SemanticTokens = st.SemanticTokens; + let SemanticTokensRequest; + (function (SemanticTokensRequest) { + SemanticTokensRequest.method = st.SemanticTokensRequest.method; + SemanticTokensRequest.type = st.SemanticTokensRequest.type; + })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {})); + let SemanticTokensEditsRequest; + (function (SemanticTokensEditsRequest) { + SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method; + SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type; + })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {})); + let SemanticTokensRangeRequest; + (function (SemanticTokensRangeRequest) { + SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method; + SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type; + })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {})); +})(Proposed = exports.Proposed || (exports.Proposed = {})); +//# sourceMappingURL=api.js.map + +/***/ }), +/* 25 */ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* 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 */ "DiagnosticCode": () => /* binding */ DiagnosticCode, +/* harmony export */ "Diagnostic": () => /* binding */ Diagnostic, +/* harmony export */ "Command": () => /* binding */ Command, +/* harmony export */ "TextEdit": () => /* binding */ TextEdit, +/* 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 */ "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 */ "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. + * ------------------------------------------------------------------------------------------ */ + +/** + * 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) { + return { line: line, character: character }; + } + Position.create = create; + /** + * Checks whether the given liternal conforms to the [Position](#Position) interface. + */ + function is(value) { + var candidate = value; + return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(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.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) { + return { start: Position.create(one, two), end: Position.create(three, four) }; } - this.restoreAtMark(mark); - return null; - }; - Parser.prototype._parsePrio = function () { - if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].Exclamation)) { - return null; + else if (Position.is(one) && Position.is(two)) { + return { start: one, end: two }; } - 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); + else { + throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); } - 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; + } + 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.number(candidate.red) + && Is.number(candidate.green) + && Is.number(candidate.blue) + && Is.number(candidate.alpha); + } + 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; } - 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; - } + if (Is.defined(endCharacter)) { + result.endCharacter = endCharacter; } - 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; + if (Is.defined(kind)) { + result.kind = kind; } - var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__["NodeType"].GridLine); - this.consumeToken(); - while (node.addChild(this._parseIdent())) { - // repeat + return result; + } + FoldingRange.create = create; + /** + * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface. + */ + function is(value) { + var candidate = value; + return Is.number(candidate.startLine) && Is.number(candidate.startLine) + && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter)) + && (Is.undefined(candidate.endCharacter) || Is.number(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 DiagnosticCode namespace provides functions to deal with complex diagnostic codes. + * + * @since 3.16.0 - Proposed state + */ +var DiagnosticCode; +(function (DiagnosticCode) { + /** + * Checks whether the given liternal conforms to the [DiagnosticCode](#DiagnosticCode) interface. + */ + function is(value) { + var candidate = value; + return candidate !== undefined && candidate !== null && (Is.number(candidate.value) || Is.string(candidate.value)) && Is.string(candidate.target); + } + DiagnosticCode.is = is; +})(DiagnosticCode || (DiagnosticCode = {})); +/** + * 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 (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].BracketR)) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].RightSquareBracketExpected); + if (Is.defined(code)) { + result.code = code; } - 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 (Is.defined(source)) { + result.source = source; } - if (!node.setOperator(preparsedOper || this._parseOperator())) { - return this.finish(node); + if (Is.defined(relatedInformation)) { + result.relatedInformation = relatedInformation; } - if (!node.setRight(this._parseTerm())) { - return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__["ParseError"].TermExpected); + return result; + } + Diagnostic.create = create; + /** + * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface. + */ + function is(value) { + var candidate = value; + return Is.defined(candidate) + && Range.is(candidate.range) + && Is.string(candidate.message) + && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) + && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) + && (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]; } - // things needed for multiple binary expressions - node = this.finish(node); - var operator = this._parseOperator(); - if (operator) { - node = this._parseBinaryExpr(node, operator); + var result = { title: title, command: command }; + if (Is.defined(args) && args.length > 0) { + result.arguments = args; } - 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._parseURILiteral()) || // url before function - node.setExpression(this._parseFunction()) || // function before ident - node.setExpression(this._parseIdent()) || - node.setExpression(this._parseStringLiteral()) || - node.setExpression(this._parseNumeric()) || - node.setExpression(this._parseHexColor()) || - node.setExpression(this._parseOperation()) || - node.setExpression(this._parseNamedLine())) { - return this.finish(node); + 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 = {})); +/** + * 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) + && VersionedTextDocumentIdentifier.is(candidate.textDocument) + && Array.isArray(candidate.edits); + } + TextDocumentEdit.is = is; +})(TextDocumentEdit || (TextDocumentEdit = {})); +var CreateFile; +(function (CreateFile) { + function create(uri, options) { + var result = { + kind: 'create', + uri: uri + }; + if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { + result.options = options; } - return null; - }; - Parser.prototype._parseOperation = function () { - if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__["TokenType"].ParenthesisL)) { - return null; + return result; + } + CreateFile.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && + (candidate.options === void 0 || + ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists)))); + } + CreateFile.is = is; +})(CreateFile || (CreateFile = {})); +var RenameFile; +(function (RenameFile) { + function create(oldUri, newUri, options) { + var result = { + kind: 'rename', + oldUri: oldUri, + newUri: newUri + }; + if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) { + result.options = options; } - 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 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 === void 0 || + ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists)))); + } + RenameFile.is = is; +})(RenameFile || (RenameFile = {})); +var DeleteFile; +(function (DeleteFile) { + function create(uri, options) { + var result = { + kind: 'delete', + uri: uri + }; + if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) { + result.options = options; } - return this.finish(node); + return result; + } + DeleteFile.create = create; + function is(value) { + var candidate = value; + return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && + (candidate.options === void 0 || + ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists)))); + } + DeleteFile.is = is; +})(DeleteFile || (DeleteFile = {})); +var WorkspaceEdit; +(function (WorkspaceEdit) { + function is(value) { + var candidate = value; + return candidate && + (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && + (candidate.documentChanges === void 0 || 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) { + this.edits = edits; + } + TextEditChangeImpl.prototype.insert = function (position, newText) { + this.edits.push(TextEdit.insert(position, newText)); }; - 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; + TextEditChangeImpl.prototype.replace = function (range, newText) { + this.edits.push(TextEdit.replace(range, newText)); }; - 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); + TextEditChangeImpl.prototype.delete = function (range) { + this.edits.push(TextEdit.del(range)); }; - 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); + TextEditChangeImpl.prototype.add = function (edit) { + this.edits.push(edit); }; - 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); + TextEditChangeImpl.prototype.all = function () { + return this.edits; }; - 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); + TextEditChangeImpl.prototype.clear = function () { + this.edits.splice(0, this.edits.length); }; - 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); - } + return TextEditChangeImpl; +}()); +/** + * 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) { + this._workspaceEdit = workspaceEdit; + if (workspaceEdit.documentChanges) { + workspaceEdit.documentChanges.forEach(function (change) { + if (TextDocumentEdit.is(change)) { + var textEditChange = new TextEditChangeImpl(change.edits); + _this._textEditChanges[change.textDocument.uri] = textEditChange; + } + }); } - } - 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 - } + else if (workspaceEdit.changes) { + Object.keys(workspaceEdit.changes).forEach(function (key) { + var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); + _this._textEditChanges[key] = textEditChange; + }); } - 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); + } + Object.defineProperty(WorkspaceChange.prototype, "edit", { + /** + * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal + * use to be returned from a workspace edit operation like rename. + */ + get: function () { + if (this._workspaceEdit === undefined) { + return { documentChanges: [] }; + } + return this._workspaceEdit; + }, + enumerable: true, + configurable: true + }); + WorkspaceChange.prototype.getTextEditChange = function (key) { + if (VersionedTextDocumentIdentifier.is(key)) { + if (!this._workspaceEdit) { + this._workspaceEdit = { + documentChanges: [] + }; + } + if (!this._workspaceEdit.documentChanges) { + throw new Error('Workspace edit is not configured for document changes.'); + } + var textDocument = key; + 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._textEditChanges[textDocument.uri] = result; + } + return result; } else { - return null; + if (!this._workspaceEdit) { + this._workspaceEdit = { + changes: Object.create(null) + }; + } + if (!this._workspaceEdit.changes) { + 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; } }; - return Parser; -}()); - - - -/***/ }), -/* 74 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TokenType", function() { return TokenType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultiLineStream", function() { return MultiLineStream; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scanner", function() { return Scanner; }); -/*--------------------------------------------------------------------------------------------- - * 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; + WorkspaceChange.prototype.createFile = function (uri, options) { + this.checkDocumentChanges(); + this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options)); }; - MultiLineStream.prototype.peekChar = function (n) { - if (n === void 0) { n = 0; } - return this.source.charCodeAt(this.position + n) || 0; + WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) { + this.checkDocumentChanges(); + this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options)); }; - MultiLineStream.prototype.lookbackChar = function (n) { - if (n === void 0) { n = 0; } - return this.source.charCodeAt(this.position - n) || 0; + WorkspaceChange.prototype.deleteFile = function (uri, options) { + this.checkDocumentChanges(); + this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options)); }; - MultiLineStream.prototype.advanceIfChar = function (ch) { - if (ch === this.source.charCodeAt(this.position)) { - this.position++; - return true; + WorkspaceChange.prototype.checkDocumentChanges = function () { + if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) { + throw new Error('Workspace edit is not configured for document changes.'); } - 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; + return WorkspaceChange; }()); -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; +/** + * 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 }; } - 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) + 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) && (candidate.version === null || Is.number(candidate.version)); + } + VersionedTextDocumentIdentifier.is = is; +})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); +/** + * 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.number(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 - Proposed state + */ +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 liternal 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 = {})); +/** + * 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 === void 0 || 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.15 + */ +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 } }; - }; - 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('')); + if (containerName) { + result.containerName = containerName; } - return null; - }; - Scanner.prototype.scan = function () { - // processes all whitespaces and comments - var triviaToken = this.trivia(); - if (triviaToken !== null) { - return triviaToken; + 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 !== void 0) { + result.children = children; } - var offset = this.stream.pos(); - // End of file/input - if (this.stream.eos()) { - return this.finishToken(offset, TokenType.EOF); + 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 === void 0 || Is.string(candidate.detail)) && + (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && + (candidate.children === void 0 || Array.isArray(candidate.children)) && + (candidate.tags === void 0 || Array.isArray(candidate.tags)); + } + 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 !== void 0 && only !== null) { + result.only = only; } - return this.scanNext(offset); - }; - Scanner.prototype.scanNext = function (offset) { - // CDO - if (this.stream.advanceIfChars([_MIN, _MIN, _RAN])) { - return this.finishToken(offset, TokenType.CDC); + else { + result.edit = commandOrEdit; } - var content = []; - if (this.ident(content)) { - return this.finishToken(offset, TokenType.Ident, content.join('')); + if (kind !== void 0) { + result.kind = kind; } - // 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); + return result; + } + CodeAction.create = create; + function is(value) { + var candidate = value; + return candidate && Is.string(candidate.title) && + (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && + (candidate.kind === void 0 || Is.string(candidate.kind)) && + (candidate.edit !== void 0 || candidate.command !== void 0) && + (candidate.command === void 0 || Command.is(candidate.command)) && + (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && + (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); + } + 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.number(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.number(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 { - return this.finishToken(offset, TokenType.Delim); + throw new Error('Overlapping edit'); } + lastModifiedOffset = startOffset; } - // hash - if (this.stream.advanceIfChar(_HSH)) { - content = ['#']; - if (this._name(content)) { - return this.finishToken(offset, TokenType.Hash, content.join('')); + 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 { - return this.finishToken(offset, TokenType.Delim); + // greater -> take right + data[i++] = right[rightIdx++]; } } - // Important - if (this.stream.advanceIfChar(_BNG)) { - return this.finishToken(offset, TokenType.Exclamation); + while (leftIdx < left.length) { + data[i++] = left[leftIdx++]; } - // 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('')); + while (rightIdx < right.length) { + data[i++] = right[rightIdx++]; + } + return data; + } +})(TextDocument || (TextDocument = {})); +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 (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; } - else { - // Unknown dimension 43ft - return this.finishToken(offset, TokenType.Dimension, content.join('')); + var ch = text.charAt(i); + isLineStart = (ch === '\r' || ch === '\n'); + if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { + i++; } } - return this.finishToken(offset, TokenType.Num); - } - // String, BadString - content = []; - var tokenType = this._string(content); - if (tokenType !== null) { - return this.finishToken(offset, tokenType, content.join('')); + if (isLineStart && text.length > 0) { + lineOffsets.push(text.length); + } + this._lineOffsets = lineOffsets; } - // single character tokens - tokenType = staticTokenTable[this.stream.peekChar()]; - if (typeof tokenType !== 'undefined') { - this.stream.advance(1); - return this.finishToken(offset, tokenType); + 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); } - // includes ~= - if (this.stream.peekChar(0) === _TLD && this.stream.peekChar(1) === _EQS) { - this.stream.advance(2); - return this.finishToken(offset, TokenType.Includes); + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } + else { + low = mid + 1; + } } - // DashMatch |= - if (this.stream.peekChar(0) === _PIP && this.stream.peekChar(1) === _EQS) { - this.stream.advance(2); - return this.finishToken(offset, TokenType.Dashmatch); + // 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; } - // Substring operator *= - if (this.stream.peekChar(0) === _MUL && this.stream.peekChar(1) === _EQS) { - this.stream.advance(2); - return this.finishToken(offset, TokenType.SubstringOperator); + else if (position.line < 0) { + return 0; } - // 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._matchWordAnyCase = function (characters) { - var index = 0; - this.stream.advanceWhileChar(function (ch) { - var result = characters[index] === ch || characters[index + 1] === ch; - if (result) { - index += 2; - } - return result; - }); - if (index === characters.length) { - return true; - } - else { - this.stream.goBack(index / 2); - return false; - } - }; - 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; + 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); }; - return Scanner; + Object.defineProperty(FullTextDocument.prototype, "lineCount", { + get: function () { + return this.getLineOffsets().length; + }, + enumerable: true, + 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 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 = {})); /***/ }), -/* 75 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 26 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NodeType", function() { return NodeType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReferenceType", function() { return ReferenceType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNodeAtOffset", function() { return getNodeAtOffset; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNodePath", function() { return getNodePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParentDeclaration", function() { return getParentDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Node", function() { return Node; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Nodelist", function() { return Nodelist; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Identifier", function() { return Identifier; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Stylesheet", function() { return Stylesheet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declarations", function() { return Declarations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BodyDeclaration", function() { return BodyDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuleSet", function() { return RuleSet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Selector", function() { return Selector; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleSelector", function() { return SimpleSelector; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AtApplyRule", function() { return AtApplyRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractDeclaration", function() { return AbstractDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomPropertyDeclaration", function() { return CustomPropertyDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomPropertySet", function() { return CustomPropertySet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return Declaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Property", function() { return Property; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Invocation", function() { return Invocation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionParameter", function() { return FunctionParameter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionArgument", function() { return FunctionArgument; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfStatement", function() { return IfStatement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ForStatement", function() { return ForStatement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EachStatement", function() { return EachStatement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileStatement", function() { return WhileStatement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElseStatement", function() { return ElseStatement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionDeclaration", function() { return FunctionDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewPort", function() { return ViewPort; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FontFace", function() { return FontFace; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NestedProperties", function() { return NestedProperties; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Keyframe", function() { return Keyframe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyframeSelector", function() { return KeyframeSelector; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Import", function() { return Import; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Use", function() { return Use; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModuleConfiguration", function() { return ModuleConfiguration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Forward", function() { return Forward; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ForwardVisibility", function() { return ForwardVisibility; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Namespace", function() { return Namespace; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Media", function() { return Media; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Supports", function() { return Supports; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Document", function() { return Document; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Medialist", function() { return Medialist; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SupportsCondition", function() { return SupportsCondition; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Page", function() { return Page; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PageBoxMarginBox", function() { return PageBoxMarginBox; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryExpression", function() { return BinaryExpression; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Term", function() { return Term; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttributeSelector", function() { return AttributeSelector; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operator", function() { return Operator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HexColorValue", function() { return HexColorValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumericValue", function() { return NumericValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableDeclaration", function() { return VariableDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interpolation", function() { return Interpolation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExtendsReference", function() { return ExtendsReference; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MixinReference", function() { return MixinReference; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MixinDeclaration", function() { return MixinDeclaration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnknownAtRule", function() { return UnknownAtRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListEntry", function() { return ListEntry; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LessGuard", function() { return LessGuard; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuardCondition", function() { return GuardCondition; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Module", function() { return Module; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Level", function() { return Level; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Marker", function() { return Marker; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseErrorCollector", function() { return ParseErrorCollector; }); -/*--------------------------------------------------------------------------------------------- - * 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 (b.hasOwnProperty(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["MixinContent"] = 48] = "MixinContent"; - NodeType[NodeType["Media"] = 49] = "Media"; - NodeType[NodeType["Keyframe"] = 50] = "Keyframe"; - NodeType[NodeType["FontFace"] = 51] = "FontFace"; - NodeType[NodeType["Import"] = 52] = "Import"; - NodeType[NodeType["Namespace"] = 53] = "Namespace"; - NodeType[NodeType["Invocation"] = 54] = "Invocation"; - NodeType[NodeType["FunctionDeclaration"] = 55] = "FunctionDeclaration"; - NodeType[NodeType["ReturnStatement"] = 56] = "ReturnStatement"; - NodeType[NodeType["MediaQuery"] = 57] = "MediaQuery"; - NodeType[NodeType["FunctionParameter"] = 58] = "FunctionParameter"; - NodeType[NodeType["FunctionArgument"] = 59] = "FunctionArgument"; - NodeType[NodeType["KeyframeSelector"] = 60] = "KeyframeSelector"; - NodeType[NodeType["ViewPort"] = 61] = "ViewPort"; - NodeType[NodeType["Document"] = 62] = "Document"; - NodeType[NodeType["AtApplyRule"] = 63] = "AtApplyRule"; - NodeType[NodeType["CustomPropertyDeclaration"] = 64] = "CustomPropertyDeclaration"; - NodeType[NodeType["CustomPropertySet"] = 65] = "CustomPropertySet"; - NodeType[NodeType["ListEntry"] = 66] = "ListEntry"; - NodeType[NodeType["Supports"] = 67] = "Supports"; - NodeType[NodeType["SupportsCondition"] = 68] = "SupportsCondition"; - NodeType[NodeType["NamespacePrefix"] = 69] = "NamespacePrefix"; - NodeType[NodeType["GridLine"] = 70] = "GridLine"; - NodeType[NodeType["Plugin"] = 71] = "Plugin"; - NodeType[NodeType["UnknownAtRule"] = 72] = "UnknownAtRule"; - NodeType[NodeType["Use"] = 73] = "Use"; - NodeType[NodeType["ModuleConfiguration"] = 74] = "ModuleConfiguration"; - NodeType[NodeType["Forward"] = 75] = "Forward"; - NodeType[NodeType["ForwardVisibility"] = 76] = "ForwardVisibility"; - NodeType[NodeType["Module"] = 77] = "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; +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 { + constructor(method) { + super(method); } - // 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; +exports.ProtocolRequestType0 = ProtocolRequestType0; +class ProtocolRequestType extends vscode_jsonrpc_1.RequestType { + constructor(method) { + super(method); } - return path; } -function getParentDeclaration(node) { - var decl = node.findParent(NodeType.Declaration); - var value = decl && decl.getValue(); - if (value && value.encloses(node)) { - return decl; +exports.ProtocolRequestType = ProtocolRequestType; +class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType { + constructor(method) { + super(method); } - 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; - } +exports.ProtocolNotificationType = ProtocolNotificationType; +class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 { + constructor(method) { + super(method); } - Object.defineProperty(Node.prototype, "end", { - get: function () { return this.offset + this.length; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Node.prototype, "type", { - get: function () { - return this.nodeType || NodeType.Undefined; - }, - set: function (type) { - this.nodeType = type; - }, - enumerable: true, - 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); - } +} +exports.ProtocolNotificationType0 = ProtocolNotificationType0; +//# sourceMappingURL=messages.js.map + +/***/ }), +/* 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 })); +const Is = __webpack_require__(28); +const vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +const protocol_implementation_1 = __webpack_require__(29); +exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest; +const protocol_typeDefinition_1 = __webpack_require__(30); +exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest; +const protocol_workspaceFolders_1 = __webpack_require__(31); +exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest; +exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; +const protocol_configuration_1 = __webpack_require__(32); +exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest; +const protocol_colorProvider_1 = __webpack_require__(33); +exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest; +exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest; +const protocol_foldingRange_1 = __webpack_require__(34); +exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest; +const protocol_declaration_1 = __webpack_require__(35); +exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest; +const protocol_selectionRange_1 = __webpack_require__(36); +exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest; +const protocol_progress_1 = __webpack_require__(37); +exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress; +exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest; +exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification; +const protocol_callHierarchy_1 = __webpack_require__(38); +exports.CallHierarchyIncomingCallsRequest = protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; +exports.CallHierarchyOutgoingCallsRequest = protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; +exports.CallHierarchyPrepareRequest = protocol_callHierarchy_1.CallHierarchyPrepareRequest; +// @ts-ignore: to avoid inlining LocatioLink 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; } - }; - 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); + for (let elem of value) { + if (!Is.string(elem) && !DocumentFilter.is(elem)) { + return false; } } - 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 true; } - return Nodelist; -}(Node)); + 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 startegy 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 intialized 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 = {})); +/** + * 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); + /** @deprecated Use CompletionRequest.type */ + CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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); + /** @deprecated Use DefinitionRequest.type */ + DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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); + /** @deprecated Use ReferencesRequest.type */ + ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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); + /** @deprecated Use DocumentHighlightRequest.type */ + DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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); + /** @deprecated Use DocumentSymbolRequest.type */ + DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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); + /** @deprecated Use CodeActionRequest.type */ + CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {})); +/** + * 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); + /** @deprecated Use WorkspaceSymbolRequest.type */ + WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); +/** + * A request to provide code lens for the given text document. + */ +var CodeLensRequest; +(function (CodeLensRequest) { + CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens'); + /** @deprecated Use CodeLensRequest.type */ + CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {})); +/** + * A request to resolve a command for a given code lens. + */ +var CodeLensResolveRequest; +(function (CodeLensResolveRequest) { + CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve'); +})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); +/** + * A request to provide document links + */ +var DocumentLinkRequest; +(function (DocumentLinkRequest) { + DocumentLinkRequest.method = 'textDocument/documentLink'; + DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method); + /** @deprecated Use DocumentLinkRequest.type */ + DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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.type = new messages_1.ProtocolRequestType('documentLink/resolve'); +})(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 = {})); +/** + * 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. + */ +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 -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: true, - configurable: true - }); - Identifier.prototype.containsInterpolation = function () { - return this.hasChildren(); - }; - return Identifier; -}(Node)); +/***/ }), +/* 28 */ +/***/ ((__unused_webpack_module, exports) => { -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: true, - configurable: true - }); - return Stylesheet; -}(Node)); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ -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: true, - configurable: true - }); - return Declarations; -}(Node)); +Object.defineProperty(exports, "__esModule", ({ value: true })); +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 -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)); +/***/ }), +/* 29 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - configurable: true - }); - return Selector; -}(Node)); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +// @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); + /** @deprecated Use ImplementationRequest.type */ + ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {})); +//# sourceMappingURL=protocol.implementation.js.map -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: true, - configurable: true - }); - return SimpleSelector; -}(Node)); +/***/ }), +/* 30 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +// @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); + /** @deprecated Use TypeDefinitionRequest.type */ + TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); +//# sourceMappingURL=protocol.typeDefinition.js.map -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: true, - configurable: true - }); - CustomPropertyDeclaration.prototype.setProperty = function (node) { - return this.setNode('property', node); - }; - CustomPropertyDeclaration.prototype.getProperty = function () { - return this.property; - }; - CustomPropertyDeclaration.prototype.setValue = function (value) { - return this.setNode('value', value); - }; - CustomPropertyDeclaration.prototype.getValue = function () { - return this.value; - }; - CustomPropertyDeclaration.prototype.setPropertySet = function (value) { - return this.setNode('propertySet', value); - }; - CustomPropertyDeclaration.prototype.getPropertySet = function () { - return this.propertySet; - }; - return CustomPropertyDeclaration; -}(AbstractDeclaration)); +/***/ }), +/* 31 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * 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 messages_1 = __webpack_require__(26); +/** + * 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 -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: true, - configurable: true - }); - Property.prototype.setIdentifier = function (value) { - return this.setNode('identifier', value); - }; - Property.prototype.getIdentifier = function () { - return this.identifier; - }; - Property.prototype.getName = function () { - return this.getText(); - }; - Property.prototype.isCustomProperty = function () { - return !!this.identifier && this.identifier.isCustomProperty; - }; - return Property; -}(Node)); +/***/ }), +/* 32 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * 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 messages_1 = __webpack_require__(26); +/** + * 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 -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: true, - 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)); +/***/ }), +/* 33 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +/** + * 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); + /** @deprecated Use DocumentColorRequest.type */ + DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(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 -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: true, - configurable: true - }); - ForStatement.prototype.setVariable = function (node) { - return this.setNode('variable', node, 0); - }; - return ForStatement; -}(BodyDeclaration)); +/***/ }), +/* 34 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - configurable: true - }); - return WhileStatement; -}(BodyDeclaration)); +/*--------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +/** + * 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); + /** @deprecated Use FoldingRangeRequest.type */ + FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); +//# sourceMappingURL=protocol.foldingRange.js.map -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: true, - configurable: true - }); - return ElseStatement; -}(BodyDeclaration)); +/***/ }), +/* 35 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - configurable: true - }); - return ViewPort; -}(BodyDeclaration)); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +// @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); + /** @deprecated Use DeclarationRequest.type */ + DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {})); +//# sourceMappingURL=protocol.declaration.js.map -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: true, - configurable: true - }); - return FontFace; -}(BodyDeclaration)); +/***/ }), +/* 36 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - 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)); +/*--------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +/** + * 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); + /** @deprecated Use SelectionRangeRequest.type */ + SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType(); +})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); +//# sourceMappingURL=protocol.selectionRange.js.map -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: true, - configurable: true - }); - return KeyframeSelector; -}(BodyDeclaration)); +/***/ }), +/* 37 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +const messages_1 = __webpack_require__(26); +var WorkDoneProgress; +(function (WorkDoneProgress) { + WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType(); +})(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 -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: true, - 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)); +/***/ }), +/* 38 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - configurable: true - }); - Forward.prototype.setIdentifier = function (node) { - return this.setNode('identifier', node, 0); - }; - Forward.prototype.getIdentifier = function () { - return this.identifier; - }; - 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: true, - configurable: true - }); - ForwardVisibility.prototype.setIdentifier = function (node) { - return this.setNode('identifier', node, 0); - }; - ForwardVisibility.prototype.getIdentifier = function () { - return this.identifier; - }; - return ForwardVisibility; -}(Node)); +/* -------------------------------------------------------------------------------------------- + * 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 })); +const messages_1 = __webpack_require__(26); +/** + * 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 -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: true, - configurable: true - }); - return Namespace; -}(Node)); +/***/ }), +/* 39 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - configurable: true - }); - return Media; -}(BodyDeclaration)); -var Supports = /** @class */ (function (_super) { - __extends(Supports, _super); - function Supports(offset, length) { - return _super.call(this, offset, length) || this; +/* -------------------------------------------------------------------------------------------- + * 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 vscode_jsonrpc_1 = __webpack_require__(6); +function createProtocolConnection(input, output, logger, options) { + if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) { + options = { connectionStrategy: options }; } - Object.defineProperty(Supports.prototype, "type", { - get: function () { - return NodeType.Supports; - }, - enumerable: true, - configurable: true - }); - return Supports; -}(BodyDeclaration)); + return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options); +} +exports.createProtocolConnection = createProtocolConnection; +//# sourceMappingURL=connection.js.map -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: true, - configurable: true - }); - return Document; -}(BodyDeclaration)); +/***/ }), +/* 40 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - configurable: true - }); - return MediaQuery; -}(Node)); +/* -------------------------------------------------------------------------------------------- + * 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 messages_1 = __webpack_require__(26); +/** + * 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 - Proposed state + */ +var SemanticTokenTypes; +(function (SemanticTokenTypes) { + SemanticTokenTypes["namespace"] = "namespace"; + 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["member"] = "member"; + 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 - Proposed state + */ +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 - Proposed state + */ +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 = {})); +/** + * @since 3.16.0 - Proposed state + */ +var SemanticTokensRequest; +(function (SemanticTokensRequest) { + SemanticTokensRequest.method = 'textDocument/semanticTokens'; + SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method); +})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); +/** + * @since 3.16.0 - Proposed state + */ +var SemanticTokensEditsRequest; +(function (SemanticTokensEditsRequest) { + SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits'; + SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method); +})(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {})); +/** + * @since 3.16.0 - Proposed state + */ +var SemanticTokensRangeRequest; +(function (SemanticTokensRangeRequest) { + SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range'; + SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method); +})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); +//# sourceMappingURL=protocol.semanticTokens.proposed.js.map -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: true, - configurable: true - }); - return SupportsCondition; -}(Node)); +/***/ }), +/* 41 */, +/* 42 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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: true, - 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: true, - configurable: true - }); - return PageBoxMarginBox; -}(BodyDeclaration)); +/*--------------------------------------------------------------------------------------------- + * 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__(43); +const runner_1 = __webpack_require__(59); +const htmlServer_1 = __webpack_require__(60); +const nodeFs_1 = __webpack_require__(153); +// 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() }); -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: true, - 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: true, - 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)); +/***/ }), +/* 43 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -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: true, - 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)); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ----------------------------------------------------------------------------------------- */ -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: true, - 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: true, - configurable: true - }); - return Operator; -}(Node)); +module.exports = __webpack_require__(44); -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: true, - configurable: true - }); - return HexColorValue; -}(Node)); +/***/ }), +/* 44 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -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; + +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ +/// +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +const Is = __webpack_require__(45); +const server_1 = __webpack_require__(46); +const fm = __webpack_require__(52); +const node_1 = __webpack_require__(56); +__export(__webpack_require__(57)); +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 _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. + process.exit(_shutdownReceived ? 0 : 1); + } + }, 3000); + } + } + catch (e) { + // Ignore errors; + } } - Object.defineProperty(NumericValue.prototype, "type", { - get: function () { - return NodeType.NumericValue; - }, - enumerable: true, - 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; + 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]); } - 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: true, - configurable: true - }); - VariableDeclaration.prototype.setVariable = function (node) { - if (node) { - node.attachTo(this); - this.variable = node; - return true; +} +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); } - 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; + }, + get shutdownReceived() { + return _shutdownReceived; + }, + set shutdownReceived(value) { + _shutdownReceived = value; + }, + exit: (code) => { + 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]; } - 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: true, - configurable: true - }); - return Interpolation; -}(Node)); - -var Variable = /** @class */ (function (_super) { - __extends(Variable, _super); - function Variable(offset, length) { - return _super.call(this, offset, length) || this; + 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); } - Object.defineProperty(Variable.prototype, "type", { - get: function () { - return NodeType.VariableName; - }, - enumerable: true, - configurable: true - }); - Variable.prototype.getName = function () { - return this.getText(); + 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', () => { + process.exit(_shutdownReceived ? 0 : 1); + }); + inputStream.on('close', () => { + process.exit(_shutdownReceived ? 0 : 1); + }); + } + const connectionFactory = (logger) => { + return node_1.createProtocolConnection(input, output, logger, options); }; - return Variable; -}(Node)); + return server_1.createConnection(connectionFactory, watchDog, factories); +} +//# sourceMappingURL=main.js.map -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: true, - configurable: true - }); - ExtendsReference.prototype.getSelectors = function () { - if (!this.selectors) { - this.selectors = new Nodelist(this); - } - return this.selectors; - }; - return ExtendsReference; -}(Node)); +/***/ }), +/* 45 */ +/***/ ((__unused_webpack_module, exports) => { -var MixinReference = /** @class */ (function (_super) { - __extends(MixinReference, _super); - function MixinReference(offset, length) { - return _super.call(this, offset, length) || this; + +/* -------------------------------------------------------------------------------------------- + * 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 })); +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 + +/***/ }), +/* 46 */ +/***/ ((__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 vscode_languageserver_protocol_1 = __webpack_require__(4); +const Is = __webpack_require__(45); +const UUID = __webpack_require__(47); +const progress_1 = __webpack_require__(48); +const configuration_1 = __webpack_require__(49); +const workspaceFolders_1 = __webpack_require__(50); +const callHierarchy_1 = __webpack_require__(51); +function null2Undefined(value) { + if (value === null) { + return undefined; } - Object.defineProperty(MixinReference.prototype, "type", { - get: function () { - return NodeType.MixinReference; - }, - enumerable: true, - 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 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 mananged 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 correspnding 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 occurences 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; } - 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; + count++; + this._messages[message] = count; } - Object.defineProperty(MixinDeclaration.prototype, "type", { - get: function () { - return NodeType.MixinDeclaration; - }, - enumerable: true, - 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); + /** + * 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.parameters; - }; - MixinDeclaration.prototype.setGuard = function (node) { - if (node) { - node.attachTo(this); - this.guard = node; + 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 }); } - 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: true, - 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; +} +class _RemoteWindowImpl { + constructor() { } - Object.defineProperty(ListEntry.prototype, "type", { - get: function () { - return NodeType.ListEntry; - }, - enumerable: true, - 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; + attach(connection) { + this._connection = connection; } - LessGuard.prototype.getConditions = function () { - if (!this.conditions) { - this.conditions = new Nodelist(this); + get connection() { + if (!this._connection) { + throw new Error('Remote is not attached to a connection yet.'); } - return this.conditions; - }; - return LessGuard; -}(Node)); - -var GuardCondition = /** @class */ (function (_super) { - __extends(GuardCondition, _super); - function GuardCondition() { - return _super !== null && _super.apply(this, arguments) || this; + return this._connection; } - 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; + initialize(_capabilities) { } - Object.defineProperty(Module.prototype, "type", { - get: function () { - return NodeType.Module; - }, - enumerable: true, - 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; + fillServerCapabilities(_capabilities) { } - 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); + 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 = 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); } - return this.visitUnknownNode(node); + let params = { + unregisterations: unregistrations + }; + this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => { + this._connection.console.info(`Bulk unregistration failed.`); + }); } - - public visitFontFace(node:FontFace):boolean { + 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(`Unregistering request handler for ${unregistration.id} failed.`); + }); return true; } - - public visitKeyframe(node:Keyframe):boolean { - return true; +} +class RemoteClientImpl { + attach(connection) { + this._connection = connection; } - - public visitKeyframeSelector(node:KeyframeSelector):boolean { - return true; + get connection() { + if (!this._connection) { + throw new Error('Remote is not attached to a connection yet.'); + } + return this._connection; } - - public visitStylesheet(node:Stylesheet):boolean { - return true; + initialize(_capabilities) { } - - public visitProperty(Node:Property):boolean { - return true; + fillServerCapabilities(_capabilities) { } - - public visitRuleSet(node:RuleSet):boolean { - return true; + 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); + } } - - public visitSelector(node:Selector):boolean { - return true; + 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); + }); } - - public visitSimpleSelector(node:SimpleSelector):boolean { - return true; + 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); + }); } - - public visitDeclaration(node:Declaration):boolean { - return true; + 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(`Unregistering request handler for ${id} failed.`); + }); } - - public visitFunction(node:Function):boolean { - return true; + 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); + }); } - - public visitFunctionDeclaration(node:FunctionDeclaration):boolean { - return true; +} +class _RemoteWorkspaceImpl { + constructor() { } - - public visitInvocation(node:Invocation):boolean { - return true; + attach(connection) { + this._connection = connection; } - - public visitTerm(node:Term):boolean { - return true; + get connection() { + if (!this._connection) { + throw new Error('Remote is not attached to a connection yet.'); + } + return this._connection; } - - public visitImport(node:Import):boolean { - return true; + initialize(_capabilities) { } - - public visitNamespace(node:Namespace):boolean { - return true; + fillServerCapabilities(_capabilities) { } - - public visitExpression(node:Expression):boolean { - return true; + 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); } - - public visitNumericValue(node:NumericValue):boolean { - return true; +} +const RemoteWorkspaceImpl = workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl)); +class TracerImpl { + constructor() { + this._trace = vscode_languageserver_protocol_1.Trace.Off; } - - public visitPage(node:Page):boolean { - return true; + attach(connection) { + this._connection = connection; } - - public visitPageBoxMarginBox(node:PageBoxMarginBox):boolean { - return true; + get connection() { + if (!this._connection) { + throw new Error('Remote is not attached to a connection yet.'); + } + return this._connection; } - - public visitNodelist(node:Nodelist):boolean { - return true; + initialize(_capabilities) { } - - public visitVariableDeclaration(node:VariableDeclaration):boolean { - return true; + fillServerCapabilities(_capabilities) { } - - public visitVariable(node:Variable):boolean { - return true; + set trace(value) { + this._trace = value; } - - public visitMixinDeclaration(node:MixinDeclaration):boolean { - return true; + 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 + }); } - - public visitMixinReference(node:MixinReference):boolean { - return true; +} +class TelemetryImpl { + constructor() { } - - public visitUnknownNode(node:Node):boolean { - return true; + 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); } } -*/ -var ParseErrorCollector = /** @class */ (function () { - function ParseErrorCollector() { - this.entries = []; +class _LanguagesImpl { + constructor() { } - 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); + attach(connection) { + this._connection = connection; + } + get connection() { + if (!this._connection) { + throw new Error('Remote is not attached to a connection yet.'); } - return true; - }; - return ParseErrorCollector; -}()); - - + 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 = 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)); + }), + 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 /***/ }), -/* 76 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 47 */ +/***/ ((__unused_webpack_module, exports) => { + -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CSSIssueType", function() { return CSSIssueType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseError", function() { return ParseError; }); -/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77); -/* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vscode_nls__WEBPACK_IMPORTED_MODULE_0__); /*--------------------------------------------------------------------------------------------- * 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; +Object.defineProperty(exports, "__esModule", ({ value: true })); +class ValueUUID { + constructor(_value) { + this._value = _value; + // empty } - 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")), -}; - + 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 /***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { +/* 48 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -/* -------------------------------------------------------------------------------------------- - * 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 }); -var path = __webpack_require__(3); -var fs = __webpack_require__(67); -var toString = Object.prototype.toString; -function isDefined(value) { - return typeof value !== 'undefined'; -} -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 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 = {})); -var resolvedLanguage; -var resolvedBundles; -var options; -var isPseudo; -function initializeSettings() { - options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: MessageFormat.bundle }; - if (isString(process.env.VSCODE_NLS_CONFIG)) { - try { - var vscodeOptions = JSON.parse(process.env.VSCODE_NLS_CONFIG); - var language = void 0; - var locale = void 0; - if (vscodeOptions.availableLanguages) { - var value = vscodeOptions.availableLanguages['*']; - if (isString(value)) { - language = value; - } - } - if (isString(vscodeOptions.locale)) { - options.locale = vscodeOptions.locale.toLowerCase(); - } - if (language === undefined) { - options.language = options.locale; - } - else if (language !== 'en') { - options.language = language; - } - if (isBoolean(vscodeOptions._languagePackSupport)) { - options.languagePackSupport = vscodeOptions._languagePackSupport; - } - if (isString(vscodeOptions._cacheRoot)) { - options.cacheRoot = vscodeOptions._cacheRoot; - } - if (isString(vscodeOptions._languagePackId)) { - options.languagePackId = vscodeOptions._languagePackId; - } - if (isString(vscodeOptions._translationsConfigFile)) { - options.translationsConfigFile = vscodeOptions._translationsConfigFile; - try { - options.translationsConfig = readJsonFileSync(options.translationsConfigFile); - } - catch (error) { - // We can't read the translation config file. Mark the cache as corrupted. - if (vscodeOptions._corruptedFile) { - fs.writeFile(vscodeOptions._corruptedFile, 'corrupted', 'utf8', function (err) { - console.error(err); - }); - } - } - } - } - catch (_a) { - // Do nothing. - } - } - isPseudo = options.locale === 'pseudo'; - resolvedLanguage = undefined; - resolvedBundles = Object.create(null); -} -initializeSettings(); -function supportsLanguagePack() { - return options.languagePackSupport === true && options.cacheRoot !== undefined && options.languagePackId !== undefined && options.translationsConfigFile !== undefined - && options.translationsConfig !== undefined; -} -function format(message, args) { - var result; - if (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; -} -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 format(messages[key], args); - } - else { - if (isString(message)) { - console.warn("Message " + message + " didn't get externalized correctly."); - return format(message, args); - } - else { - console.error("Broken localize call found. Stacktrace is\n: " + new Error('').stack); - } - } - }; -} -function localize(key, message) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - return format(message, args); -} -function resolveLanguage(file) { - var resolvedLanguage; - if (options.cacheLanguageResolution && resolvedLanguage) { - resolvedLanguage = resolvedLanguage; - } - else { - if (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 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 === MessageFormat.both || options.messageFormat === 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 === MessageFormat.both || options.messageFormat === MessageFormat.file) { - // Try to load a single file bundle - try { - var json = readJsonFileSync(resolveLanguage(file)); - if (Array.isArray(json)) { - return createScopedLocalizeFunction(json); - } - else { - if (isDefined(json.messages) && 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; - resolvedLanguage = undefined; - resolvedBundles = Object.create(null); - } - if (opts.messageFormat !== undefined) { - options.messageFormat = opts.messageFormat; - } - if (opts.bundleFormat === BundleFormat.standalone && options.languagePackSupport === true) { - options.languagePackSupport = false; - } - } - isPseudo = options.locale === 'pseudo'; - return loadMessageBundle; -} -exports.config = config; -//# sourceMappingURL=main.js.map -/***/ }), -/* 78 */ -/***/ (function(module, __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. + * ------------------------------------------------------------------------------------------ */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +const vscode_languageserver_protocol_1 = __webpack_require__(4); +const uuid_1 = __webpack_require__(47); +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; +exports.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()); + } + } + }; +}; +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 -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssDataManager", function() { return cssDataManager; }); -/* harmony import */ var _data_webCustomData__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(79); -/* harmony import */ var _dataManager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(80); -/* harmony import */ var _dataProvider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(82); -/* harmony import */ var _entry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(83); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "browserNames", function() { return _entry__WEBPACK_IMPORTED_MODULE_3__["browserNames"]; }); +/***/ }), +/* 49 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getEntryDescription", function() { return _entry__WEBPACK_IMPORTED_MODULE_3__["getEntryDescription"]; }); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBrowserLabel", function() { return _entry__WEBPACK_IMPORTED_MODULE_3__["getBrowserLabel"]; }); +Object.defineProperty(exports, "__esModule", ({ value: true })); +const vscode_languageserver_protocol_1 = __webpack_require__(4); +const Is = __webpack_require__(45); +exports.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]; + }); + } + }; +}; +//# sourceMappingURL=configuration.js.map -/* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(84); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorFunctions", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colorFunctions"]; }); +/***/ }), +/* 50 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colors", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colors"]; }); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorKeywords", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colorKeywords"]; }); +Object.defineProperty(exports, "__esModule", ({ value: true })); +const vscode_languageserver_protocol_1 = __webpack_require__(4); +exports.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; + } + }; +}; +//# sourceMappingURL=workspaceFolders.js.map -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isColorConstructor", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["isColorConstructor"]; }); +/***/ }), +/* 51 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isColorValue", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["isColorValue"]; }); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexDigit", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["hexDigit"]; }); +Object.defineProperty(exports, "__esModule", ({ value: true })); +const vscode_languageserver_protocol_1 = __webpack_require__(4); +exports.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)); + }); + } + }; + } + }; +}; +//# sourceMappingURL=callHierarchy.js.map -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorFromHex", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colorFromHex"]; }); +/***/ }), +/* 52 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorFrom256RGB", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colorFrom256RGB"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "colorFromHSL", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["colorFromHSL"]; }); +/* -------------------------------------------------------------------------------------------- + * 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 url = __webpack_require__(53); +const path = __webpack_require__(3); +const fs = __webpack_require__(54); +const child_process_1 = __webpack_require__(55); +/** + * @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 -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hslFromColor", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["hslFromColor"]; }); +/***/ }), +/* 53 */ +/***/ ((module) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getColorValue", function() { return _colors__WEBPACK_IMPORTED_MODULE_4__["getColorValue"]; }); +module.exports = require("url");; -/* harmony import */ var _builtinData__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(85); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "positionKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["positionKeywords"]; }); +/***/ }), +/* 54 */ +/***/ ((module) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatStyleKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["repeatStyleKeywords"]; }); +module.exports = require("fs");; -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lineStyleKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["lineStyleKeywords"]; }); +/***/ }), +/* 55 */ +/***/ ((module) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lineWidthKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["lineWidthKeywords"]; }); +module.exports = require("child_process");; -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "boxKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["boxKeywords"]; }); +/***/ }), +/* 56 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "geometryBoxKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["geometryBoxKeywords"]; }); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ----------------------------------------------------------------------------------------- */ -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cssWideKeywords", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["cssWideKeywords"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "imageFunctions", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["imageFunctions"]; }); +module.exports = __webpack_require__(4); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "transitionTimingFunctions", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["transitionTimingFunctions"]; }); +/***/ }), +/* 57 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "basicShapeFunctions", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["basicShapeFunctions"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "units", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["units"]; }); +/* -------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * ------------------------------------------------------------------------------------------ */ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +const st = __webpack_require__(58); +__export(__webpack_require__(4)); +__export(__webpack_require__(46)); +var ProposedFeatures; +(function (ProposedFeatures) { + ProposedFeatures.all = { + __brand: 'features', + languages: st.SemanticTokensFeature + }; + ProposedFeatures.SemanticTokensBuilder = st.SemanticTokensBuilder; +})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {})); +//# sourceMappingURL=api.js.map -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "html5Tags", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["html5Tags"]; }); +/***/ }), +/* 58 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "svgElements", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["svgElements"]; }); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pageBoxDirectives", function() { return _builtinData__WEBPACK_IMPORTED_MODULE_5__["pageBoxDirectives"]; }); +/* -------------------------------------------------------------------------------------------- + * 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 vscode_languageserver_protocol_1 = __webpack_require__(4); +exports.SemanticTokensFeature = (Base) => { + return class extends Base { + get semanticTokens() { + return { + on: (handler) => { + const type = vscode_languageserver_protocol_1.Proposed.SemanticTokensRequest.type; + this.connection.onRequest(type, (params, cancel) => { + return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); + }); + }, + onEdits: (handler) => { + const type = vscode_languageserver_protocol_1.Proposed.SemanticTokensEditsRequest.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.Proposed.SemanticTokensRangeRequest.type; + this.connection.onRequest(type, (params, cancel) => { + return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); + }); + } + }; + } + }; +}; +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.proposed.js.map -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CSSDataProvider", function() { return _dataProvider__WEBPACK_IMPORTED_MODULE_2__["CSSDataProvider"]; }); +/***/ }), +/* 59 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CSSDataManager", function() { return _dataManager__WEBPACK_IMPORTED_MODULE_1__["CSSDataManager"]; }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ - - - - - - - - - -var cssDataManager = new _dataManager__WEBPACK_IMPORTED_MODULE_1__["CSSDataManager"]([ - new _dataProvider__WEBPACK_IMPORTED_MODULE_2__["CSSDataProvider"](_data_webCustomData__WEBPACK_IMPORTED_MODULE_0__["cssData"]) -]); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.runSafe = exports.formatError = void 0; +const vscode_languageserver_1 = __webpack_require__(44); +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.ErrorCodes.RequestCancelled, 'Request cancelled'); +} /***/ }), -/* 79 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 60 */ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssData", function() { return cssData; }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -// file generated from vscode-web-custom-data NPM package -var cssData = { - "version": 1.1, - "properties": [ - { - "name": "width", - "values": [ - { - "name": "auto", - "description": "The width depends on the values of other properties." - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." - } - ], - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/width" +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__(44); +const languageModes_1 = __webpack_require__(61); +const formatting_1 = __webpack_require__(144); +const arrays_1 = __webpack_require__(145); +const documentContext_1 = __webpack_require__(146); +const vscode_uri_1 = __webpack_require__(84); +const runner_1 = __webpack_require__(59); +const htmlFolding_1 = __webpack_require__(148); +const customData_1 = __webpack_require__(149); +const selectionRanges_1 = __webpack_require__(150); +const semanticTokens_1 = __webpack_require__(152); +const requests_1 = __webpack_require__(147); +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 OnTypeRenameRequest; +(function (OnTypeRenameRequest) { + OnTypeRenameRequest.type = new vscode_languageserver_1.RequestType('html/onTypeRename'); +})(OnTypeRenameRequest || (OnTypeRenameRequest = {})); +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.RequestType('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 + }; + 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); + } + } } - ], - "description": "Specifies the width of the content area, padding area or border area (depending on 'box-sizing') of certain boxes.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "height", - "values": [ - { - "name": "auto", - "description": "The height depends on the values of other properties." - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." + 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' }, { language: 'htmldjango' }, { language: 'blade' }]; + 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 }); + } } - ], - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/height" + } + 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); } - ], - "description": "Specifies the height of the content area, padding area or border area (depending on 'box-sizing') of certain boxes.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "display", - "values": [ - { - "name": "block", - "description": "The element generates a block-level box" - }, - { - "name": "contents", - "description": "The element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal." - }, - { - "name": "flex", - "description": "The element generates a principal flex container box and establishes a flex formatting context." - }, - { - "name": "flexbox", - "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." - }, - { - "name": "flow-root", - "description": "The element generates a block container box, and lays out its contents using flow layout." - }, - { - "name": "grid", - "description": "The element generates a principal grid container box, and establishes a grid formatting context." - }, - { - "name": "inline", - "description": "The element generates an inline-level box." - }, - { - "name": "inline-block", - "description": "A block box, which itself is flowed as a single inline box, similar to a replaced element. The inside of an inline-block is formatted as a block box, and the box itself is formatted as an inline box." - }, - { - "name": "inline-flex", - "description": "Inline-level flex container." - }, - { - "name": "inline-flexbox", - "description": "Inline-level flex container. Standardized as 'inline-flex'" - }, - { - "name": "inline-table", - "description": "Inline-level table wrapper box containing table box." - }, - { - "name": "list-item", - "description": "One or more block boxes and one marker box." - }, - { - "name": "-moz-box", - "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." - }, - { - "name": "-moz-deck" - }, - { - "name": "-moz-grid" - }, - { - "name": "-moz-grid-group" - }, - { - "name": "-moz-grid-line" - }, - { - "name": "-moz-groupbox" - }, - { - "name": "-moz-inline-box", - "description": "Inline-level flex container. Standardized as 'inline-flex'" - }, - { - "name": "-moz-inline-grid" - }, - { - "name": "-moz-inline-stack" - }, - { - "name": "-moz-marker" - }, - { - "name": "-moz-popup" - }, - { - "name": "-moz-stack" - }, - { - "name": "-ms-flexbox", - "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." - }, - { - "name": "-ms-grid", - "description": "The element generates a principal grid container box, and establishes a grid formatting context." - }, - { - "name": "-ms-inline-flexbox", - "description": "Inline-level flex container. Standardized as 'inline-flex'" - }, - { - "name": "-ms-inline-grid", - "description": "Inline-level grid container." - }, - { - "name": "none", - "description": "The element and its descendants generates no boxes." - }, - { - "name": "ruby", - "description": "The element generates a principal ruby container box, and establishes a ruby formatting context." - }, - { - "name": "ruby-base" - }, - { - "name": "ruby-base-container" - }, - { - "name": "ruby-text" - }, - { - "name": "ruby-text-container" - }, - { - "name": "run-in", - "description": "The element generates a run-in box. Run-in elements act like inlines or blocks, depending on the surrounding elements." - }, - { - "name": "table", - "description": "The element generates a principal table wrapper box containing an additionally-generated table box, and establishes a table formatting context." - }, - { - "name": "table-caption" - }, - { - "name": "table-cell" - }, - { - "name": "table-column" - }, - { - "name": "table-column-group" - }, - { - "name": "table-footer-group" - }, - { - "name": "table-header-group" - }, - { - "name": "table-row" - }, - { - "name": "table-row-group" - }, - { - "name": "-webkit-box", - "description": "The element lays out its contents using flow layout (block-and-inline layout). Standardized as 'flex'." - }, - { - "name": "-webkit-flex", - "description": "The element lays out its contents using flow layout (block-and-inline layout)." - }, - { - "name": "-webkit-inline-box", - "description": "Inline-level flex container. Standardized as 'inline-flex'" - }, - { - "name": "-webkit-inline-flex", - "description": "Inline-level flex container." + } + 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); + if (mode && mode.doHover) { + return mode.doHover(document, textDocumentPosition.position); } - ], - "syntax": "[ || ] | | | | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/display" + } + 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); } - ], - "description": "In combination with 'float' and 'position', determines the type of box or boxes that are generated for an element.", - "restrictions": [ - "enum" - ] - }, - { - "name": "padding", - "values": [], - "syntax": "[ | ]{1,4}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/padding" + } + 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); } - ], - "description": "Shorthand property to set values the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "position", - "values": [ - { - "name": "absolute", - "description": "The box's position (and possibly size) is specified with the 'top', 'right', 'bottom', and 'left' properties. These properties specify offsets with respect to the box's 'containing block'." - }, - { - "name": "fixed", - "description": "The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. As with the 'absolute' model, the box's margins do not collapse with any other margins." - }, - { - "name": "-ms-page", - "description": "The box's position is calculated according to the 'absolute' model." - }, - { - "name": "relative", - "description": "The box's position is calculated according to the normal flow (this is called the position in normal flow). Then the box is offset relative to its normal position." - }, - { - "name": "static", - "description": "The box is a normal box, laid out according to the normal flow. The 'top', 'right', 'bottom', and 'left' properties do not apply." - }, - { - "name": "sticky", - "description": "The box's position is calculated according to the normal flow. Then the box is offset relative to its flow root and containing block and in all cases, including table elements, does not affect the position of any following boxes." - }, - { - "name": "-webkit-sticky", - "description": "The box's position is calculated according to the normal flow. Then the box is offset relative to its flow root and containing block and in all cases, including table elements, does not affect the position of any following boxes." + } + 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); } - ], - "syntax": "static | relative | absolute | sticky | fixed", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/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); } - ], - "restrictions": [ - "enum" - ] - }, - { - "name": "border", - "syntax": " || || ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border" + } + 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)); + } } - ], - "description": "Shorthand property for setting border width, style, and color.", - "restrictions": [ - "length", - "line-width", - "line-style", - "color" - ] - }, - { - "name": "margin", - "values": [ - { - "name": "auto" + } + 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)); + } } - ], - "syntax": "[ | | auto ]{1,4}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/margin" + } + 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)); + } } - ], - "description": "Shorthand property to set values the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "top", - "values": [ - { - "name": "auto", - "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" + } + 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); } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/top" + } + 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); + } } - ], - "description": "Specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's 'containing block'.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "left", - "values": [ - { - "name": "auto", - "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" + } + 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 htmlMode = languageModes.getMode('html'); + if (htmlMode && htmlMode.doRename) { + return htmlMode.doRename(document, position, params.newName); } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/left" + } + return null; + }), null, `Error while computing rename for ${params.textDocument.uri}`, token); + }); + connection.onRequest(OnTypeRenameRequest.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.doOnTypeRename) { + return mode.doOnTypeRename(document, pos); + } } - ], - "description": "Specifies how far an absolutely positioned box's left margin edge is offset to the right of the left edge of the box's 'containing block'.", - "restrictions": [ - "length", - "percentage" - ] + } + 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, (_params, 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; + + +/***/ }), +/* 61 */ +/***/ (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__(62); +const vscode_html_languageservice_1 = __webpack_require__(106); +const languageModelCache_1 = __webpack_require__(135); +const cssMode_1 = __webpack_require__(136); +const embeddedSupport_1 = __webpack_require__(137); +const htmlMode_1 = __webpack_require__(138); +const javascriptMode_1 = __webpack_require__(139); +__exportStar(__webpack_require__(106), 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); + }); }, - { - "name": "margin-top", - "values": [ - { - "name": "auto" - } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/margin-top" - } - ], - "description": "Shorthand property to set values the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", - "restrictions": [ - "length", - "percentage" - ] + getModeAtPosition(document, position) { + let languageId = documentRegions.get(document).getLanguageAtPosition(position); + if (languageId) { + return modes[languageId]; + } + return undefined; }, - { - "name": "color", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/color" - } - ], - "description": "Color of an element's text", - "restrictions": [ - "color" - ] + 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 + }; + }); }, - { - "name": "font-size", - "values": [ - { - "name": "large" - }, - { - "name": "larger" - }, - { - "name": "medium" - }, - { - "name": "small" - }, - { - "name": "smaller" - }, - { - "name": "x-large" - }, - { - "name": "x-small" - }, - { - "name": "xx-large" - }, - { - "name": "xx-small" - } - ], - "syntax": " | | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font-size" + getAllModesInDocument(document) { + let result = []; + for (let languageId of documentRegions.get(document).getLanguagesInDocument()) { + let mode = modes[languageId]; + if (mode) { + result.push(mode); } - ], - "description": "Indicates the desired height of glyphs from the font. For scalable fonts, the font-size is a scale factor applied to the EM unit of the font. (Note that certain glyphs may bleed outside their EM box.) For non-scalable fonts, the font-size is converted into absolute units and matched against the declared font-size of the font, using the same absolute coordinate space for both of the matched values.", - "restrictions": [ - "length", - "percentage" - ] + } + return result; }, - { - "name": "background-color", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-color" + getAllModes() { + let result = []; + for (let languageId in modes) { + let mode = modes[languageId]; + if (mode) { + result.push(mode); } - ], - "description": "Sets the background color of an element.", - "restrictions": [ - "color" - ] + } + return result; }, - { - "name": "text-align", - "values": [ - { - "name": "center", - "description": "The inline contents are centered within the line box." - }, - { - "name": "end", - "description": "The inline contents are aligned to the end edge of the line box." - }, - { - "name": "justify", - "description": "The text is justified according to the method specified by the 'text-justify' property." - }, - { - "name": "left", - "description": "The inline contents are aligned to the left edge of the line box. In vertical text, 'left' aligns to the edge of the line box that would be the start edge for left-to-right text." - }, - { - "name": "right", - "description": "The inline contents are aligned to the right edge of the line box. In vertical text, 'right' aligns to the edge of the line box that would be the end edge for left-to-right text." - }, - { - "name": "start", - "description": "The inline contents are aligned to the start edge of the line box." - } - ], - "syntax": "start | end | left | right | center | justify | match-parent", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-align" - } - ], - "description": "Describes how inline contents of a block are horizontally aligned if the contents do not completely fill the line box.", - "restrictions": [ - "string" - ] + getMode(languageId) { + return modes[languageId]; }, - { - "name": "opacity", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/opacity" - } - ], - "description": "Opacity of an element's text, where 1 is opaque and 0 is entirely transparent.", - "restrictions": [ - "number(0-1)" - ] + onDocumentRemoved(document) { + modelCaches.forEach(mc => mc.onDocumentRemoved(document)); + for (let mode in modes) { + modes[mode].onDocumentRemoved(document); + } }, - { - "name": "background", - "values": [ - { - "name": "fixed", - "description": "The background is fixed with regard to the viewport. In paged media where there is no viewport, a 'fixed' background is fixed with respect to the page box and therefore replicated on every page." - }, - { - "name": "local", - "description": "The background is fixed with regard to the element's contents: if the element has a scrolling mechanism, the background scrolls with the element's contents." - }, - { - "name": "none", - "description": "A value of 'none' counts as an image layer but draws nothing." - }, - { - "name": "scroll", - "description": "The background is fixed with regard to the element itself and does not scroll with its contents. (It is effectively attached to the element's border.)" + dispose() { + modelCaches.forEach(mc => mc.dispose()); + modelCaches = []; + for (let mode in modes) { + modes[mode].dispose(); + } + modes = {}; + } + }; +} +exports.getLanguageModes = getLanguageModes; + + +/***/ }), +/* 62 */ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* 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 */ "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 */ "DiagnosticCode": () => /* reexport safe */ _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__.DiagnosticCode, +/* 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 */ "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 */ "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 */ "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__(63); +/* harmony import */ var _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76); +/* harmony import */ var _services_cssHover__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(85); +/* harmony import */ var _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87); +/* harmony import */ var _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88); +/* harmony import */ var _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(90); +/* harmony import */ var _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(93); +/* harmony import */ var _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(96); +/* harmony import */ var _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(97); +/* harmony import */ var _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99); +/* harmony import */ var _services_cssFolding__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(100); +/* harmony import */ var _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(101); +/* harmony import */ var _languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(103); +/* harmony import */ var _services_cssSelectionRange__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(104); +/* harmony import */ var _services_scssNavigation__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(105); +/* harmony import */ var _data_webCustomData__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(102); +/* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(79); +/*--------------------------------------------------------------------------------------------- + * 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), + findColorSymbols: function (d, s) { return navigation.findDocumentColors(d, s).map(function (s) { return s.range; }); }, + 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); +} + + +/***/ }), +/* 63 */ +/***/ ((__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__(64); +/* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(65); +/* harmony import */ var _cssErrors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(67); +/* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(71); +/* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_4__ = __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 __spreadArrays = (undefined && undefined.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; + + + + + +/// +/// 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.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; } - ], - "syntax": "[ , ]* ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background" + } + } + 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; } - ], - "description": "Shorthand property for setting most background properties at the same place in the style sheet.", - "restrictions": [ - "enum", - "image", - "color", - "position", - "length", - "repeat", - "percentage", - "box" - ] - }, - { - "name": "float", - "values": [ - { - "name": "inline-end", - "description": "A keyword indicating that the element must float on the end side of its containing block. That is the right side with ltr scripts, and the left side with rtl scripts." - }, - { - "name": "inline-start", - "description": "A keyword indicating that the element must float on the start side of its containing block. That is the left side with ltr scripts, and the right side with rtl scripts." - }, - { - "name": "left", - "description": "The element generates a block box that is floated to the left. Content flows on the right side of the box, starting at the top (subject to the 'clear' property)." - }, - { - "name": "none", - "description": "The box is not floated." - }, - { - "name": "right", - "description": "Similar to 'left', except the box is floated to the right, and content flows on the left side of the box, starting at the top." + 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); + } } - ], - "syntax": "left | right | none | inline-start | inline-end", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/float" + 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; } - ], - "description": "Specifies how a box should be floated. It may be set for any element, but only applies to elements that generate boxes that are not absolutely positioned.", - "restrictions": [ - "enum" - ] - }, - { - "name": "font-weight", - "values": [ - { - "name": "100", - "description": "Thin" - }, - { - "name": "200", - "description": "Extra Light (Ultra Light)" - }, - { - "name": "300", - "description": "Light" - }, - { - "name": "400", - "description": "Normal" - }, - { - "name": "500", - "description": "Medium" - }, - { - "name": "600", - "description": "Semi Bold (Demi Bold)" - }, - { - "name": "700", - "description": "Bold" - }, - { - "name": "800", - "description": "Extra Bold (Ultra Bold)" - }, - { - "name": "900", - "description": "Black (Heavy)" - }, - { - "name": "bold", - "description": "Same as 700" - }, - { - "name": "bolder", - "description": "Specifies the weight of the face bolder than the inherited value." - }, - { - "name": "lighter", - "description": "Specifies the weight of the face lighter than the inherited value." - }, - { - "name": "normal", - "description": "Same as 400" + } 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); } - ], - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font-weight" + else { + this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RuleOrSelectorExpected); } - ], - "description": "Specifies weight of glyphs in the font, their degree of blackness or stroke thickness.", - "restrictions": [ - "enum" - ] - }, - { - "name": "overflow", - "values": [ - { - "name": "auto", - "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." - }, - { - "name": "hidden", - "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." - }, - { - "name": "-moz-hidden-unscrollable", - "description": "Same as the standardized 'clip', except doesn’t establish a block formatting context." - }, - { - "name": "scroll", - "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." - }, - { - "name": "visible", - "description": "Content is not clipped, i.e., it may be rendered outside the content box." + 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._tryParseCustomPropertyDeclaration() + || 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 (resyncStopTokens) { + 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)) { + var stopTokens = resyncStopTokens ? __spreadArrays(resyncStopTokens, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]) : [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon]; + return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ColonExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon], stopTokens); + } + 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 () { + 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); } - ], - "syntax": "[ visible | hidden | clip | scroll | auto ]{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/overflow" + } + this.restoreAtMark(mark); + } + // try tp parse as expression + var expression = this._parseExpr(); + if (expression && !expression.isErroneous(true)) { + this._parsePrio(); + if (this.peek(_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()); + 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 () { + var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); + var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 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: + // 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 (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; + 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 () { + 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(); + } + 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()); } - ], - "description": "Shorthand for setting 'overflow-x' and 'overflow-y'.", - "restrictions": [ - "enum" - ] - }, - { - "name": "line-height", - "values": [ - { - "name": "normal", - "description": "Tells user agents to set the computed value to a 'reasonable' value based on the font size of the element." + } + } + 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())) { + if (!this._parseSupportsCondition()) { + return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ConditionExpected); } - ], - "syntax": "normal | | | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/line-height" + } + 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(); } - ], - "description": "Determines the block-progression dimension of the text content area of an inline box.", - "restrictions": [ - "number", - "length", - "percentage" - ] - }, - { - "name": "font-family", - "values": [ - { - "name": "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif" - }, - { - "name": "Arial, Helvetica, sans-serif" - }, - { - "name": "Cambria, Cochin, Georgia, Times, 'Times New Roman', serif" - }, - { - "name": "'Courier New', Courier, monospace" - }, - { - "name": "cursive" - }, - { - "name": "fantasy" - }, - { - "name": "'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif" - }, - { - "name": "Georgia, 'Times New Roman', Times, serif" - }, - { - "name": "'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif" - }, - { - "name": "Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif" - }, - { - "name": "'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" - }, - { - "name": "monospace" - }, - { - "name": "sans-serif" - }, - { - "name": "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif" - }, - { - "name": "serif" - }, - { - "name": "'Times New Roman', Times, serif" - }, - { - "name": "'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif" - }, - { - "name": "Verdana, Geneva, Tahoma, sans-serif" + 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); } - ], - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font-family" + 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); } - ], - "description": "Specifies a prioritized list of font family names or generic family names. A user agent iterates through the list of family names until it matches an available font that contains a glyph for the character to be rendered.", - "restrictions": [ - "font" - ] - }, - { - "name": "text-decoration", - "values": [ - { - "name": "dashed", - "description": "Produces a dashed line style." - }, - { - "name": "dotted", - "description": "Produces a dotted line." - }, - { - "name": "double", - "description": "Produces a double line." - }, - { - "name": "line-through", - "description": "Each line of text has a line through the middle." - }, - { - "name": "none", - "description": "Produces no line." - }, - { - "name": "overline", - "description": "Each line of text has a line above it." - }, - { - "name": "solid", - "description": "Produces a solid line." - }, - { - "name": "underline", - "description": "Each line of text is underlined." - }, - { - "name": "wavy", - "description": "Produces a wavy line." + } + 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); } - ], - "syntax": "<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-decoration" + } + } + 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); } - ], - "description": "Decorations applied to font used for an element's text.", - "restrictions": [ - "enum", - "color" - ] - }, - { - "name": "box-sizing", - "values": [ - { - "name": "border-box", - "description": "The specified width and height (and respective min/max properties) on this element determine the border box of the element." - }, - { - "name": "content-box", - "description": "Behavior of width and height as specified by CSS2.1. The specified width and height (and respective min/max properties) apply to the width and height respectively of the content box of the element." + 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); } - ], - "syntax": "content-box | border-box", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/box-sizing" + } + 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 :: + if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon) && this.hasWhitespace()) { + this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); + } + if (!node.addChild(this._parseIdent())) { + this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); + } + return 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); } - ], - "description": "Specifies the behavior of the 'width' and 'height' properties.", - "restrictions": [ - "enum" - ] - }, - { - "name": "z-index", - "values": [ - { - "name": "auto", - "description": "The stack level of the generated box in the current stacking context is 0. The box does not establish a new stacking context unless it is the root element." - } - ], - "syntax": "auto | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/z-index" - } - ], - "description": "For a positioned box, the 'z-index' property specifies the stack level of the box in the current stacking context and whether the box establishes a local stacking context.", - "restrictions": [ - "integer" - ] - }, - { - "name": "vertical-align", - "values": [ - { - "name": "auto", - "description": "Align the dominant baseline of the parent box with the equivalent, or heuristically reconstructed, baseline of the element inline box." - }, - { - "name": "baseline", - "description": "Align the 'alphabetic' baseline of the element with the 'alphabetic' baseline of the parent element." - }, - { - "name": "bottom", - "description": "Align the after edge of the extended inline box with the after-edge of the line box." - }, - { - "name": "middle", - "description": "Align the 'middle' baseline of the inline element with the middle baseline of the parent." - }, - { - "name": "sub", - "description": "Lower the baseline of the box to the proper position for subscripts of the parent's box. (This value has no effect on the font size of the element's text.)" - }, - { - "name": "super", - "description": "Raise the baseline of the box to the proper position for superscripts of the parent's box. (This value has no effect on the font size of the element's text.)" - }, - { - "name": "text-bottom", - "description": "Align the bottom of the box with the after-edge of the parent element's font." - }, - { - "name": "text-top", - "description": "Align the top of the box with the before-edge of the parent element's font." - }, - { - "name": "top", - "description": "Align the before edge of the extended inline box with the before-edge of the line box." - }, - { - "name": "-webkit-baseline-middle" - } - ], - "syntax": "baseline | sub | super | text-top | text-bottom | middle | top | bottom | | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/vertical-align" + 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; } - ], - "description": "Affects the vertical positioning of the inline boxes generated by an inline-level element inside a line box.", - "restrictions": [ - "percentage", - "length" - ] - }, - { - "name": "border-radius", - "syntax": "{1,4} [ / {1,4} ]?", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-radius" + if (!node.getArguments().addChild(this._parseFunctionArgument())) { + this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ExpressionExpected); } - ], - "description": "Defines the radii of the outer border edge.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "margin-left", - "values": [ - { - "name": "auto" + } + } + 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 } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/margin-left" + } + 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; +}()); + + + +/***/ }), +/* 64 */ +/***/ ((__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); } - ], - "description": "Shorthand property to set values the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "cursor", - "values": [ - { - "name": "alias", - "description": "Indicates an alias of/shortcut to something is to be created. Often rendered as an arrow with a small curved arrow next to it." - }, - { - "name": "all-scroll", - "description": "Indicates that the something can be scrolled in any direction. Often rendered as arrows pointing up, down, left, and right with a dot in the middle." - }, - { - "name": "auto", - "description": "The UA determines the cursor to display based on the current context." - }, - { - "name": "cell", - "description": "Indicates that a cell or set of cells may be selected. Often rendered as a thick plus-sign with a dot in the middle." - }, - { - "name": "col-resize", - "description": "Indicates that the item/column can be resized horizontally. Often rendered as arrows pointing left and right with a vertical bar separating them." - }, - { - "name": "context-menu", - "description": "A context menu is available for the object under the cursor. Often rendered as an arrow with a small menu-like graphic next to it." - }, - { - "name": "copy", - "description": "Indicates something is to be copied. Often rendered as an arrow with a small plus sign next to it." - }, - { - "name": "crosshair", - "description": "A simple crosshair (e.g., short line segments resembling a '+' sign). Often used to indicate a two dimensional bitmap selection mode." - }, - { - "name": "default", - "description": "The platform-dependent default cursor. Often rendered as an arrow." - }, - { - "name": "e-resize", - "description": "Indicates that east edge is to be moved." - }, - { - "name": "ew-resize", - "description": "Indicates a bidirectional east-west resize cursor." - }, - { - "name": "grab", - "description": "Indicates that something can be grabbed." - }, - { - "name": "grabbing", - "description": "Indicates that something is being grabbed." - }, - { - "name": "help", - "description": "Help is available for the object under the cursor. Often rendered as a question mark or a balloon." - }, - { - "name": "move", - "description": "Indicates something is to be moved." - }, - { - "name": "-moz-grab", - "description": "Indicates that something can be grabbed." - }, - { - "name": "-moz-grabbing", - "description": "Indicates that something is being grabbed." - }, - { - "name": "-moz-zoom-in", - "description": "Indicates that something can be zoomed (magnified) in." - }, - { - "name": "-moz-zoom-out", - "description": "Indicates that something can be zoomed (magnified) out." - }, - { - "name": "ne-resize", - "description": "Indicates that movement starts from north-east corner." - }, - { - "name": "nesw-resize", - "description": "Indicates a bidirectional north-east/south-west cursor." - }, - { - "name": "no-drop", - "description": "Indicates that the dragged item cannot be dropped at the current cursor location. Often rendered as a hand or pointer with a small circle with a line through it." - }, - { - "name": "none", - "description": "No cursor is rendered for the element." - }, - { - "name": "not-allowed", - "description": "Indicates that the requested action will not be carried out. Often rendered as a circle with a line through it." - }, - { - "name": "n-resize", - "description": "Indicates that north edge is to be moved." - }, - { - "name": "ns-resize", - "description": "Indicates a bidirectional north-south cursor." - }, - { - "name": "nw-resize", - "description": "Indicates that movement starts from north-west corner." - }, - { - "name": "nwse-resize", - "description": "Indicates a bidirectional north-west/south-east cursor." - }, - { - "name": "pointer", - "description": "The cursor is a pointer that indicates a link." - }, - { - "name": "progress", - "description": "A progress indicator. The program is performing some processing, but is different from 'wait' in that the user may still interact with the program. Often rendered as a spinning beach ball, or an arrow with a watch or hourglass." - }, - { - "name": "row-resize", - "description": "Indicates that the item/row can be resized vertically. Often rendered as arrows pointing up and down with a horizontal bar separating them." - }, - { - "name": "se-resize", - "description": "Indicates that movement starts from south-east corner." - }, - { - "name": "s-resize", - "description": "Indicates that south edge is to be moved." - }, - { - "name": "sw-resize", - "description": "Indicates that movement starts from south-west corner." - }, - { - "name": "text", - "description": "Indicates text that may be selected. Often rendered as a vertical I-beam." - }, - { - "name": "vertical-text", - "description": "Indicates vertical-text that may be selected. Often rendered as a horizontal I-beam." - }, - { - "name": "wait", - "description": "Indicates that the program is busy and the user should wait. Often rendered as a watch or hourglass." - }, - { - "name": "-webkit-grab", - "description": "Indicates that something can be grabbed." - }, - { - "name": "-webkit-grabbing", - "description": "Indicates that something is being grabbed." - }, - { - "name": "-webkit-zoom-in", - "description": "Indicates that something can be zoomed (magnified) in." - }, - { - "name": "-webkit-zoom-out", - "description": "Indicates that something can be zoomed (magnified) out." - }, - { - "name": "w-resize", - "description": "Indicates that west edge is to be moved." - }, - { - "name": "zoom-in", - "description": "Indicates that something can be zoomed (magnified) in." - }, - { - "name": "zoom-out", - "description": "Indicates that something can be zoomed (magnified) out." - } - ], - "syntax": "[ [ [ ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/cursor" - } - ], - "description": "Allows control over cursor appearance in an element", - "restrictions": [ - "url", - "number", - "enum" - ] - }, - { - "name": "margin-bottom", - "values": [ - { - "name": "auto" - } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/margin-bottom" - } - ], - "description": "Shorthand property to set values the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "right", - "values": [ - { - "name": "auto", - "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" - } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/right" - } - ], - "description": "Specifies how far an absolutely positioned box's right margin edge is offset to the left of the right edge of the box's 'containing block'.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "margin-right", - "values": [ - { - "name": "auto" + 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('')); } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/margin-right" + else { + // Unknown dimension 43ft + return this.finishToken(offset, TokenType.Dimension, content.join('')); } - ], - "description": "Shorthand property to set values the thickness of the margin area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. Negative values for margin properties are allowed, but there may be implementation-specific limits..", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "padding-left", - "syntax": " | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/padding-left" + } + 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); } - ], - "description": "Shorthand property to set values the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "padding-top", - "syntax": " | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/padding-top" + } + else if (this.comment()) { + if (!this.ignoreComment) { + return this.finishToken(offset, TokenType.Comment); } - ], - "description": "Shorthand property to set values the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "max-width", - "values": [ - { - "name": "none", - "description": "No limit on the width of the box." - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." + } + 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; } - ], - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/max-width" + 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'); } - ], - "description": "Allows authors to constrain content width to a certain range.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "bottom", - "values": [ - { - "name": "auto", - "description": "For non-replaced elements, the effect of this value depends on which of related properties have the value 'auto' as well" + 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)); + } } - ], - "syntax": " | | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/bottom" + catch (e) { + // ignore } - ], - "description": "Specifies how far an absolutely positioned box's bottom margin edge is offset above the bottom edge of the box's 'containing block'.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "background-image", - "values": [ - { - "name": "none", - "description": "Counts as an image layer but draws nothing." + // optional whitespace or new line, not part of result text + if (ch === _WSP || ch === _TAB) { + this.stream.advance(1); } - ], - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-image" + else { + this._newline([]); } - ], - "description": "Sets the background image(s) of an element.", - "restrictions": [ - "image", - "enum" - ] - }, - { - "name": "content", - "values": [ - { - "name": "attr()", - "description": "The attr(n) function returns as a string the value of attribute n for the subject of the selector." - }, - { - "name": "counter(name)", - "description": "Counters are denoted by identifiers (see the 'counter-increment' and 'counter-reset' properties)." - }, - { - "name": "icon", - "description": "The (pseudo-)element is replaced in its entirety by the resource referenced by its 'icon' property, and treated as a replaced element." - }, - { - "name": "none", - "description": "On elements, this inhibits the children of the element from being rendered as children of this element, as if the element was empty. On pseudo-elements it causes the pseudo-element to have no content." - }, - { - "name": "normal", - "description": "See http://www.w3.org/TR/css3-content/#content for computation rules." - }, - { - "name": "url()" - } - ], - "syntax": "normal | none | [ | ] [/ ]?", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/content" + 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 } - ], - "description": "Determines which page-based occurrence of a given element is applied to a counter or string value.", - "restrictions": [ - "string", - "url" - ] + 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; +}()); + + + +/***/ }), +/* 65 */ +/***/ ((__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 */ "CustomPropertyDeclaration": () => /* binding */ CustomPropertyDeclaration, +/* harmony export */ "CustomPropertySet": () => /* binding */ CustomPropertySet, +/* harmony export */ "Declaration": () => /* binding */ Declaration, +/* 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__(66); +/*--------------------------------------------------------------------------------------------- + * 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; }, - { - "name": "padding-right", - "syntax": " | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/padding-right" - } - ], - "description": "Shorthand property to set values the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", - "restrictions": [ - "length", - "percentage" - ] + set: function (type) { + this.nodeType = type; }, - { - "name": "white-space", - "values": [ - { - "name": "normal", - "description": "Sets 'white-space-collapsing' to 'collapse' and 'text-wrap' to 'normal'." - }, - { - "name": "nowrap", - "description": "Sets 'white-space-collapsing' to 'collapse' and 'text-wrap' to 'none'." - }, - { - "name": "pre", - "description": "Sets 'white-space-collapsing' to 'preserve' and 'text-wrap' to 'none'." - }, - { - "name": "pre-line", - "description": "Sets 'white-space-collapsing' to 'preserve-breaks' and 'text-wrap' to 'normal'." - }, - { - "name": "pre-wrap", - "description": "Sets 'white-space-collapsing' to 'preserve' and 'text-wrap' to 'normal'." - } - ], - "syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/white-space" + 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; } - ], - "description": "Shorthand property for the 'white-space-collapsing' and 'text-wrap' properties.", - "restrictions": [ - "enum" - ] - }, - { - "name": "padding-bottom", - "syntax": " | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/padding-bottom" - } - ], - "description": "Shorthand property to set values the thickness of the padding area. If left is omitted, it is the same as right. If bottom is omitted it is the same as top, if right is omitted it is the same as top. The value may not be negative.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "border-bottom", - "syntax": " || || ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom" - } - ], - "description": "Shorthand property for setting border width, style and color.", - "restrictions": [ - "length", - "line-width", - "line-style", - "color" - ] + } + } + 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; }, - { - "name": "box-shadow", - "values": [ - { - "name": "inset", - "description": "Changes the drop shadow from an outer shadow (one that shadows the box onto the canvas, as if it were lifted above the canvas) to an inner shadow (one that shadows the canvas onto the box, as if the box were cut out of the canvas and shifted behind it)." - }, - { - "name": "none", - "description": "No shadow." - } - ], - "syntax": "none | #", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/box-shadow" - } - ], - "description": "Attaches one or more drop-shadows to the box. The property is a comma-separated list of shadows, each specified by 2-4 length values, an optional color, and an optional 'inset' keyword. Omitted lengths are 0; omitted colors are a user agent chosen color.", - "restrictions": [ - "length", - "color", - "enum" - ] + 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; }, - { - "name": "transform", - "values": [ - { - "name": "matrix()", - "description": "Specifies a 2D transformation in the form of a transformation matrix of six values. matrix(a,b,c,d,e,f) is equivalent to applying the transformation matrix [a b c d e f]" - }, - { - "name": "matrix3d()", - "description": "Specifies a 3D transformation as a 4x4 homogeneous matrix of 16 values in column-major order." - }, - { - "name": "none" - }, - { - "name": "perspective()", - "description": "Specifies a perspective projection matrix." - }, - { - "name": "rotate()", - "description": "Specifies a 2D rotation by the angle specified in the parameter about the origin of the element, as defined by the transform-origin property." - }, - { - "name": "rotate3d()", - "description": "Specifies a clockwise 3D rotation by the angle specified in last parameter about the [x,y,z] direction vector described by the first 3 parameters." - }, - { - "name": "rotateX('angle')", - "description": "Specifies a clockwise rotation by the given angle about the X axis." - }, - { - "name": "rotateY('angle')", - "description": "Specifies a clockwise rotation by the given angle about the Y axis." - }, - { - "name": "rotateZ('angle')", - "description": "Specifies a clockwise rotation by the given angle about the Z axis." - }, - { - "name": "scale()", - "description": "Specifies a 2D scale operation by the [sx,sy] scaling vector described by the 2 parameters. If the second parameter is not provided, it is takes a value equal to the first." - }, - { - "name": "scale3d()", - "description": "Specifies a 3D scale operation by the [sx,sy,sz] scaling vector described by the 3 parameters." - }, - { - "name": "scaleX()", - "description": "Specifies a scale operation using the [sx,1] scaling vector, where sx is given as the parameter." - }, - { - "name": "scaleY()", - "description": "Specifies a scale operation using the [sy,1] scaling vector, where sy is given as the parameter." - }, - { - "name": "scaleZ()", - "description": "Specifies a scale operation using the [1,1,sz] scaling vector, where sz is given as the parameter." - }, - { - "name": "skew()", - "description": "Specifies a skew transformation along the X and Y axes. The first angle parameter specifies the skew on the X axis. The second angle parameter specifies the skew on the Y axis. If the second parameter is not given then a value of 0 is used for the Y angle (ie: no skew on the Y axis)." - }, - { - "name": "skewX()", - "description": "Specifies a skew transformation along the X axis by the given angle." - }, - { - "name": "skewY()", - "description": "Specifies a skew transformation along the Y axis by the given angle." - }, - { - "name": "translate()", - "description": "Specifies a 2D translation by the vector [tx, ty], where tx is the first translation-value parameter and ty is the optional second translation-value parameter." - }, - { - "name": "translate3d()", - "description": "Specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and tz being the first, second and third translation-value parameters respectively." - }, - { - "name": "translateX()", - "description": "Specifies a translation by the given amount in the X direction." - }, - { - "name": "translateY()", - "description": "Specifies a translation by the given amount in the Y direction." - }, - { - "name": "translateZ()", - "description": "Specifies a translation by the given amount in the Z direction. Note that percentage values are not allowed in the translateZ translation-value, and if present are evaluated as 0." - } - ], - "syntax": "none | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/transform" - } - ], - "description": "A two-dimensional transformation is applied to an element through the 'transform' property. This property contains a list of transform functions similar to those allowed by SVG.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "min-height", - "values": [ - { - "name": "auto" - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." - } - ], - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/min-height" - } - ], - "description": "Allows authors to constrain content height to a certain range.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "visibility", - "values": [ - { - "name": "collapse", - "description": "Table-specific. If used on elements other than rows, row groups, columns, or column groups, 'collapse' has the same meaning as 'hidden'." - }, - { - "name": "hidden", - "description": "The generated box is invisible (fully transparent, nothing is drawn), but still affects layout." - }, - { - "name": "visible", - "description": "The generated box is visible." - } - ], - "syntax": "visible | hidden | collapse", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/visibility" - } - ], - "description": "Specifies whether the boxes generated by an element are rendered. Invisible boxes still affect layout (set the ‘display’ property to ‘none’ to suppress box generation altogether).", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "background-position", - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-position" - } - ], - "description": "Specifies the initial position of the background image(s) (after any resizing) within their corresponding background positioning area.", - "restrictions": [ - "position", - "length", - "percentage" - ] + 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; }, - { - "name": "border-top", - "syntax": " || || ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-top" - } - ], - "description": "Shorthand property for setting border width, style and color", - "restrictions": [ - "length", - "line-width", - "line-style", - "color" - ] + 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; }, - { - "name": "min-width", - "values": [ - { - "name": "auto" - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." - } - ], - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/min-width" - } - ], - "description": "Allows authors to constrain content width to a certain range.", - "restrictions": [ - "length", - "percentage" - ] + 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 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; }, - { - "name": "outline", - "values": [ - { - "name": "auto", - "description": "Permits the user agent to render a custom outline style, typically the default platform style." - }, - { - "name": "invert", - "description": "Performs a color inversion on the pixels on the screen." - } - ], - "syntax": "[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/outline" - } - ], - "description": "Shorthand property for 'outline-style', 'outline-width', and 'outline-color'.", - "restrictions": [ - "length", - "line-width", - "line-style", - "color", - "enum" - ] + enumerable: false, + configurable: true + }); + CustomPropertyDeclaration.prototype.setProperty = function (node) { + return this.setNode('property', node); + }; + CustomPropertyDeclaration.prototype.getProperty = function () { + return this.property; + }; + CustomPropertyDeclaration.prototype.setValue = function (value) { + return this.setNode('value', value); + }; + CustomPropertyDeclaration.prototype.getValue = function () { + return this.value; + }; + CustomPropertyDeclaration.prototype.setPropertySet = function (value) { + return this.setNode('propertySet', value); + }; + CustomPropertyDeclaration.prototype.getPropertySet = function () { + return this.propertySet; + }; + return CustomPropertyDeclaration; +}(AbstractDeclaration)); + +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; }, - { - "name": "transition", - "values": [ - { - "name": "all", - "description": "Every property that is able to undergo a transition will do so." - }, - { - "name": "none", - "description": "No property will transition." - } - ], - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/transition" - } - ], - "description": "Shorthand property combines four of the transition properties into a single property.", - "restrictions": [ - "time", - "property", - "timing-function", - "enum" - ] + 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; }, - { - "name": "clear", - "values": [ - { - "name": "both", - "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating and left-floating boxes that resulted from elements earlier in the source document." - }, - { - "name": "left", - "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any left-floating boxes that resulted from elements earlier in the source document." - }, - { - "name": "none", - "description": "No constraint on the box's position with respect to floats." - }, - { - "name": "right", - "description": "The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating boxes that resulted from elements earlier in the source document." - } - ], - "syntax": "none | left | right | both | inline-start | inline-end", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/clear" - } - ], - "description": "Indicates which sides of an element's box(es) may not be adjacent to an earlier floating box. The 'clear' property does not consider floats inside the element itself or in other block formatting contexts.", - "restrictions": [ - "enum" - ] + 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 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; }, - { - "name": "border-color", - "values": [], - "syntax": "{1,4}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-color" - } - ], - "description": "The color of the border around all four edges of an element.", - "restrictions": [ - "color" - ] + 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; }, - { - "name": "background-repeat", - "values": [], - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-repeat" - } - ], - "description": "Specifies how background images are tiled after they have been sized and positioned.", - "restrictions": [ - "repeat" - ] + 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; }, - { - "name": "background-size", - "values": [ - { - "name": "auto", - "description": "Resolved by using the image’s intrinsic ratio and the size of the other dimension, or failing that, using the image’s intrinsic size, or failing that, treating it as 100%." - }, - { - "name": "contain", - "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area." - }, - { - "name": "cover", - "description": "Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area." - } - ], - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-size" - } - ], - "description": "Specifies the size of the background images.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "text-transform", - "values": [ - { - "name": "capitalize", - "description": "Puts the first typographic letter unit of each word in titlecase." - }, - { - "name": "lowercase", - "description": "Puts all letters in lowercase." - }, - { - "name": "none", - "description": "No effects." - }, - { - "name": "uppercase", - "description": "Puts all letters in uppercase." - } - ], - "syntax": "none | capitalize | uppercase | lowercase | full-width | full-size-kana", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-transform" - } - ], - "description": "Controls capitalization effects of an element’s text.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "max-height", - "values": [ - { - "name": "none", - "description": "No limit on the height of the box." - }, - { - "name": "fit-content", - "description": "Use the fit-content inline size or fit-content block size, as appropriate to the writing mode." - }, - { - "name": "max-content", - "description": "Use the max-content inline size or max-content block size, as appropriate to the writing mode." - }, - { - "name": "min-content", - "description": "Use the min-content inline size or min-content block size, as appropriate to the writing mode." - } - ], - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/max-height" - } - ], - "description": "Allows authors to constrain content height to a certain range.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "list-style", - "values": [ - { - "name": "armenian" - }, - { - "name": "circle", - "description": "A hollow circle." - }, - { - "name": "decimal" - }, - { - "name": "decimal-leading-zero" - }, - { - "name": "disc", - "description": "A filled circle." - }, - { - "name": "georgian" - }, - { - "name": "inside", - "description": "The marker box is outside the principal block box, as described in the section on the ::marker pseudo-element below." - }, - { - "name": "lower-alpha" - }, - { - "name": "lower-greek" - }, - { - "name": "lower-latin" - }, - { - "name": "lower-roman" - }, - { - "name": "none" - }, - { - "name": "outside", - "description": "The ::marker pseudo-element is an inline element placed immediately before all ::before pseudo-elements in the principal block box, after which the element's content flows." - }, - { - "name": "square", - "description": "A filled square." - }, - { - "name": "symbols()", - "description": "Allows a counter style to be defined inline." - }, - { - "name": "upper-alpha" - }, - { - "name": "upper-latin" - }, - { - "name": "upper-roman" - }, - { - "name": "url()" - } - ], - "syntax": "<'list-style-type'> || <'list-style-position'> || <'list-style-image'>", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/list-style" - } - ], - "description": "Shorthand for setting 'list-style-type', 'list-style-position' and 'list-style-image'", - "restrictions": [ - "image", - "enum", - "url" - ] + 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; }, - { - "name": "font-style", - "values": [ - { - "name": "italic", - "description": "Selects a font that is labeled as an 'italic' face, or an 'oblique' face if one is not" - }, - { - "name": "normal", - "description": "Selects a face that is classified as 'normal'." - }, - { - "name": "oblique", - "description": "Selects a font that is labeled as an 'oblique' face, or an 'italic' face if one is not." - } - ], - "syntax": "normal | italic | oblique {0,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font-style" - } - ], - "description": "Allows italic or oblique faces to be selected. Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "font", - "values": [ - { - "name": "100", - "description": "Thin" - }, - { - "name": "200", - "description": "Extra Light (Ultra Light)" - }, - { - "name": "300", - "description": "Light" - }, - { - "name": "400", - "description": "Normal" - }, - { - "name": "500", - "description": "Medium" - }, - { - "name": "600", - "description": "Semi Bold (Demi Bold)" - }, - { - "name": "700", - "description": "Bold" - }, - { - "name": "800", - "description": "Extra Bold (Ultra Bold)" - }, - { - "name": "900", - "description": "Black (Heavy)" - }, - { - "name": "bold", - "description": "Same as 700" - }, - { - "name": "bolder", - "description": "Specifies the weight of the face bolder than the inherited value." - }, - { - "name": "caption", - "description": "The font used for captioned controls (e.g., buttons, drop-downs, etc.)." - }, - { - "name": "icon", - "description": "The font used to label icons." - }, - { - "name": "italic", - "description": "Selects a font that is labeled 'italic', or, if that is not available, one labeled 'oblique'." - }, - { - "name": "large" - }, - { - "name": "larger" - }, - { - "name": "lighter", - "description": "Specifies the weight of the face lighter than the inherited value." - }, - { - "name": "medium" - }, - { - "name": "menu", - "description": "The font used in menus (e.g., dropdown menus and menu lists)." - }, - { - "name": "message-box", - "description": "The font used in dialog boxes." - }, - { - "name": "normal", - "description": "Specifies a face that is not labeled as a small-caps font." - }, - { - "name": "oblique", - "description": "Selects a font that is labeled 'oblique'." - }, - { - "name": "small" - }, - { - "name": "small-caps", - "description": "Specifies a font that is labeled as a small-caps font. If a genuine small-caps font is not available, user agents should simulate a small-caps font." - }, - { - "name": "small-caption", - "description": "The font used for labeling small controls." - }, - { - "name": "smaller" - }, - { - "name": "status-bar", - "description": "The font used in window status bars." - }, - { - "name": "x-large" - }, - { - "name": "x-small" - }, - { - "name": "xx-large" - }, - { - "name": "xx-small" - } - ], - "syntax": "[ [ <'font-style'> || || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font" - } - ], - "description": "Shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family', at the same place in the style sheet. The syntax of this property is based on a traditional typographical shorthand notation to set multiple properties related to fonts.", - "restrictions": [ - "font" - ] + 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; }, - { - "name": "text-overflow", - "values": [ - { - "name": "clip", - "description": "Clip inline content that overflows. Characters may be only partially rendered." - }, - { - "name": "ellipsis", - "description": "Render an ellipsis character (U+2026) to represent clipped inline content." - } - ], - "syntax": "[ clip | ellipsis | ]{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-overflow" - } - ], - "description": "Text can overflow for example when it is prevented from wrapping.", - "restrictions": [ - "enum", - "string" - ] + 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; }, - { - "name": "border-left", - "syntax": " || || ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-left" - } - ], - "description": "Shorthand property for setting border width, style and color", - "restrictions": [ - "length", - "line-width", - "line-style", - "color" - ] + 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; }, - { - "name": "border-right", - "syntax": " || || ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-right" - } - ], - "description": "Shorthand property for setting border width, style and color", - "restrictions": [ - "length", - "line-width", - "line-style", - "color" - ] + 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; }, - { - "name": "border-width", - "values": [], - "syntax": "{1,4}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-width" - } - ], - "description": "Shorthand that sets the four 'border-*-width' properties. If it has four values, they set top, right, bottom and left in that order. If left is missing, it is the same as right; if bottom is missing, it is the same as top; if right is missing, it is the same as top.", - "restrictions": [ - "length", - "line-width" - ] + 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; }, - { - "name": "justify-content", - "values": [ - { - "name": "center", - "description": "Flex items are packed toward the center of the line." - }, - { - "name": "start", - "description": "The items are packed flush to each other toward the start edge of the alignment container in the main axis." - }, - { - "name": "end", - "description": "The items are packed flush to each other toward the end edge of the alignment container in the main axis." - }, - { - "name": "left", - "description": "The items are packed flush to each other toward the left edge of the alignment container in the main axis." - }, - { - "name": "right", - "description": "The items are packed flush to each other toward the right edge of the alignment container in the main axis." - }, - { - "name": "safe", - "description": "If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were start." - }, - { - "name": "unsafe", - "description": "Regardless of the relative sizes of the item and alignment container, the given alignment value is honored." - }, - { - "name": "stretch", - "description": "If the combined size of the alignment subjects is less than the size of the alignment container, any auto-sized alignment subjects have their size increased equally (not proportionally), while still respecting the constraints imposed by max-height/max-width (or equivalent functionality), so that the combined size exactly fills the alignment container." - }, - { - "name": "space-evenly", - "description": "The items are evenly distributed within the alignment container along the main axis." - }, - { - "name": "flex-end", - "description": "Flex items are packed toward the end of the line." - }, - { - "name": "flex-start", - "description": "Flex items are packed toward the start of the line." - }, - { - "name": "space-around", - "description": "Flex items are evenly distributed in the line, with half-size spaces on either end." - }, - { - "name": "space-between", - "description": "Flex items are evenly distributed in the line." - }, - { - "name": "baseline", - "description": "Specifies participation in first-baseline alignment." - }, - { - "name": "first baseline", - "description": "Specifies participation in first-baseline alignment." - }, - { - "name": "last baseline", - "description": "Specifies participation in last-baseline alignment." - } - ], - "syntax": "normal | | ? [ | left | right ]", - "description": "Aligns flex items along the main axis of the current line of the flex container.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "align-items", - "values": [ - { - "name": "baseline", - "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." - }, - { - "name": "center", - "description": "The flex item’s margin box is centered in the cross axis within the line." - }, - { - "name": "flex-end", - "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." - }, - { - "name": "flex-start", - "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." - }, - { - "name": "stretch", - "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." - } - ], - "syntax": "normal | stretch | | [ ? ]", - "description": "Aligns flex items along the cross axis of the current line of the flex container.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "overflow-y", - "values": [ - { - "name": "auto", - "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." - }, - { - "name": "hidden", - "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." - }, - { - "name": "scroll", - "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." - }, - { - "name": "visible", - "description": "Content is not clipped, i.e., it may be rendered outside the content box." - } - ], - "syntax": "visible | hidden | clip | scroll | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-y" - } - ], - "description": "Specifies the handling of overflow in the vertical direction.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "pointer-events", - "values": [ - { - "name": "all", - "description": "The given element can be the target element for pointer events whenever the pointer is over either the interior or the perimeter of the element." - }, - { - "name": "fill", - "description": "The given element can be the target element for pointer events whenever the pointer is over the interior of the element." - }, - { - "name": "none", - "description": "The given element does not receive pointer events." - }, - { - "name": "painted", - "description": "The given element can be the target element for pointer events when the pointer is over a \"painted\" area. " - }, - { - "name": "stroke", - "description": "The given element can be the target element for pointer events whenever the pointer is over the perimeter of the element." - }, - { - "name": "visible", - "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and the pointer is over either the interior or the perimete of the element." - }, - { - "name": "visibleFill", - "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over the interior of the element." - }, - { - "name": "visiblePainted", - "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over a ‘painted’ area." - }, - { - "name": "visibleStroke", - "description": "The given element can be the target element for pointer events when the ‘visibility’ property is set to visible and when the pointer is over the perimeter of the element." - } - ], - "syntax": "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/pointer-events" - } - ], - "description": "Specifies under what circumstances a given element can be the target element for a pointer event.", - "restrictions": [ - "enum" - ] - }, - { - "name": "letter-spacing", - "values": [ - { - "name": "normal", - "description": "The spacing is the normal spacing for the current font. It is typically zero-length." - } - ], - "syntax": "normal | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/letter-spacing" - } - ], - "description": "Specifies the minimum, maximum, and optimal spacing between grapheme clusters.", - "restrictions": [ - "length" - ] + 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; }, - { - "name": "border-style", - "values": [], - "syntax": "{1,4}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-style" - } - ], - "description": "The style of the border around edges of an element.", - "restrictions": [ - "line-style" - ] + 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; }, - { - "name": "animation", - "values": [ - { - "name": "alternate", - "description": "The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction." - }, - { - "name": "alternate-reverse", - "description": "The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction." - }, - { - "name": "backwards", - "description": "The beginning property value (as defined in the first @keyframes at-rule) is applied before the animation is displayed, during the period defined by 'animation-delay'." - }, - { - "name": "both", - "description": "Both forwards and backwards fill modes are applied." - }, - { - "name": "forwards", - "description": "The final property value (as defined in the last @keyframes at-rule) is maintained after the animation completes." - }, - { - "name": "infinite", - "description": "Causes the animation to repeat forever." - }, - { - "name": "none", - "description": "No animation is performed" - }, - { - "name": "normal", - "description": "Normal playback." - }, - { - "name": "reverse", - "description": "All iterations of the animation are played in the reverse direction from the way they were specified." - } - ], - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/animation" - } - ], - "description": "Shorthand property combines six of the animation properties into a single property.", - "restrictions": [ - "time", - "timing-function", - "enum", - "identifier", - "number" - ] + 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; }, - { - "name": "overflow-x", - "values": [ - { - "name": "auto", - "description": "The behavior of the 'auto' value is UA-dependent, but should cause a scrolling mechanism to be provided for overflowing boxes." - }, - { - "name": "hidden", - "description": "Content is clipped and no scrolling mechanism should be provided to view the content outside the clipping region." - }, - { - "name": "scroll", - "description": "Content is clipped and if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed for a box whether or not any of its content is clipped." - }, - { - "name": "visible", - "description": "Content is not clipped, i.e., it may be rendered outside the content box." - } - ], - "syntax": "visible | hidden | clip | scroll | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-x" - } - ], - "description": "Specifies the handling of overflow in the horizontal direction.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "word-wrap", - "values": [ - { - "name": "break-word", - "description": "An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line." - }, - { - "name": "normal", - "description": "Lines may break only at allowed break points." - } - ], - "syntax": "normal | break-word", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/overflow-wrap" - } - ], - "description": "Specifies whether the UA may break within a word to prevent overflow when an otherwise-unbreakable string is too long to fit.", - "restrictions": [ - "enum" - ] + enumerable: false, + configurable: true + }); + Forward.prototype.setIdentifier = function (node) { + return this.setNode('identifier', node, 0); + }; + Forward.prototype.getIdentifier = function () { + return this.identifier; + }; + 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; }, - { - "name": "border-collapse", - "values": [ - { - "name": "collapse", - "description": "Selects the collapsing borders model." - }, - { - "name": "separate", - "description": "Selects the separated borders border model." - } - ], - "syntax": "collapse | separate", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-collapse" - } - ], - "description": "Selects a table's border model.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "flex-direction", - "values": [ - { - "name": "column", - "description": "The flex container’s main axis has the same orientation as the block axis of the current writing mode." - }, - { - "name": "column-reverse", - "description": "Same as 'column', except the main-start and main-end directions are swapped." - }, - { - "name": "row", - "description": "The flex container’s main axis has the same orientation as the inline axis of the current writing mode." - }, - { - "name": "row-reverse", - "description": "Same as 'row', except the main-start and main-end directions are swapped." - } - ], - "syntax": "row | row-reverse | column | column-reverse", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/flex-direction" - } - ], - "description": "Specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "zoom", - "browsers": [ - "E12", - "S3.1", - "C1", - "IE5.5", - "O15" - ], - "values": [ - { - "name": "normal" - } - ], - "syntax": "auto | | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/zoom" - } - ], - "description": "Non-standard. Specifies the magnification scale of the object. See 'transform: scale()' for a standards-based alternative.", - "restrictions": [ - "enum", - "integer", - "number", - "percentage" - ] + 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; }, - { - "name": "flex", - "values": [ - { - "name": "auto", - "description": "Retrieves the value of the main size property as the used 'flex-basis'." - }, - { - "name": "content", - "description": "Indicates automatic sizing, based on the flex item’s content." - }, - { - "name": "none", - "description": "Expands to '0 0 auto'." - } - ], - "syntax": "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/flex" - } - ], - "description": "Specifies the components of a flexible length: the flex grow factor and flex shrink factor, and the flex basis.", - "restrictions": [ - "length", - "number", - "percentage" - ] + 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; }, - { - "name": "text-shadow", - "values": [ - { - "name": "none", - "description": "No shadow." - } - ], - "syntax": "none | #", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-shadow" - } - ], - "description": "Enables shadow effects to be applied to the text of the element.", - "restrictions": [ - "length", - "color" - ] + 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; }, - { - "name": "list-style-type", - "values": [ - { - "name": "armenian", - "description": "Traditional uppercase Armenian numbering." - }, - { - "name": "circle", - "description": "A hollow circle." - }, - { - "name": "decimal", - "description": "Western decimal numbers." - }, - { - "name": "decimal-leading-zero", - "description": "Decimal numbers padded by initial zeros." - }, - { - "name": "disc", - "description": "A filled circle." - }, - { - "name": "georgian", - "description": "Traditional Georgian numbering." - }, - { - "name": "lower-alpha", - "description": "Lowercase ASCII letters." - }, - { - "name": "lower-greek", - "description": "Lowercase classical Greek." - }, - { - "name": "lower-latin", - "description": "Lowercase ASCII letters." - }, - { - "name": "lower-roman", - "description": "Lowercase ASCII Roman numerals." - }, - { - "name": "none", - "description": "No marker" - }, - { - "name": "square", - "description": "A filled square." - }, - { - "name": "symbols()", - "description": "Allows a counter style to be defined inline." - }, - { - "name": "upper-alpha", - "description": "Uppercase ASCII letters." - }, - { - "name": "upper-latin", - "description": "Uppercase ASCII letters." - }, - { - "name": "upper-roman", - "description": "Uppercase ASCII Roman numerals." - } - ], - "syntax": " | | none", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/list-style-type" - } - ], - "description": "Used to construct the default contents of a list item’s marker", - "restrictions": [ - "enum", - "string" - ] - }, - { - "name": "border-bottom-left-radius", - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius" - } - ], - "description": "Defines the radii of the bottom left outer border edge.", - "restrictions": [ - "length", - "percentage" - ] - }, - { - "name": "user-select", - "values": [ - { - "name": "all", - "description": "The content of the element must be selected atomically" - }, - { - "name": "auto" - }, - { - "name": "contain", - "description": "UAs must not allow a selection which is started in this element to be extended outside of this element." - }, - { - "name": "none", - "description": "The UA must not allow selections to be started in this element." - }, - { - "name": "text", - "description": "The element imposes no constraint on the selection." - } - ], - "status": "nonstandard", - "syntax": "auto | text | none | contain | all", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/user-select" - } - ], - "description": "Controls the appearance of selection.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "fill", - "values": [ - { - "name": "url()", - "description": "A URL reference to a paint server element, which is an element that defines a paint server: ‘hatch’, ‘linearGradient’, ‘mesh’, ‘pattern’, ‘radialGradient’ and ‘solidcolor’." - }, - { - "name": "none", - "description": "No paint is applied in this layer." - } - ], - "description": "Paints the interior of the given graphical element.", - "restrictions": [ - "color", - "enum", - "url" - ] + 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; }, - { - "name": "transform-origin", - "syntax": "[ | left | center | right | top | bottom ] | [ [ | left | center | right ] && [ | top | center | bottom ] ] ?", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/transform-origin" - } - ], - "description": "Establishes the origin of transformation for an element.", - "restrictions": [ - "position", - "length", - "percentage" - ] + 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; }, - { - "name": "border-top-left-radius", - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius" - } - ], - "description": "Defines the radii of the top left outer border edge.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "text-indent", - "values": [], - "syntax": " && hanging? && each-line?", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-indent" - } - ], - "description": "Specifies the indentation applied to lines of inline content in a block. The indentation only affects the first line of inline content in the block unless the 'hanging' keyword is specified, in which case it affects all lines except the first.", - "restrictions": [ - "percentage", - "length" - ] + 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; }, - { - "name": "border-bottom-right-radius", - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius" - } - ], - "description": "Defines the radii of the bottom right outer border edge.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "flex-wrap", - "values": [ - { - "name": "nowrap", - "description": "The flex container is single-line." - }, - { - "name": "wrap", - "description": "The flexbox is multi-line." - }, - { - "name": "wrap-reverse", - "description": "Same as 'wrap', except the cross-start and cross-end directions are swapped." - } - ], - "syntax": "nowrap | wrap | wrap-reverse", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/flex-wrap" - } - ], - "description": "Controls whether the flex container is single-line or multi-line, and the direction of the cross-axis, which determines the direction new lines are stacked in.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "border-spacing", - "syntax": " ?", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-spacing" - } - ], - "description": "The lengths specify the distance that separates adjoining cell borders. If one length is specified, it gives both the horizontal and vertical spacing. If two are specified, the first gives the horizontal spacing and the second the vertical spacing. Lengths may not be negative.", - "restrictions": [ - "length" - ] + 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; }, - { - "name": "border-top-right-radius", - "syntax": "{1,2}", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius" - } - ], - "description": "Defines the radii of the top right outer border edge.", - "restrictions": [ - "length", - "percentage" - ] + 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; }, - { - "name": "clip", - "values": [ - { - "name": "auto", - "description": "The element does not clip." - }, - { - "name": "rect()", - "description": "Specifies offsets from the edges of the border box." - } - ], - "syntax": " | auto", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/clip" - } - ], - "description": "Deprecated. Use the 'clip-path' property when support allows. Defines the visible portion of an element’s box.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "border-top-color", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-top-color" - } - ], - "description": "Sets the color of the top border.", - "restrictions": [ - "color" - ] + 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; }, - { - "name": "word-break", - "values": [ - { - "name": "break-all", - "description": "Lines may break between any two grapheme clusters for non-CJK scripts." - }, - { - "name": "keep-all", - "description": "Block characters can no longer create implied break points." - }, - { - "name": "normal", - "description": "Breaks non-CJK scripts according to their own rules." - } - ], - "syntax": "normal | break-all | keep-all | break-word", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/word-break" - } - ], - "description": "Specifies line break opportunities for non-CJK scripts.", - "restrictions": [ - "enum" - ] - }, - { - "name": "border-bottom-color", - "syntax": "<'border-top-color'>", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-bottom-color" - } - ], - "description": "Sets the color of the bottom border.", - "restrictions": [ - "color" - ] + 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; }, - { - "name": "flex-grow", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/flex-grow" - } - ], - "description": "Sets the flex grow factor. Negative numbers are invalid.", - "restrictions": [ - "number" - ] + 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; }, - { - "name": "direction", - "values": [ - { - "name": "ltr", - "description": "Left-to-right direction." - }, - { - "name": "rtl", - "description": "Right-to-left direction." - } - ], - "syntax": "ltr | rtl", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/direction" - } - ], - "description": "Specifies the inline base direction or directionality of any bidi paragraph, embedding, isolate, or override established by the box. Note: for HTML content use the 'dir' attribute and 'bdo' element rather than this property.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "align-self", - "values": [ - { - "name": "auto", - "description": "Computes to the value of 'align-items' on the element’s parent, or 'stretch' if the element has no parent. On absolutely positioned elements, it computes to itself." - }, - { - "name": "baseline", - "description": "If the flex item’s inline axis is the same as the cross axis, this value is identical to 'flex-start'. Otherwise, it participates in baseline alignment." - }, - { - "name": "center", - "description": "The flex item’s margin box is centered in the cross axis within the line." - }, - { - "name": "flex-end", - "description": "The cross-end margin edge of the flex item is placed flush with the cross-end edge of the line." - }, - { - "name": "flex-start", - "description": "The cross-start margin edge of the flex item is placed flush with the cross-start edge of the line." - }, - { - "name": "stretch", - "description": "If the cross size property of the flex item computes to auto, and neither of the cross-axis margins are auto, the flex item is stretched." - } - ], - "syntax": "auto | normal | stretch | | ? ", - "description": "Allows the default alignment along the cross axis to be overridden for individual flex items.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "flex-shrink", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/flex-shrink" - } - ], - "description": "Sets the flex shrink factor. Negative numbers are invalid.", - "restrictions": [ - "number" - ] + 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; }, - { - "name": "text-rendering", - "browsers": [ - "FF1", - "S5", - "C4", - "O15" - ], - "values": [ - { - "name": "auto" - }, - { - "name": "geometricPrecision", - "description": "Indicates that the user agent shall emphasize geometric precision over legibility and rendering speed." - }, - { - "name": "optimizeLegibility", - "description": "Indicates that the user agent shall emphasize legibility over rendering speed and geometric precision." - }, - { - "name": "optimizeSpeed", - "description": "Indicates that the user agent shall emphasize rendering speed over legibility and geometric precision." - } - ], - "syntax": "auto | optimizeSpeed | optimizeLegibility | geometricPrecision", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/text-rendering" - } - ], - "description": "The creator of SVG content might want to provide a hint to the implementation about what tradeoffs to make as it renders text. The ‘text-rendering’ property provides these hints.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "touch-action", - "values": [ - { - "name": "auto", - "description": "The user agent may determine any permitted touch behaviors for touches that begin on the element." - }, - { - "name": "cross-slide-x" - }, - { - "name": "cross-slide-y" - }, - { - "name": "double-tap-zoom" - }, - { - "name": "manipulation", - "description": "The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming." - }, - { - "name": "none", - "description": "Touches that begin on the element must not trigger default touch behaviors." - }, - { - "name": "pan-x", - "description": "The user agent may consider touches that begin on the element only for the purposes of horizontally scrolling the element’s nearest ancestor with horizontally scrollable content." - }, - { - "name": "pan-y", - "description": "The user agent may consider touches that begin on the element only for the purposes of vertically scrolling the element’s nearest ancestor with vertically scrollable content." - }, - { - "name": "pinch-zoom" - } - ], - "syntax": "auto | none | [ [ pan-x | pan-left | pan-right ] || [ pan-y | pan-up | pan-down ] || pinch-zoom ] | manipulation", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/touch-action" - } - ], - "description": "Determines whether touch input may trigger default behavior supplied by user agent.", - "restrictions": [ - "enum" - ] + 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; }, - { - "name": "background-clip", - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/background-clip" - } - ], - "description": "Determines the background painting area.", - "restrictions": [ - "box" - ] + 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; }, - { - "name": "filter", - "browsers": [ - "E12", - "FF35", - "S9.1", - "C53", - "O40" - ], - "values": [ - { - "name": "none", - "description": "No filter effects are applied." - }, - { - "name": "blur()", - "description": "Applies a Gaussian blur to the input image." - }, - { - "name": "brightness()", - "description": "Applies a linear multiplier to input image, making it appear more or less bright." - }, - { - "name": "contrast()", - "description": "Adjusts the contrast of the input." - }, - { - "name": "drop-shadow()", - "description": "Applies a drop shadow effect to the input image." - }, - { - "name": "grayscale()", - "description": "Converts the input image to grayscale." - }, - { - "name": "hue-rotate()", - "description": "Applies a hue rotation on the input image. " - }, - { - "name": "invert()", - "description": "Inverts the samples in the input image." - }, - { - "name": "opacity()", - "description": "Applies transparency to the samples in the input image." - }, - { - "name": "saturate()", - "description": "Saturates the input image." - }, - { - "name": "sepia()", - "description": "Converts the input image to sepia." - }, - { - "name": "url()", - "browsers": [ - "E12", - "FF35", - "S9.1", - "C53", - "O40" - ], - "description": "A filter reference to a element." - } - ], - "syntax": "none | ", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/filter" - } - ], - "description": "Processes an element’s rendering before it is displayed in the document, by applying one or more filter effects.", - "restrictions": [ - "enum", - "url" - ] + 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; }, - { - "name": "src", - "values": [ - { - "name": "url()", - "description": "Reference font by URL" - }, - { - "name": "format()", - "description": "Optional hint describing the format of the font resource." - }, - { - "name": "local()", - "description": "Format-specific string that identifies a locally available copy of a given font." - } - ], - "syntax": "[ [ format( # ) ]? | local( ) ]#", - "description": "@font-face descriptor. Specifies the resource containing font data. It is required, whether the font is downloadable or locally installed.", - "restrictions": [ - "enum", - "url", - "identifier" - ] + 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; }, - { - "name": "animation-timing-function", - "syntax": "#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/animation-timing-function" + 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; +}()); + + + +/***/ }), +/* 66 */ +/***/ ((__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; +} + + +/***/ }), +/* 67 */ +/***/ ((__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__(68); +/*--------------------------------------------------------------------------------------------- + * 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")), +}; + + +/***/ }), +/* 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.config = exports.loadMessageBundle = void 0; +var path = __webpack_require__(3); +var fs = __webpack_require__(54); +var ral_1 = __webpack_require__(69); +var common_1 = __webpack_require__(70); +var common_2 = __webpack_require__(70); +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; } - ], - "description": "Describes how the animation will progress over one cycle of its duration.", - "restrictions": [ - "timing-function" - ] - }, - { - "name": "border-right-color", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-right-color" + } + 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); + }); + } + }); + } } - ], - "description": "Sets the color of the right border.", - "restrictions": [ - "color" - ] - }, - { - "name": "font-variant", - "values": [ - { - "name": "normal", - "description": "Specifies a face that is not labeled as a small-caps font." - }, - { - "name": "small-caps", - "description": "Specifies a font that is labeled as a small-caps font. If a genuine small-caps font is not available, user agents should simulate a small-caps font." + } + } + 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; } - ], - "syntax": "normal | none | [ || || || || stylistic() || historical-forms || styleset(#) || character-variant(#) || swash() || ornaments() || annotation() || [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] || || || || ordinal || slashed-zero || || || ruby ]", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/font-variant" - } - ], - "description": "Specifies variant representations of the font", - "restrictions": [ - "enum" - ] - }, - { - "name": "border-left-color", - "syntax": "", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/border-left-color" - } - ], - "description": "Sets the color of the left border.", - "restrictions": [ - "color" - ] - }, - { - "name": "animation-name", - "values": [ - { - "name": "none", - "description": "No animation is performed" - } - ], - "syntax": "[ none | ]#", - "references": [ - { - "name": "MDN Reference", - "url": "https://developer.mozilla.org/docs/Web/CSS/animation-name" - } - ], - "description": "Defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation.", - "restrictions": [ - "identifier", - "enum" - ] - }, - { - "name": "animation-duration", - "syntax": "