(function(e, a) { for(var i in a) e[i] = a[i]; if(a.__esModule) Object.defineProperty(e, "__esModule", { value: true }); }(exports, /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ /* 0 */, /* 1 */, /* 2 */, /* 3 */ /***/ ((module) => { module.exports = require("path");; /***/ }), /* 4 */, /* 5 */, /* 6 */, /* 7 */, /* 8 */, /* 9 */, /* 10 */, /* 11 */, /* 12 */, /* 13 */, /* 14 */ /***/ ((module) => { module.exports = require("os");; /***/ }), /* 15 */ /***/ ((module) => { module.exports = require("crypto");; /***/ }), /* 16 */ /***/ ((module) => { module.exports = require("net");; /***/ }), /* 17 */, /* 18 */, /* 19 */, /* 20 */, /* 21 */, /* 22 */, /* 23 */, /* 24 */, /* 25 */, /* 26 */, /* 27 */, /* 28 */, /* 29 */, /* 30 */, /* 31 */, /* 32 */, /* 33 */, /* 34 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", ({ value: true })); const node_1 = __webpack_require__(35); const runner_1 = __webpack_require__(85); const cssServer_1 = __webpack_require__(86); const nodeFs_1 = __webpack_require__(136); // 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)); }); cssServer_1.startServer(connection, { file: nodeFs_1.getNodeFSRequestService() }); /***/ }), /* 35 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ----------------------------------------------------------------------------------------- */ module.exports = __webpack_require__(36); /***/ }), /* 36 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ /// 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__(37); const server_1 = __webpack_require__(38); const fm = __webpack_require__(78); const node_1 = __webpack_require__(82); __export(__webpack_require__(83)); 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(); const watchDog = { initialize: (params) => { const processId = params.processId; if (Is.number(processId) && exitTimer === undefined) { // We received a parent process id. Set up a timer to periodically check // if the parent is still alive. setInterval(() => { try { process.kill(processId, 0); } catch (ex) { // Parent process doesn't exist anymore. Exit the server. process.exit(_shutdownReceived ? 0 : 1); } }, 3000); } }, get shutdownReceived() { return _shutdownReceived; }, set shutdownReceived(value) { _shutdownReceived = value; }, exit: (code) => { process.exit(code); } }; function createConnection(arg1, arg2, arg3, arg4) { let factories; let input; let output; let options; if (arg1 !== void 0 && arg1.__brand === 'features') { factories = arg1; arg1 = arg2; arg2 = arg3; arg3 = arg4; } if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) { options = arg1; } else { input = arg1; output = arg2; options = arg3; } return _createConnection(input, output, options, factories); } exports.createConnection = createConnection; function _createConnection(input, output, options, factories) { if (!input && !output && process.argv.length > 2) { let port = void 0; let pipeName = void 0; let argv = process.argv.slice(2); for (let i = 0; i < argv.length; i++) { let arg = argv[i]; if (arg === '--node-ipc') { input = new node_1.IPCMessageReader(process); output = new node_1.IPCMessageWriter(process); break; } else if (arg === '--stdio') { input = process.stdin; output = process.stdout; break; } else if (arg === '--socket') { port = parseInt(argv[i + 1]); break; } else if (arg === '--pipe') { pipeName = argv[i + 1]; break; } else { var args = arg.split('='); if (args[0] === '--socket') { port = parseInt(args[1]); break; } else if (args[0] === '--pipe') { pipeName = args[1]; break; } } } if (port) { let transport = node_1.createServerSocketTransport(port); input = transport[0]; output = transport[1]; } else if (pipeName) { let transport = node_1.createServerPipeTransport(pipeName); input = transport[0]; output = transport[1]; } } var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\''; if (!input) { throw new Error('Connection input stream is not set. ' + commandLineMessage); } if (!output) { throw new Error('Connection output stream is not set. ' + commandLineMessage); } // Backwards compatibility if (Is.func(input.read) && Is.func(input.on)) { let inputStream = input; inputStream.on('end', () => { 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 server_1.createConnection(connectionFactory, watchDog, factories); } //# sourceMappingURL=main.js.map /***/ }), /* 37 */ /***/ ((__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 })); 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 /***/ }), /* 38 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const vscode_languageserver_protocol_1 = __webpack_require__(39); const Is = __webpack_require__(37); const UUID = __webpack_require__(73); const progress_1 = __webpack_require__(74); const configuration_1 = __webpack_require__(75); const workspaceFolders_1 = __webpack_require__(76); const callHierarchy_1 = __webpack_require__(77); function null2Undefined(value) { if (value === null) { return undefined; } return value; } /** * A manager for simple text documents */ class TextDocuments { /** * Create a new text document manager. */ constructor(configuration) { this._documents = Object.create(null); this._configuration = configuration; this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter(); this._onDidOpen = new vscode_languageserver_protocol_1.Emitter(); this._onDidClose = new vscode_languageserver_protocol_1.Emitter(); this._onDidSave = new vscode_languageserver_protocol_1.Emitter(); this._onWillSave = new vscode_languageserver_protocol_1.Emitter(); } /** * An event that fires when a text document managed by this manager * has been opened or the content changes. */ get onDidChangeContent() { return this._onDidChangeContent.event; } /** * An event that fires when a text document managed by this manager * has been opened. */ get onDidOpen() { return this._onDidOpen.event; } /** * An event that fires when a text document managed by this manager * will be saved. */ get onWillSave() { return this._onWillSave.event; } /** * Sets a handler that will be called if a participant wants to provide * edits during a text document save. */ onWillSaveWaitUntil(handler) { this._willSaveWaitUntil = handler; } /** * An event that fires when a text document managed by this manager * has been saved. */ get onDidSave() { return this._onDidSave.event; } /** * An event that fires when a text document managed by this manager * has been closed. */ get onDidClose() { return this._onDidClose.event; } /** * Returns the document for the given URI. Returns undefined if * the document is not 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; } 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 TracerImpl { constructor() { this._trace = vscode_languageserver_protocol_1.Trace.Off; } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } set trace(value) { this._trace = value; } log(message, verbose) { if (this._trace === vscode_languageserver_protocol_1.Trace.Off) { return; } this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, { message: message, verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined }); } } class TelemetryImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } logEvent(data) { this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data); } } class _LanguagesImpl { constructor() { } attach(connection) { this._connection = connection; } get connection() { if (!this._connection) { throw new Error('Remote is not attached to a connection yet.'); } return this._connection; } initialize(_capabilities) { } fillServerCapabilities(_capabilities) { } attachWorkDoneProgress(params) { return progress_1.attachWorkDone(this.connection, params); } attachPartialResultProgress(_type, params) { return progress_1.attachPartialResult(this.connection, params); } } exports._LanguagesImpl = _LanguagesImpl; const LanguagesImpl = 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 /***/ }), /* 39 */ /***/ ((__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 })); const node_1 = __webpack_require__(40); __export(__webpack_require__(40)); __export(__webpack_require__(56)); function createProtocolConnection(input, output, logger, options) { return node_1.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; //# sourceMappingURL=main.js.map /***/ }), /* 40 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ----------------------------------------------------------------------------------------- */ module.exports = __webpack_require__(41); /***/ }), /* 41 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { 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__(42); // Install the node runtime abstract. ril_1.default.install(); const api_1 = __webpack_require__(46); const path = __webpack_require__(3); const os = __webpack_require__(14); const crypto_1 = __webpack_require__(15); const net_1 = __webpack_require__(16); __export(__webpack_require__(46)); class IPCMessageReader extends api_1.AbstractMessageReader { constructor(process) { super(); this.process = process; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose()); } listen(callback) { this.process.on('message', callback); return api_1.Disposable.create(() => this.process.off('message', callback)); } } exports.IPCMessageReader = IPCMessageReader; class IPCMessageWriter extends api_1.AbstractMessageWriter { constructor(process) { super(); this.process = process; this.errorCount = 0; let eventEmitter = this.process; eventEmitter.on('error', (error) => this.fireError(error)); eventEmitter.on('close', () => this.fireClose); } write(msg) { try { if (typeof this.process.send === 'function') { this.process.send(msg, undefined, undefined, (error) => { if (error) { this.errorCount++; this.handleError(error, msg); } else { this.errorCount = 0; } }); } return Promise.resolve(); } catch (error) { this.handleError(error, msg); return Promise.reject(error); } } handleError(error, msg) { this.errorCount++; this.fireError(error, msg, this.errorCount); } } exports.IPCMessageWriter = IPCMessageWriter; class SocketMessageReader extends api_1.ReadableStreamMessageReader { constructor(socket, encoding = 'utf-8') { super(ril_1.default().stream.asReadableStream(socket), encoding); } } exports.SocketMessageReader = SocketMessageReader; class SocketMessageWriter extends api_1.WriteableStreamMessageWriter { constructor(socket, options) { super(ril_1.default().stream.asWritableStream(socket), options); this.socket = socket; } dispose() { super.dispose(); this.socket.destroy(); } } exports.SocketMessageWriter = SocketMessageWriter; class StreamMessageReader extends api_1.ReadableStreamMessageReader { constructor(readble, encoding) { super(ril_1.default().stream.asReadableStream(readble), encoding); } } exports.StreamMessageReader = StreamMessageReader; class StreamMessageWriter extends api_1.WriteableStreamMessageWriter { constructor(writable, options) { super(ril_1.default().stream.asWritableStream(writable), options); } } exports.StreamMessageWriter = StreamMessageWriter; 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; } }); }); }); } 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 /***/ }), /* 42 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const ral_1 = __webpack_require__(43); const disposable_1 = __webpack_require__(44); const util_1 = __webpack_require__(45); 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); } else { toAppend = chunk; } if (this.buffer.length - this.index >= toAppend.length) { this.buffer.set(toAppend, this.index); } 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); } else { this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize); } } 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++; } // No header / body separator found (e.g CRLFCRLF) if (current + 3 >= this.index) { return undefined; } 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; } 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(); } else { reject(error); } }; if (typeof data === 'string') { this.stream.write(data, encoding, callback); } else { this.stream.write(data, callback); } }); } end() { this.stream.end(); } } const _ril = Object.freeze({ messageBuffer: Object.freeze({ create: (encoding) => new MessageBuffer(encoding) }), applicationJson: Object.freeze({ encoder: Object.freeze({ name: 'application/json', encode: (msg, options) => { 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))); } 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); } }) }); function RIL() { return _ril; } (function (RIL) { function install() { ral_1.default.install(_ril); } RIL.install = install; })(RIL || (RIL = {})); exports.default = RIL; //# sourceMappingURL=ril.js.map /***/ }), /* 43 */ /***/ ((__unused_webpack_module, exports) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); let _ral; function RAL() { if (_ral === undefined) { throw new Error(`No runtime abstraction layer installed`); } return _ral; } (function (RAL) { function install(ral) { if (ral === undefined) { throw new Error(`No runtime abstraction layer provided`); } _ral = ral; } RAL.install = install; })(RAL || (RAL = {})); exports.default = RAL; //# sourceMappingURL=ral.js.map /***/ }), /* 44 */ /***/ ((__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 Disposable; (function (Disposable) { function create(func) { return { dispose: func }; } Disposable.create = create; })(Disposable = exports.Disposable || (exports.Disposable = {})); //# sourceMappingURL=disposable.js.map /***/ }), /* 45 */ /***/ ((module) => { module.exports = require("util");; /***/ }), /* 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 messages_1 = __webpack_require__(47); 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__(44); exports.Disposable = disposable_1.Disposable; const events_1 = __webpack_require__(49); exports.Event = events_1.Event; exports.Emitter = events_1.Emitter; const cancellation_1 = __webpack_require__(50); exports.CancellationTokenSource = cancellation_1.CancellationTokenSource; exports.CancellationToken = cancellation_1.CancellationToken; const messageReader_1 = __webpack_require__(51); exports.MessageReader = messageReader_1.MessageReader; exports.AbstractMessageReader = messageReader_1.AbstractMessageReader; exports.ReadableStreamMessageReader = messageReader_1.ReadableStreamMessageReader; const messageWriter_1 = __webpack_require__(52); exports.MessageWriter = messageWriter_1.MessageWriter; exports.AbstractMessageWriter = messageWriter_1.AbstractMessageWriter; exports.WriteableStreamMessageWriter = messageWriter_1.WriteableStreamMessageWriter; const connection_1 = __webpack_require__(54); 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__(43); exports.RAL = ral_1.default; //# sourceMappingURL=api.js.map /***/ }), /* 47 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const is = __webpack_require__(48); /** * 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 /***/ }), /* 48 */ /***/ ((__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 })); 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 /***/ }), /* 49 */ /***/ ((__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__(43); 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 /***/ }), /* 50 */ /***/ ((__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__(43); const Is = __webpack_require__(48); const events_1 = __webpack_require__(49); 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 /***/ }), /* 51 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const ral_1 = __webpack_require__(43); const Is = __webpack_require__(48); const events_1 = __webpack_require__(49); var MessageReader; (function (MessageReader) { function is(value) { let candidate = value; return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage); } MessageReader.is = is; })(MessageReader = exports.MessageReader || (exports.MessageReader = {})); class AbstractMessageReader { constructor() { this.errorEmitter = new events_1.Emitter(); this.closeEmitter = new events_1.Emitter(); this.partialMessageEmitter = new events_1.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error) { this.errorEmitter.fire(this.asError(error)); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } get onPartialMessage() { return this.partialMessageEmitter.event; } firePartialMessage(info) { this.partialMessageEmitter.fire(info); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageReader = AbstractMessageReader; var ResolvedMessageReaderOptions; (function (ResolvedMessageReaderOptions) { function fromOptions(options) { var _a; let charset; let result; let contentDecoder; const contentDecoders = new Map(); let contentTypeDecoder; const contentTypeDecoders = new Map(); if (options === undefined || typeof options === 'string') { charset = options !== null && options !== void 0 ? options : 'utf-8'; } else { charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8'; if (options.contentDecoder !== undefined) { contentDecoder = options.contentDecoder; contentDecoders.set(contentDecoder.name, contentDecoder); } if (options.contentDecoders !== undefined) { for (const decoder of options.contentDecoders) { contentDecoders.set(decoder.name, decoder); } } if (options.contentTypeDecoder !== undefined) { contentTypeDecoder = options.contentTypeDecoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } if (options.contentTypeDecoders !== undefined) { for (const decoder of options.contentTypeDecoders) { contentTypeDecoders.set(decoder.name, decoder); } } } if (contentTypeDecoder === undefined) { contentTypeDecoder = ral_1.default().applicationJson.decoder; contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); } return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; } ResolvedMessageReaderOptions.fromOptions = fromOptions; })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); class ReadableStreamMessageReader extends AbstractMessageReader { constructor(readable, options) { super(); this.readable = readable; this.options = ResolvedMessageReaderOptions.fromOptions(options); this.buffer = ral_1.default().messageBuffer.create(this.options.charset); this._partialMessageTimeout = 10000; this.nextMessageLength = -1; this.messageToken = 0; } set partialMessageTimeout(timeout) { this._partialMessageTimeout = timeout; } get partialMessageTimeout() { return this._partialMessageTimeout; } listen(callback) { this.nextMessageLength = -1; this.messageToken = 0; this.partialMessageTimer = undefined; this.callback = callback; const result = this.readable.onData((data) => { this.onData(data); }); this.readable.onError((error) => this.fireError(error)); this.readable.onClose(() => this.fireClose()); return result; } onData(data) { this.buffer.append(data); while (true) { if (this.nextMessageLength === -1) { const headers = this.buffer.tryReadHeaders(); if (!headers) { return; } const contentLength = headers.get('Content-Length'); if (!contentLength) { throw new Error('Header must provide a Content-Length property.'); } const length = parseInt(contentLength); if (isNaN(length)) { throw new Error('Content-Length value must be a number.'); } this.nextMessageLength = length; } const body = this.buffer.tryReadBody(this.nextMessageLength); if (body === undefined) { /** We haven't received the full message yet. */ this.setPartialMessageTimer(); return; } this.clearPartialMessageTimer(); this.nextMessageLength = -1; let p; if (this.options.contentDecoder !== undefined) { p = this.options.contentDecoder.decode(body); } else { p = Promise.resolve(body); } p.then((value) => { this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { this.callback(msg); }, (error) => { this.fireError(error); }); }, (error) => { this.fireError(error); }); } } clearPartialMessageTimer() { if (this.partialMessageTimer) { ral_1.default().timer.clearTimeout(this.partialMessageTimer); this.partialMessageTimer = undefined; } } setPartialMessageTimer() { this.clearPartialMessageTimer(); if (this._partialMessageTimeout <= 0) { return; } this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => { this.partialMessageTimer = undefined; if (token === this.messageToken) { this.firePartialMessage({ messageToken: token, waitingTime: timeout }); this.setPartialMessageTimer(); } }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); } } exports.ReadableStreamMessageReader = ReadableStreamMessageReader; //# sourceMappingURL=messageReader.js.map /***/ }), /* 52 */ /***/ ((__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__(43); const Is = __webpack_require__(48); const semaphore_1 = __webpack_require__(53); const events_1 = __webpack_require__(49); const ContentLength = 'Content-Length: '; const CRLF = '\r\n'; var MessageWriter; (function (MessageWriter) { function is(value) { let candidate = value; return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && Is.func(candidate.onError) && Is.func(candidate.write); } MessageWriter.is = is; })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {})); class AbstractMessageWriter { constructor() { this.errorEmitter = new events_1.Emitter(); this.closeEmitter = new events_1.Emitter(); } dispose() { this.errorEmitter.dispose(); this.closeEmitter.dispose(); } get onError() { return this.errorEmitter.event; } fireError(error, message, count) { this.errorEmitter.fire([this.asError(error), message, count]); } get onClose() { return this.closeEmitter.event; } fireClose() { this.closeEmitter.fire(undefined); } asError(error) { if (error instanceof Error) { return error; } else { return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); } } } exports.AbstractMessageWriter = AbstractMessageWriter; var ResolvedMessageWriterOptions; (function (ResolvedMessageWriterOptions) { function fromOptions(options) { var _a, _b; if (options === undefined || typeof options === 'string') { return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder }; } else { return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder }; } } ResolvedMessageWriterOptions.fromOptions = fromOptions; })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); class WriteableStreamMessageWriter extends AbstractMessageWriter { constructor(writable, options) { super(); this.writable = writable; this.options = ResolvedMessageWriterOptions.fromOptions(options); this.errorCount = 0; this.writeSemaphore = new semaphore_1.Semaphore(1); this.writable.onError((error) => this.fireError(error)); this.writable.onClose(() => this.fireClose()); } async write(msg) { 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 /***/ }), /* 53 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const ral_1 = __webpack_require__(43); class Semaphore { constructor(capacity = 1) { if (capacity <= 0) { throw new Error('Capacity must be greater than 0'); } this._capacity = capacity; this._active = 0; this._waiting = []; } lock(thunk) { return new Promise((resolve, reject) => { this._waiting.push({ thunk, resolve, reject }); this.runNext(); }); } get active() { return this._active; } runNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } ral_1.default().timer.setImmediate(() => this.doRunNext()); } doRunNext() { if (this._waiting.length === 0 || this._active === this._capacity) { return; } const next = this._waiting.shift(); this._active++; if (this._active > this._capacity) { throw new Error(`To many thunks active`); } try { const result = next.thunk(); if (result instanceof Promise) { result.then((value) => { this._active--; next.resolve(value); this.runNext(); }, (err) => { this._active--; next.reject(err); this.runNext(); }); } else { this._active--; next.resolve(result); this.runNext(); } } catch (err) { this._active--; next.reject(err); this.runNext(); } } } exports.Semaphore = Semaphore; //# sourceMappingURL=semaphore.js.map /***/ }), /* 54 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const ral_1 = __webpack_require__(43); const Is = __webpack_require__(48); const messages_1 = __webpack_require__(47); const linkedMap_1 = __webpack_require__(55); const events_1 = __webpack_require__(49); const cancellation_1 = __webpack_require__(50); 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) { const candidate = value; return candidate && Is.func(candidate.cancelUndispatched); } ConnectionStrategy.is = is; })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); var CancellationReceiverStrategy; (function (CancellationReceiverStrategy) { CancellationReceiverStrategy.Message = Object.freeze({ createCancellationTokenSource(_) { return new cancellation_1.CancellationTokenSource(); } }); function is(value) { const candidate = value; return candidate && Is.func(candidate.createCancellationTokenSource); } CancellationReceiverStrategy.is = is; })(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {})); var CancellationSenderStrategy; (function (CancellationSenderStrategy) { CancellationSenderStrategy.Message = Object.freeze({ sendCancellation(conn, id) { conn.sendNotification(CancelNotification.type, { id }); }, cleanup(_) { } }); function is(value) { const candidate = value; return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup); } CancellationSenderStrategy.is = is; })(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {})); var CancellationStrategy; (function (CancellationStrategy) { CancellationStrategy.Message = Object.freeze({ receiver: CancellationReceiverStrategy.Message, sender: CancellationSenderStrategy.Message }); function is(value) { const candidate = value; return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); } CancellationStrategy.is = is; })(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {})); var ConnectionOptions; (function (ConnectionOptions) { function is(value) { const candidate = value; return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); } ConnectionOptions.is = is; })(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {})); var ConnectionState; (function (ConnectionState) { ConnectionState[ConnectionState["New"] = 1] = "New"; ConnectionState[ConnectionState["Listening"] = 2] = "Listening"; ConnectionState[ConnectionState["Closed"] = 3] = "Closed"; ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed"; })(ConnectionState || (ConnectionState = {})); function createMessageConnection(messageReader, messageWriter, _logger, options) { const logger = _logger !== undefined ? _logger : exports.NullLogger; let sequenceNumber = 0; let notificationSquenceNumber = 0; let unknownResponseSquenceNumber = 0; const version = '2.0'; let starRequestHandler = undefined; const requestHandlers = Object.create(null); let starNotificationHandler = undefined; const notificationHandlers = Object.create(null); const progressHandlers = new Map(); let timer; let messageQueue = new linkedMap_1.LinkedMap(); let responsePromises = Object.create(null); let requestTokens = Object.create(null); let trace = Trace.Off; let traceFormat = TraceFormat.Text; let tracer; let state = ConnectionState.New; const errorEmitter = new events_1.Emitter(); const closeEmitter = new events_1.Emitter(); const unhandledNotificationEmitter = new events_1.Emitter(); const unhandledProgressEmitter = new events_1.Emitter(); const disposeEmitter = new events_1.Emitter(); const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message; function createRequestQueueKey(id) { return 'req-' + id.toString(); } function createResponseQueueKey(id) { if (id === null) { return 'res-unknown-' + (++unknownResponseSquenceNumber).toString(); } else { return 'res-' + id.toString(); } } function createNotificationQueueKey() { return 'not-' + (++notificationSquenceNumber).toString(); } function addMessageToQueue(queue, message) { if (messages_1.isRequestMessage(message)) { queue.set(createRequestQueueKey(message.id), message); } else if (messages_1.isResponseMessage(message)) { queue.set(createResponseQueueKey(message.id), message); } else { queue.set(createNotificationQueueKey(), message); } } function cancelUndispatched(_message) { return undefined; } function isListening() { return state === ConnectionState.Listening; } function isClosed() { return state === ConnectionState.Closed; } function isDisposed() { return state === ConnectionState.Disposed; } function closeHandler() { if (state === ConnectionState.New || state === ConnectionState.Listening) { state = ConnectionState.Closed; closeEmitter.fire(undefined); } // If the connection is disposed don't sent close events. } function readErrorHandler(error) { errorEmitter.fire([error, undefined, undefined]); } function writeErrorHandler(data) { errorEmitter.fire(data); } messageReader.onClose(closeHandler); messageReader.onError(readErrorHandler); messageWriter.onClose(closeHandler); messageWriter.onError(writeErrorHandler); function triggerMessageQueue() { if (timer || messageQueue.size === 0) { return; } timer = ral_1.default().timer.setImmediate(() => { timer = undefined; processMessageQueue(); }); } function processMessageQueue() { if (messageQueue.size === 0) { return; } const message = messageQueue.shift(); try { if (messages_1.isRequestMessage(message)) { handleRequest(message); } else if (messages_1.isNotificationMessage(message)) { handleNotification(message); } else if (messages_1.isResponseMessage(message)) { handleResponse(message); } else { handleInvalidMessage(message); } } finally { triggerMessageQueue(); } } const callback = (message) => { try { // We have received a cancellation message. Check if the message is still in the queue // and cancel it if allowed to do so. if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) { const key = createRequestQueueKey(message.params.id); const toCancel = messageQueue.get(key); if (messages_1.isRequestMessage(toCancel)) { const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy; const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); if (response && (response.error !== undefined || response.result !== undefined)) { messageQueue.delete(key); response.id = toCancel.id; traceSendingResponse(response, message.method, Date.now()); messageWriter.write(response); return; } } } addMessageToQueue(messageQueue, message); } finally { triggerMessageQueue(); } }; function handleRequest(requestMessage) { if (isDisposed()) { // we return here silently since we fired an event when the // connection got disposed. return; } function reply(resultOrError, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id }; if (resultOrError instanceof messages_1.ResponseError) { message.error = resultOrError.toJson(); } else { message.result = resultOrError === undefined ? null : resultOrError; } traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replyError(error, method, startTime) { const message = { jsonrpc: version, id: requestMessage.id, error: error.toJson() }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } function replySuccess(result, method, startTime) { // The JSON RPC defines that a response must either have a result or an error // So we can't treat undefined as a valid response result. if (result === undefined) { result = null; } const message = { jsonrpc: version, id: requestMessage.id, result: result }; traceSendingResponse(message, method, startTime); messageWriter.write(message); } traceReceivedRequest(requestMessage); const element = requestHandlers[requestMessage.method]; let type; let requestHandler; if (element) { type = element.type; requestHandler = element.handler; } const startTime = Date.now(); if (requestHandler || starRequestHandler) { const tokenKey = String(requestMessage.id); const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); requestTokens[tokenKey] = cancellationSource; try { let handlerResult; if (requestMessage.params === undefined || (type !== undefined && type.numberOfParams === 0)) { handlerResult = requestHandler ? requestHandler(cancellationSource.token) : starRequestHandler(requestMessage.method, cancellationSource.token); } 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); } } catch (error) { delete requestTokens[tokenKey]; if (error instanceof messages_1.ResponseError) { reply(error, requestMessage.method, startTime); } else if (error && Is.string(error.message)) { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); } else { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); } } } else { replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); } } function handleResponse(responseMessage) { if (isDisposed()) { // See handle request. return; } if (responseMessage.id === null) { if (responseMessage.error) { logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`); } else { logger.error(`Received response message without id. No further error information provided.`); } } else { const key = String(responseMessage.id); const responsePromise = responsePromises[key]; traceReceivedResponse(responseMessage, responsePromise); if (responsePromise) { delete responsePromises[key]; try { if (responseMessage.error) { const error = responseMessage.error; responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); } else if (responseMessage.result !== undefined) { responsePromise.resolve(responseMessage.result); } else { throw new Error('Should never happen.'); } } catch (error) { if (error.message) { logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); } else { logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); } } } } } function handleNotification(message) { if (isDisposed()) { // See handle request. return; } let type = undefined; let notificationHandler; if (message.method === CancelNotification.type.method) { notificationHandler = (params) => { const id = params.id; const source = requestTokens[String(id)]; if (source) { source.cancel(); } }; } else { const element = notificationHandlers[message.method]; if (element) { notificationHandler = element.handler; type = element.type; } } if (notificationHandler || starNotificationHandler) { try { traceReceivedNotification(message); if (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); } } catch (error) { if (error.message) { logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); } else { logger.error(`Notification handler '${message.method}' failed unexpectedly.`); } } } else { unhandledNotificationEmitter.fire(message); } } function handleInvalidMessage(message) { if (!message) { logger.error('Received empty message.'); return; } logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`); // Test whether we find an id to reject the promise const responseMessage = message; if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) { const key = String(responseMessage.id); const responseHandler = responsePromises[key]; if (responseHandler) { responseHandler.reject(new Error('The received response has neither a result nor an error property.')); } } } function traceSendingRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('send-request', message); } } function traceSendingNotification(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Sending notification '${message.method}'.`, data); } else { logLSPMessage('send-notification', message); } } function traceSendingResponse(message, method, startTime) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); } else { logLSPMessage('send-response', message); } } function traceReceivedRequest(message) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose && message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } tracer.log(`Received request '${message.method} - (${message.id})'.`, data); } else { logLSPMessage('receive-request', message); } } function traceReceivedNotification(message) { if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.params) { data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; } else { data = 'No parameters provided.\n\n'; } } tracer.log(`Received notification '${message.method}'.`, data); } else { logLSPMessage('receive-notification', message); } } function traceReceivedResponse(message, responsePromise) { if (trace === Trace.Off || !tracer) { return; } if (traceFormat === TraceFormat.Text) { let data = undefined; if (trace === Trace.Verbose) { if (message.error && message.error.data) { data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; } else { if (message.result) { data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; } else if (message.error === undefined) { data = 'No result returned.\n\n'; } } } if (responsePromise) { const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ''; tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); } else { tracer.log(`Received response ${message.id} without active response promise.`, data); } } else { logLSPMessage('receive-response', message); } } function logLSPMessage(type, message) { if (!tracer || trace === Trace.Off) { return; } const lspMessage = { isLSPMessage: true, type, message, timestamp: Date.now() }; tracer.log(lspMessage); } function throwIfClosedOrDisposed() { if (isClosed()) { throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); } if (isDisposed()) { throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); } } function throwIfListening() { if (isListening()) { throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); } } function throwIfNotListening() { if (!isListening()) { throw new Error('Call listen() first.'); } } function undefinedToNull(param) { if (param === undefined) { return null; } else { return param; } } function 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 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; } } else { method = type.method; messageParams = computeMessageParams(type, params); } const 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); const numberOfParams = type.numberOfParams; token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; } const id = sequenceNumber++; let disposable; if (token) { disposable = token.onCancellationRequested(() => { cancellationStrategy.sender.sendCancellation(connection, id); }); } const result = new Promise((resolve, reject) => { const requestMessage = { jsonrpc: version, id: id, method: method, params: messageParams }; const resolveWithCleanup = (r) => { resolve(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; const rejectWithCleanup = (r) => { reject(r); cancellationStrategy.sender.cleanup(id); disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); }; let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; traceSendingRequest(requestMessage); try { messageWriter.write(requestMessage); } catch (e) { // Writing the message failed. So we need to reject the promise. responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason')); responsePromise = null; } if (responsePromise) { responsePromises[String(id)] = responsePromise; } }); return result; }, onRequest: (type, handler) => { throwIfClosedOrDisposed(); 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 !== undefined) { if (Is.boolean(sendNotificationOrTraceOptions)) { _sendNotification = sendNotificationOrTraceOptions; } else { _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; } } trace = _value; traceFormat = _traceFormat; if (trace === Trace.Off) { tracer = undefined; } else { tracer = _tracer; } if (_sendNotification && !isClosed() && !isDisposed()) { connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); } }, onError: errorEmitter.event, onClose: closeEmitter.event, onUnhandledNotification: unhandledNotificationEmitter.event, onDispose: disposeEmitter.event, dispose: () => { if (isDisposed()) { return; } state = ConnectionState.Disposed; disposeEmitter.fire(undefined); const error = new Error('Connection got disposed.'); Object.keys(responsePromises).forEach((key) => { responsePromises[key].reject(error); }); responsePromises = Object.create(null); requestTokens = Object.create(null); messageQueue = new linkedMap_1.LinkedMap(); // Test for backwards compatibility if (Is.func(messageWriter.dispose)) { messageWriter.dispose(); } if (Is.func(messageReader.dispose)) { messageReader.dispose(); } }, listen: () => { throwIfClosedOrDisposed(); throwIfListening(); state = ConnectionState.Listening; messageReader.listen(callback); }, inspect: () => { // eslint-disable-next-line no-console ral_1.default().console.log('inspect'); } }; connection.onNotification(LogTraceNotification.type, (params) => { if (trace === Trace.Off || !tracer) { return; } tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); }); connection.onNotification(ProgressNotification.type, (params) => { const handler = progressHandlers.get(params.token); if (handler) { handler(params.value); } else { unhandledProgressEmitter.fire(params); } }); return connection; } exports.createMessageConnection = createMessageConnection; //# sourceMappingURL=connection.js.map /***/ }), /* 55 */ /***/ ((__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; } if (touch !== Touch.None) { this.touch(item, touch); } return item.value; } set(key, value, touch = Touch.None) { let item = this._map.get(key); if (item) { item.value = value; if (touch !== Touch.None) { this.touch(item, touch); } } else { item = { key, value, next: undefined, previous: undefined }; switch (touch) { case Touch.None: this.addItemLast(item); break; case Touch.First: this.addItemFirst(item); break; case Touch.Last: this.addItemLast(item); break; default: this.addItemLast(item); break; } this._map.set(key, item); this._size++; } return this; } delete(key) { return !!this.remove(key); } remove(key) { const item = this._map.get(key); if (!item) { return undefined; } this._map.delete(key); this.removeItem(item); this._size--; return item.value; } shift() { if (!this._head && !this._tail) { return undefined; } if (!this._head || !this._tail) { throw new Error('Invalid list'); } const item = this._head; this._map.delete(item.key); this.removeItem(item); this._size--; return item.value; } forEach(callbackfn, thisArg) { const state = this._state; let current = this._head; while (current) { if (thisArg) { callbackfn.bind(thisArg)(current.value, current.key, this); } else { callbackfn(current.value, current.key, this); } if (this._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } current = current.next; } } keys() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.key, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } values() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: current.value, done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } entries() { const map = this; const state = this._state; let current = this._head; const iterator = { [Symbol.iterator]() { return iterator; }, next() { if (map._state !== state) { throw new Error(`LinkedMap got modified during iteration.`); } if (current) { const result = { value: [current.key, current.value], done: false }; current = current.next; return result; } else { return { value: undefined, done: true }; } } }; return iterator; } [Symbol.iterator]() { return this.entries(); } trimOld(newSize) { if (newSize >= this.size) { return; } if (newSize === 0) { this.clear(); return; } let current = this._head; let currentSize = this.size; while (current && currentSize > newSize) { this._map.delete(current.key); current = current.next; currentSize--; } this._head = current; this._size = currentSize; if (current) { current.previous = undefined; } this._state++; } addItemFirst(item) { // First time Insert if (!this._head && !this._tail) { this._tail = item; } else if (!this._head) { throw new Error('Invalid list'); } else { item.next = this._head; this._head.previous = item; } this._head = item; this._state++; } addItemLast(item) { // First time Insert if (!this._head && !this._tail) { this._head = item; } else if (!this._tail) { throw new Error('Invalid list'); } else { item.previous = this._tail; this._tail.next = item; } this._tail = item; this._state++; } removeItem(item) { if (item === this._head && item === this._tail) { this._head = undefined; this._tail = undefined; } else if (item === this._head) { // This can only happend if size === 1 which is handle // by the case above. if (!item.next) { throw new Error('Invalid list'); } item.next.previous = undefined; this._head = item.next; } else if (item === this._tail) { // This can only happend if size === 1 which is handle // by the case above. if (!item.previous) { throw new Error('Invalid list'); } item.previous.next = undefined; this._tail = item.previous; } else { const next = item.next; const previous = item.previous; if (!next || !previous) { throw new Error('Invalid list'); } next.previous = previous; previous.next = next; } item.next = undefined; item.previous = undefined; this._state++; } touch(item, touch) { if (!this._head || !this._tail) { throw new Error('Invalid list'); } if ((touch !== Touch.First && touch !== Touch.Last)) { return; } if (touch === Touch.First) { if (item === this._head) { return; } const next = item.next; const previous = item.previous; // Unlink the item if (item === this._tail) { // previous must be defined since item was not head but is tail // So there are more than on item in the map previous.next = undefined; this._tail = previous; } else { // Both next and previous are not undefined since item was neither head nor tail. next.previous = previous; previous.next = next; } // Insert the node at head item.previous = undefined; item.next = this._head; this._head.previous = item; this._head = item; this._state++; } else if (touch === Touch.Last) { if (item === this._tail) { return; } const next = item.next; const previous = item.previous; // Unlink the item. if (item === this._head) { // next must be defined since item was not tail but is head // So there are more than on item in the map next.previous = undefined; this._head = next; } else { // Both next and previous are not undefined since item was neither head nor tail. next.previous = previous; previous.next = next; } item.next = undefined; item.previous = this._tail; this._tail.next = item; this._tail = item; this._state++; } } toJSON() { const data = []; this.forEach((value, key) => { data.push([key, value]); }); return data; } fromJSON(data) { this.clear(); for (const [key, value] of data) { this.set(key, value); } } } exports.LinkedMap = LinkedMap; class LRUCache extends LinkedMap { constructor(limit, ratio = 1) { super(); this._limit = limit; this._ratio = Math.min(Math.max(0, ratio), 1); } get limit() { return this._limit; } set limit(limit) { this._limit = limit; this.checkTrim(); } get ratio() { return this._ratio; } set ratio(ratio) { this._ratio = Math.min(Math.max(0, ratio), 1); this.checkTrim(); } get(key, touch = Touch.AsNew) { return super.get(key, touch); } peek(key) { return super.get(key, Touch.None); } set(key, value) { super.set(key, value, Touch.Last); this.checkTrim(); return this; } checkTrim() { if (this.size > this._limit) { this.trimOld(Math.round(this._limit * this._ratio)); } } } exports.LRUCache = LRUCache; //# sourceMappingURL=linkedMap.js.map /***/ }), /* 56 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ 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__(41)); __export(__webpack_require__(57)); __export(__webpack_require__(58)); __export(__webpack_require__(59)); var connection_1 = __webpack_require__(71); exports.createProtocolConnection = connection_1.createProtocolConnection; const st = __webpack_require__(72); 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 /***/ }), /* 57 */ /***/ ((__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) }; } 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 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 (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 () { 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 { 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://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 } }; 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)) && (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 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 = {})); /***/ }), /* 58 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const vscode_jsonrpc_1 = __webpack_require__(41); 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; //# sourceMappingURL=messages.js.map /***/ }), /* 59 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const Is = __webpack_require__(60); const vscode_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); const protocol_implementation_1 = __webpack_require__(61); exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest; const protocol_typeDefinition_1 = __webpack_require__(62); exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest; const protocol_workspaceFolders_1 = __webpack_require__(63); exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest; exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; const protocol_configuration_1 = __webpack_require__(64); exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest; const protocol_colorProvider_1 = __webpack_require__(65); exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest; exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest; const protocol_foldingRange_1 = __webpack_require__(66); exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest; const protocol_declaration_1 = __webpack_require__(67); exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest; const protocol_selectionRange_1 = __webpack_require__(68); exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest; const protocol_progress_1 = __webpack_require__(69); exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress; exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest; exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification; const protocol_callHierarchy_1 = __webpack_require__(70); 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; } 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 = {})); //# sourceMappingURL=protocol.js.map /***/ }), /* 60 */ /***/ ((__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 })); 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 /***/ }), /* 61 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const vscode_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); // @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 /***/ }), /* 62 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const vscode_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); // @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 /***/ }), /* 63 */ /***/ ((__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 messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 64 */ /***/ ((__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 messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 65 */ /***/ ((__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_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 66 */ /***/ ((__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_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 67 */ /***/ ((__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_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); // @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 /***/ }), /* 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 })); const vscode_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 69 */ /***/ ((__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_jsonrpc_1 = __webpack_require__(41); const messages_1 = __webpack_require__(58); 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 /***/ }), /* 70 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) TypeFox and others. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 71 */ /***/ ((__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_jsonrpc_1 = __webpack_require__(41); function createProtocolConnection(input, output, logger, options) { if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) { options = { connectionStrategy: options }; } return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options); } exports.createProtocolConnection = createProtocolConnection; //# sourceMappingURL=connection.js.map /***/ }), /* 72 */ /***/ ((__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 messages_1 = __webpack_require__(58); /** * 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 /***/ }), /* 73 */ /***/ ((__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 })); 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 /***/ }), /* 74 */ /***/ ((__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__(39); const uuid_1 = __webpack_require__(73); 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 /***/ }), /* 75 */ /***/ ((__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__(39); const Is = __webpack_require__(37); 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 /***/ }), /* 76 */ /***/ ((__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__(39); 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 /***/ }), /* 77 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); const vscode_languageserver_protocol_1 = __webpack_require__(39); 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 /***/ }), /* 78 */ /***/ ((__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 url = __webpack_require__(79); const path = __webpack_require__(3); const fs = __webpack_require__(80); const child_process_1 = __webpack_require__(81); /** * @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 /***/ }), /* 79 */ /***/ ((module) => { module.exports = require("url");; /***/ }), /* 80 */ /***/ ((module) => { module.exports = require("fs");; /***/ }), /* 81 */ /***/ ((module) => { module.exports = require("child_process");; /***/ }), /* 82 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ----------------------------------------------------------------------------------------- */ module.exports = __webpack_require__(39); /***/ }), /* 83 */ /***/ ((__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 })); const st = __webpack_require__(84); __export(__webpack_require__(39)); __export(__webpack_require__(38)); var ProposedFeatures; (function (ProposedFeatures) { ProposedFeatures.all = { __brand: 'features', languages: st.SemanticTokensFeature }; ProposedFeatures.SemanticTokensBuilder = st.SemanticTokensBuilder; })(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {})); //# sourceMappingURL=api.js.map /***/ }), /* 84 */ /***/ ((__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__(39); 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 /***/ }), /* 85 */ /***/ ((__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.runSafeAsync = exports.formatError = void 0; const vscode_languageserver_1 = __webpack_require__(36); 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 runSafeAsync(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.runSafeAsync = runSafeAsync; function cancelValue() { return new vscode_languageserver_1.ResponseError(vscode_languageserver_1.ErrorCodes.RequestCancelled, 'Request cancelled'); } /***/ }), /* 86 */ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.startServer = void 0; const vscode_languageserver_1 = __webpack_require__(36); const vscode_uri_1 = __webpack_require__(87); const vscode_css_languageservice_1 = __webpack_require__(88); const languageModelCache_1 = __webpack_require__(131); const runner_1 = __webpack_require__(85); const documentContext_1 = __webpack_require__(132); const customData_1 = __webpack_require__(135); const requests_1 = __webpack_require__(134); var CustomDataChangedNotification; (function (CustomDataChangedNotification) { CustomDataChangedNotification.type = new vscode_languageserver_1.NotificationType('css/customDataChanged'); })(CustomDataChangedNotification || (CustomDataChangedNotification = {})); function startServer(connection, runtime) { // Create a text document manager. const documents = new vscode_languageserver_1.TextDocuments(vscode_css_languageservice_1.TextDocument); // Make the text document manager listen on the connection // for open, change and close text document events documents.listen(connection); const stylesheets = languageModelCache_1.getLanguageModelCache(10, 60, document => getLanguageService(document).parseStylesheet(document)); documents.onDidClose(e => { stylesheets.onDocumentRemoved(e.document); }); connection.onShutdown(() => { stylesheets.dispose(); }); let scopedSettingsSupport = false; let foldingRangeLimit = Number.MAX_VALUE; let workspaceFolders; let dataProvidersReady = Promise.resolve(); const languageServices = {}; const notReady = () => Promise.reject('Not Ready'); let requestService = { getContent: notReady, stat: notReady, readDirectory: notReady }; // 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) => { var _a; 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(((_a = params.initializationOptions) === null || _a === void 0 ? void 0 : _a.handledSchemas) || ['file'], connection, runtime); 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; } const snippetSupport = !!getClientCapability('textDocument.completion.completionItem.snippetSupport', false); scopedSettingsSupport = !!getClientCapability('workspace.configuration', false); foldingRangeLimit = getClientCapability('textDocument.foldingRange.rangeLimit', Number.MAX_VALUE); languageServices.css = vscode_css_languageservice_1.getCSSLanguageService({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); languageServices.scss = vscode_css_languageservice_1.getSCSSLanguageService({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); languageServices.less = vscode_css_languageservice_1.getLESSLanguageService({ fileSystemProvider: requestService, clientCapabilities: params.capabilities }); const capabilities = { textDocumentSync: vscode_languageserver_1.TextDocumentSyncKind.Incremental, completionProvider: snippetSupport ? { resolveProvider: false, triggerCharacters: ['/', '-'] } : undefined, hoverProvider: true, documentSymbolProvider: true, referencesProvider: true, definitionProvider: true, documentHighlightProvider: true, documentLinkProvider: { resolveProvider: false }, codeActionProvider: true, renameProvider: true, colorProvider: {}, foldingRangeProvider: true, selectionRangeProvider: true }; return { capabilities }; }); function getLanguageService(document) { let service = languageServices[document.languageId]; if (!service) { connection.console.log('Document type is ' + document.languageId + ', using css instead.'); service = languageServices['css']; } return service; } let documentSettings = {}; // remove document settings on close documents.onDidClose(e => { delete documentSettings[e.document.uri]; }); function getDocumentSettings(textDocument) { if (scopedSettingsSupport) { let promise = documentSettings[textDocument.uri]; if (!promise) { const configRequestParam = { items: [{ scopeUri: textDocument.uri, section: textDocument.languageId }] }; promise = connection.sendRequest(vscode_languageserver_1.ConfigurationRequest.type, configRequestParam).then(s => s[0]); documentSettings[textDocument.uri] = promise; } return promise; } return Promise.resolve(undefined); } // The settings have changed. Is send on server activation as well. connection.onDidChangeConfiguration(change => { updateConfiguration(change.settings); }); function updateConfiguration(settings) { for (const languageId in languageServices) { languageServices[languageId].configure(settings[languageId]); } // reset all document settings documentSettings = {}; // Revalidate any open text documents documents.all().forEach(triggerValidation); } 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 validateTextDocument(textDocument) { const settingsPromise = getDocumentSettings(textDocument); Promise.all([settingsPromise, dataProvidersReady]).then(([settings]) => __awaiter(this, void 0, void 0, function* () { const stylesheet = stylesheets.get(textDocument); const diagnostics = getLanguageService(textDocument).doValidation(textDocument, stylesheet, settings); // Send the computed diagnostics to VSCode. connection.sendDiagnostics({ uri: textDocument.uri, diagnostics }); }), e => { connection.console.error(runner_1.formatError(`Error while validating ${textDocument.uri}`, e)); }); } function updateDataProviders(dataPaths) { dataProvidersReady = customData_1.fetchDataProviders(dataPaths, requestService).then(customDataProviders => { for (const lang in languageServices) { languageServices[lang].setDataProviders(true, customDataProviders); } }); } connection.onCompletion((textDocumentPosition, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(textDocumentPosition.textDocument.uri); if (document) { yield dataProvidersReady; const styleSheet = stylesheets.get(document); const documentContext = documentContext_1.getDocumentContext(document.uri, workspaceFolders); return getLanguageService(document).doComplete2(document, textDocumentPosition.position, styleSheet, documentContext); } return null; }), null, `Error while computing completions for ${textDocumentPosition.textDocument.uri}`, token); }); connection.onHover((textDocumentPosition, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(textDocumentPosition.textDocument.uri); if (document) { yield dataProvidersReady; const styleSheet = stylesheets.get(document); return getLanguageService(document).doHover(document, textDocumentPosition.position, styleSheet); } return null; }), null, `Error while computing hover for ${textDocumentPosition.textDocument.uri}`, token); }); connection.onDocumentSymbol((documentSymbolParams, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(documentSymbolParams.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).findDocumentSymbols(document, stylesheet); } return []; }), [], `Error while computing document symbols for ${documentSymbolParams.textDocument.uri}`, token); }); connection.onDefinition((documentDefinitionParams, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(documentDefinitionParams.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).findDefinition(document, documentDefinitionParams.position, stylesheet); } return null; }), null, `Error while computing definitions for ${documentDefinitionParams.textDocument.uri}`, token); }); connection.onDocumentHighlight((documentHighlightParams, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(documentHighlightParams.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).findDocumentHighlights(document, documentHighlightParams.position, stylesheet); } return []; }), [], `Error while computing document highlights for ${documentHighlightParams.textDocument.uri}`, token); }); connection.onDocumentLinks((documentLinkParams, token) => __awaiter(this, void 0, void 0, function* () { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(documentLinkParams.textDocument.uri); if (document) { yield dataProvidersReady; const documentContext = documentContext_1.getDocumentContext(document.uri, workspaceFolders); const stylesheet = stylesheets.get(document); return getLanguageService(document).findDocumentLinks2(document, stylesheet, documentContext); } return []; }), [], `Error while computing document links for ${documentLinkParams.textDocument.uri}`, token); })); connection.onReferences((referenceParams, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(referenceParams.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).findReferences(document, referenceParams.position, stylesheet); } return []; }), [], `Error while computing references for ${referenceParams.textDocument.uri}`, token); }); connection.onCodeAction((codeActionParams, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(codeActionParams.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).doCodeActions(document, codeActionParams.range, codeActionParams.context, stylesheet); } return []; }), [], `Error while computing code actions for ${codeActionParams.textDocument.uri}`, token); }); connection.onDocumentColor((params, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(params.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).findDocumentColors(document, stylesheet); } return []; }), [], `Error while computing document colors for ${params.textDocument.uri}`, token); }); connection.onColorPresentation((params, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(params.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).getColorPresentations(document, stylesheet, params.color, params.range); } return []; }), [], `Error while computing color presentations for ${params.textDocument.uri}`, token); }); connection.onRenameRequest((renameParameters, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(renameParameters.textDocument.uri); if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).doRename(document, renameParameters.position, renameParameters.newName, stylesheet); } return null; }), null, `Error while computing renames for ${renameParameters.textDocument.uri}`, token); }); connection.onFoldingRanges((params, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(params.textDocument.uri); if (document) { yield dataProvidersReady; return getLanguageService(document).getFoldingRanges(document, { rangeLimit: foldingRangeLimit }); } return null; }), null, `Error while computing folding ranges for ${params.textDocument.uri}`, token); }); connection.onSelectionRanges((params, token) => { return runner_1.runSafeAsync(() => __awaiter(this, void 0, void 0, function* () { const document = documents.get(params.textDocument.uri); const positions = params.positions; if (document) { yield dataProvidersReady; const stylesheet = stylesheets.get(document); return getLanguageService(document).getSelectionRanges(document, positions, stylesheet); } return []; }), [], `Error while computing selection ranges for ${params.textDocument.uri}`, token); }); connection.onNotification(CustomDataChangedNotification.type, updateDataProviders); // Listen on the connection connection.listen(); } exports.startServer = startServer; /***/ }), /* 87 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "URI": () => /* binding */ URI, /* harmony export */ "uriToFsPath": () => /* binding */ uriToFsPath /* 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 __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 __()); }; })(); var _a; var isWindows; if (typeof process === 'object') { isWindows = process.platform === 'win32'; } else if (typeof navigator === 'object') { var userAgent = navigator.userAgent; isWindows = userAgent.indexOf('Windows') >= 0; } function isHighSurrogate(charCode) { return (0xD800 <= charCode && charCode <= 0xDBFF); } function isLowSurrogate(charCode) { return (0xDC00 <= charCode && charCode <= 0xDFFF); } function isLowerAsciiHex(code) { return code >= 97 /* a */ && code <= 102 /* f */; } function isLowerAsciiLetter(code) { return code >= 97 /* a */ && code <= 122 /* z */; } function isUpperAsciiLetter(code) { return code >= 65 /* A */ && code <= 90 /* Z */; } function isAsciiLetter(code) { return isLowerAsciiLetter(code) || isUpperAsciiLetter(code); } //#endregion var _schemePattern = /^\w[\w\d+.-]*$/; var _singleSlashStart = /^\//; var _doubleSlashStart = /^\/\//; function _validateUri(ret, _strict) { // scheme, must be set if (!ret.scheme && _strict) { throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}"); } // scheme, https://tools.ietf.org/html/rfc3986#section-3.1 // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) if (ret.scheme && !_schemePattern.test(ret.scheme)) { throw new Error('[UriError]: Scheme contains illegal characters.'); } // path, http://tools.ietf.org/html/rfc3986#section-3.3 // If a URI contains an authority component, then the path component // must either be empty or begin with a slash ("/") character. If a URI // does not contain an authority component, then the path cannot begin // with two slash characters ("//"). if (ret.path) { if (ret.authority) { if (!_singleSlashStart.test(ret.path)) { throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); } } else { if (_doubleSlashStart.test(ret.path)) { throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); } } } } // for a while we allowed uris *without* schemes and this is the migration // for them, e.g. an uri without scheme and without strict-mode warns and falls // back to the file-scheme. that should cause the least carnage and still be a // clear warning function _schemeFix(scheme, _strict) { if (!scheme && !_strict) { return 'file'; } return scheme; } // implements a bit of https://tools.ietf.org/html/rfc3986#section-5 function _referenceResolution(scheme, path) { // the slash-character is our 'default base' as we don't // support constructing URIs relative to other URIs. This // also means that we alter and potentially break paths. // see https://tools.ietf.org/html/rfc3986#section-5.1.4 switch (scheme) { case 'https': case 'http': case 'file': if (!path) { path = _slash; } else if (path[0] !== _slash) { path = _slash + path; } break; } return path; } var _empty = ''; var _slash = '/'; var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; /** * Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986. * This class is a simple parser which creates the basic component parts * (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation * and encoding. * * ```txt * foo://example.com:8042/over/there?name=ferret#nose * \_/ \______________/\_________/ \_________/ \__/ * | | | | | * scheme authority path query fragment * | _____________________|__ * / \ / \ * urn:example:animal:ferret:nose * ``` */ var URI = /** @class */ (function () { /** * @internal */ function URI(schemeOrData, authority, path, query, fragment, _strict) { if (_strict === void 0) { _strict = false; } if (typeof schemeOrData === 'object') { this.scheme = schemeOrData.scheme || _empty; this.authority = schemeOrData.authority || _empty; this.path = schemeOrData.path || _empty; this.query = schemeOrData.query || _empty; this.fragment = schemeOrData.fragment || _empty; // no validation because it's this URI // that creates uri components. // _validateUri(this); } else { this.scheme = _schemeFix(schemeOrData, _strict); this.authority = authority || _empty; this.path = _referenceResolution(this.scheme, path || _empty); this.query = query || _empty; this.fragment = fragment || _empty; _validateUri(this, _strict); } } URI.isUri = function (thing) { if (thing instanceof URI) { return true; } if (!thing) { return false; } return typeof thing.authority === 'string' && typeof thing.fragment === 'string' && typeof thing.path === 'string' && typeof thing.query === 'string' && typeof thing.scheme === 'string' && typeof thing.fsPath === 'function' && typeof thing.with === 'function' && typeof thing.toString === 'function'; }; Object.defineProperty(URI.prototype, "fsPath", { // ---- filesystem path ----------------------- /** * Returns a string representing the corresponding file system path of this URI. * Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the * platform specific path separator. * * * Will *not* validate the path for invalid characters and semantics. * * Will *not* look at the scheme of this URI. * * The result shall *not* be used for display purposes but for accessing a file on disk. * * * The *difference* to `URI#path` is the use of the platform specific separator and the handling * of UNC paths. See the below sample of a file-uri with an authority (UNC path). * * ```ts const u = URI.parse('file://server/c$/folder/file.txt') u.authority === 'server' u.path === '/shares/c$/file.txt' u.fsPath === '\\server\c$\folder\file.txt' ``` * * Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path, * namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working * with URIs that represent files on disk (`file` scheme). */ get: function () { // if (this.scheme !== 'file') { // console.warn(`[UriError] calling fsPath with scheme ${this.scheme}`); // } return uriToFsPath(this, false); }, enumerable: true, configurable: true }); // ---- modify to new ------------------------- URI.prototype.with = function (change) { if (!change) { return this; } var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment; if (scheme === undefined) { scheme = this.scheme; } else if (scheme === null) { scheme = _empty; } if (authority === undefined) { authority = this.authority; } else if (authority === null) { authority = _empty; } if (path === undefined) { path = this.path; } else if (path === null) { path = _empty; } if (query === undefined) { query = this.query; } else if (query === null) { query = _empty; } if (fragment === undefined) { fragment = this.fragment; } else if (fragment === null) { fragment = _empty; } if (scheme === this.scheme && authority === this.authority && path === this.path && query === this.query && fragment === this.fragment) { return this; } return new _URI(scheme, authority, path, query, fragment); }; // ---- parse & validate ------------------------ /** * Creates a new URI from a string, e.g. `http://www.msft.com/some/path`, * `file:///usr/home`, or `scheme:with/path`. * * @param value A string which represents an URI (see `URI#toString`). */ URI.parse = function (value, _strict) { if (_strict === void 0) { _strict = false; } var match = _regexp.exec(value); if (!match) { return new _URI(_empty, _empty, _empty, _empty, _empty); } return new _URI(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict); }; /** * Creates a new URI from a file system path, e.g. `c:\my\files`, * `/usr/home`, or `\\server\share\some\path`. * * The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument * as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as** * `URI.parse('file://' + path)` because the path might contain characters that are * interpreted (# and ?). See the following sample: * ```ts const good = URI.file('/coding/c#/project1'); good.scheme === 'file'; good.path === '/coding/c#/project1'; good.fragment === ''; const bad = URI.parse('file://' + '/coding/c#/project1'); bad.scheme === 'file'; bad.path === '/coding/c'; // path is now broken bad.fragment === '/project1'; ``` * * @param path A file system path (see `URI#fsPath`) */ URI.file = function (path) { var authority = _empty; // normalize to fwd-slashes on windows, // on other systems bwd-slashes are valid // filename character, eg /f\oo/ba\r.txt if (isWindows) { path = path.replace(/\\/g, _slash); } // check for authority as used in UNC shares // or use the path as given if (path[0] === _slash && path[1] === _slash) { var idx = path.indexOf(_slash, 2); if (idx === -1) { authority = path.substring(2); path = _slash; } else { authority = path.substring(2, idx); path = path.substring(idx) || _slash; } } return new _URI('file', authority, path, _empty, _empty); }; URI.from = function (components) { return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment); }; // /** // * Join a URI path with path fragments and normalizes the resulting path. // * // * @param uri The input URI. // * @param pathFragment The path fragment to add to the URI path. // * @returns The resulting URI. // */ // static joinPath(uri: URI, ...pathFragment: string[]): URI { // if (!uri.path) { // throw new Error(`[UriError]: cannot call joinPaths on URI without path`); // } // let newPath: string; // if (isWindows && uri.scheme === 'file') { // newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path; // } else { // newPath = paths.posix.join(uri.path, ...pathFragment); // } // return uri.with({ path: newPath }); // } // ---- printing/externalize --------------------------- /** * Creates a string representation for this URI. It's guaranteed that calling * `URI.parse` with the result of this function creates an URI which is equal * to this URI. * * * The result shall *not* be used for display purposes but for externalization or transport. * * The result will be encoded using the percentage encoding and encoding happens mostly * ignore the scheme-specific encoding rules. * * @param skipEncoding Do not encode the result, default is `false` */ URI.prototype.toString = function (skipEncoding) { if (skipEncoding === void 0) { skipEncoding = false; } return _asFormatted(this, skipEncoding); }; URI.prototype.toJSON = function () { return this; }; URI.revive = function (data) { if (!data) { return data; } else if (data instanceof URI) { return data; } else { var result = new _URI(data); result._formatted = data.external; result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null; return result; } }; return URI; }()); var _pathSepMarker = isWindows ? 1 : undefined; // eslint-disable-next-line @typescript-eslint/class-name-casing var _URI = /** @class */ (function (_super) { __extends(_URI, _super); function _URI() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._formatted = null; _this._fsPath = null; return _this; } Object.defineProperty(_URI.prototype, "fsPath", { get: function () { if (!this._fsPath) { this._fsPath = uriToFsPath(this, false); } return this._fsPath; }, enumerable: true, configurable: true }); _URI.prototype.toString = function (skipEncoding) { if (skipEncoding === void 0) { skipEncoding = false; } if (!skipEncoding) { if (!this._formatted) { this._formatted = _asFormatted(this, false); } return this._formatted; } else { // we don't cache that return _asFormatted(this, true); } }; _URI.prototype.toJSON = function () { var res = { $mid: 1 }; // cached state if (this._fsPath) { res.fsPath = this._fsPath; res._sep = _pathSepMarker; } if (this._formatted) { res.external = this._formatted; } // uri components if (this.path) { res.path = this.path; } if (this.scheme) { res.scheme = this.scheme; } if (this.authority) { res.authority = this.authority; } if (this.query) { res.query = this.query; } if (this.fragment) { res.fragment = this.fragment; } return res; }; return _URI; }(URI)); // reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2 var encodeTable = (_a = {}, _a[58 /* Colon */] = '%3A', _a[47 /* Slash */] = '%2F', _a[63 /* QuestionMark */] = '%3F', _a[35 /* Hash */] = '%23', _a[91 /* OpenSquareBracket */] = '%5B', _a[93 /* CloseSquareBracket */] = '%5D', _a[64 /* AtSign */] = '%40', _a[33 /* ExclamationMark */] = '%21', _a[36 /* DollarSign */] = '%24', _a[38 /* Ampersand */] = '%26', _a[39 /* SingleQuote */] = '%27', _a[40 /* OpenParen */] = '%28', _a[41 /* CloseParen */] = '%29', _a[42 /* Asterisk */] = '%2A', _a[43 /* Plus */] = '%2B', _a[44 /* Comma */] = '%2C', _a[59 /* Semicolon */] = '%3B', _a[61 /* Equals */] = '%3D', _a[32 /* Space */] = '%20', _a); function encodeURIComponentFast(uriComponent, allowSlash) { var res = undefined; var nativeEncodePos = -1; for (var pos = 0; pos < uriComponent.length; pos++) { var code = uriComponent.charCodeAt(pos); // unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3 if ((code >= 97 /* a */ && code <= 122 /* z */) || (code >= 65 /* A */ && code <= 90 /* Z */) || (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */) || code === 45 /* Dash */ || code === 46 /* Period */ || code === 95 /* Underline */ || code === 126 /* Tilde */ || (allowSlash && code === 47 /* Slash */)) { // check if we are delaying native encode if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); nativeEncodePos = -1; } // check if we write into a new string (by default we try to return the param) if (res !== undefined) { res += uriComponent.charAt(pos); } } else { // encoding needed, we need to allocate a new string if (res === undefined) { res = uriComponent.substr(0, pos); } // check with default table first var escaped = encodeTable[code]; if (escaped !== undefined) { // check if we are delaying native encode if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); nativeEncodePos = -1; } // append escaped variant to result res += escaped; } else if (nativeEncodePos === -1) { // use native encode only when needed nativeEncodePos = pos; } } } if (nativeEncodePos !== -1) { res += encodeURIComponent(uriComponent.substring(nativeEncodePos)); } return res !== undefined ? res : uriComponent; } function encodeURIComponentMinimal(path) { var res = undefined; for (var pos = 0; pos < path.length; pos++) { var code = path.charCodeAt(pos); if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) { if (res === undefined) { res = path.substr(0, pos); } res += encodeTable[code]; } else { if (res !== undefined) { res += path[pos]; } } } return res !== undefined ? res : path; } /** * Compute `fsPath` for the given uri */ function uriToFsPath(uri, keepDriveLetterCasing) { var value; if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') { // unc path: file://shares/c$/far/boo value = "//" + uri.authority + uri.path; } else if (uri.path.charCodeAt(0) === 47 /* Slash */ && (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */) && uri.path.charCodeAt(2) === 58 /* Colon */) { if (!keepDriveLetterCasing) { // windows drive letter: file:///c:/far/boo value = uri.path[1].toLowerCase() + uri.path.substr(2); } else { value = uri.path.substr(1); } } else { // other path value = uri.path; } if (isWindows) { value = value.replace(/\//g, '\\'); } return value; } /** * Create the external version of a uri */ function _asFormatted(uri, skipEncoding) { var encoder = !skipEncoding ? encodeURIComponentFast : encodeURIComponentMinimal; var res = ''; var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment; if (scheme) { res += scheme; res += ':'; } if (authority || scheme === 'file') { res += _slash; res += _slash; } if (authority) { var idx = authority.indexOf('@'); if (idx !== -1) { // @ var userinfo = authority.substr(0, idx); authority = authority.substr(idx + 1); idx = userinfo.indexOf(':'); if (idx === -1) { res += encoder(userinfo, false); } else { // :@ res += encoder(userinfo.substr(0, idx), false); res += ':'; res += encoder(userinfo.substr(idx + 1), false); } res += '@'; } authority = authority.toLowerCase(); idx = authority.indexOf(':'); if (idx === -1) { res += encoder(authority, false); } else { // : res += encoder(authority.substr(0, idx), false); res += authority.substr(idx); } } if (path) { // lower-case windows drive letters in /C:/fff or C:/fff if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) { var code = path.charCodeAt(1); if (code >= 65 /* A */ && code <= 90 /* Z */) { path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3); // "/c:".length === 3 } } else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) { var code = path.charCodeAt(0); if (code >= 65 /* A */ && code <= 90 /* Z */) { path = String.fromCharCode(code + 32) + ":" + path.substr(2); // "/c:".length === 3 } } // encode the rest of the path res += encoder(path, true); } if (query) { res += '?'; res += encoder(query, false); } if (fragment) { res += '#'; res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment; } return res; } // --- decode function decodeURIComponentGraceful(str) { try { return decodeURIComponent(str); } catch (_a) { if (str.length > 3) { return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3)); } else { return str; } } } var _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g; function percentDecode(str) { if (!str.match(_rEncodedAsHex)) { return str; } return str.replace(_rEncodedAsHex, function (match) { return decodeURIComponentGraceful(match); }); } /***/ }), /* 88 */ /***/ ((__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__(89); /* harmony import */ var _services_cssCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(102); /* harmony import */ var _services_cssHover__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(110); /* harmony import */ var _services_cssNavigation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(112); /* harmony import */ var _services_cssCodeActions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(113); /* harmony import */ var _services_cssValidation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(115); /* harmony import */ var _parser_scssParser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(118); /* harmony import */ var _services_scssCompletion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(121); /* harmony import */ var _parser_lessParser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(122); /* harmony import */ var _services_lessCompletion__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(124); /* harmony import */ var _services_cssFolding__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(125); /* harmony import */ var _languageFacts_dataManager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(126); /* harmony import */ var _languageFacts_dataProvider__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(128); /* harmony import */ var _services_cssSelectionRange__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(129); /* harmony import */ var _services_scssNavigation__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(130); /* harmony import */ var _data_webCustomData__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(127); /* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(105); /*--------------------------------------------------------------------------------------------- * 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); } /***/ }), /* 89 */ /***/ ((__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__(90); /* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(91); /* harmony import */ var _cssErrors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(93); /* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97); /* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(101); /*--------------------------------------------------------------------------------------------- * 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; } } } return false; }; Parser.prototype.accept = function (type) { if (type === this.token.type) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptIdent = function (text) { if (this.peekIdent(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptKeyword = function (text) { if (this.peekKeyword(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptDelim = function (text) { if (this.peekDelim(text)) { this.consumeToken(); return true; } return false; }; Parser.prototype.acceptRegexp = function (regEx) { if (regEx.test(this.token.text)) { this.consumeToken(); return true; } return false; }; Parser.prototype._parseRegexp = function (regEx) { var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Identifier); do { } while (this.acceptRegexp(regEx)); return this.finish(node); }; Parser.prototype.acceptUnquotedString = function () { var pos = this.scanner.pos(); this.scanner.goBackTo(this.token.offset); var unquoted = this.scanner.scanUnquotedString(); if (unquoted) { this.token = unquoted; this.consumeToken(); return true; } this.scanner.goBackTo(pos); return false; }; Parser.prototype.resync = function (resyncTokens, resyncStopTokens) { while (true) { if (resyncTokens && resyncTokens.indexOf(this.token.type) !== -1) { this.consumeToken(); return true; } else if (resyncStopTokens && resyncStopTokens.indexOf(this.token.type) !== -1) { return true; } else { if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF) { return false; } this.token = this.scanner.scan(); } } }; Parser.prototype.createNode = function (nodeType) { return new _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node(this.token.offset, this.token.len, nodeType); }; Parser.prototype.create = function (ctor) { return new ctor(this.token.offset, this.token.len); }; Parser.prototype.finish = function (node, error, resyncTokens, resyncStopTokens) { // parseNumeric misuses error for boolean flagging (however the real error mustn't be a false) // + nodelist offsets mustn't be modified, because there is a offset hack in rulesets for smartselection if (!(node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Nodelist)) { if (error) { this.markError(node, error, resyncTokens, resyncStopTokens); } // set the node end position if (this.prevToken) { // length with more elements belonging together var prevEnd = this.prevToken.offset + this.prevToken.len; node.length = prevEnd > node.offset ? prevEnd - node.offset : 0; // offset is taken from current token, end from previous: Use 0 for empty nodes } } return node; }; Parser.prototype.markError = function (node, error, resyncTokens, resyncStopTokens) { if (this.token !== this.lastErrorToken) { // do not report twice on the same token node.addIssue(new _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Marker(node, error, _cssNodes__WEBPACK_IMPORTED_MODULE_1__.Level.Error, undefined, this.token.offset, this.token.len)); this.lastErrorToken = this.token; } if (resyncTokens || resyncStopTokens) { this.resync(resyncTokens, resyncStopTokens); } }; Parser.prototype.parseStylesheet = function (textDocument) { var versionId = textDocument.version; var text = textDocument.getText(); var textProvider = function (offset, length) { if (textDocument.version !== versionId) { throw new Error('Underlying model has changed, AST is no longer valid'); } return text.substr(offset, length); }; return this.internalParse(text, this._parseStylesheet, textProvider); }; Parser.prototype.internalParse = function (input, parseFunc, textProvider) { this.scanner.setSource(input); this.token = this.scanner.scan(); var node = parseFunc.bind(this)(); if (node) { if (textProvider) { node.textProvider = textProvider; } else { node.textProvider = function (offset, length) { return input.substr(offset, length); }; } } return node; }; Parser.prototype._parseStylesheet = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Stylesheet); while (node.addChild(this._parseStylesheetStart())) { // Parse statements only valid at the beginning of stylesheets. } var inRecovery = false; do { var hasMatch = false; do { hasMatch = false; var statement = this._parseStylesheetStatement(); if (statement) { node.addChild(statement); hasMatch = true; inRecovery = false; if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF) && this._needsSemicolonAfter(statement) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon)) { this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SemiColonExpected); } } while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon) || this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CDO) || this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CDC)) { // accept empty statements hasMatch = true; inRecovery = false; } } while (hasMatch); if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF)) { break; } if (!inRecovery) { if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.UnknownAtRule); } else { this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RuleOrSelectorExpected); } inRecovery = true; } this.consumeToken(); } while (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF)); return this.finish(node); }; Parser.prototype._parseStylesheetStart = function () { return this._parseCharset(); }; Parser.prototype._parseStylesheetStatement = function (isNested) { if (isNested === void 0) { isNested = false; } if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { return this._parseStylesheetAtStatement(isNested); } return this._parseRuleset(isNested); }; Parser.prototype._parseStylesheetAtStatement = function (isNested) { if (isNested === void 0) { isNested = false; } return this._parseImport() || this._parseMedia(isNested) || this._parsePage() || this._parseFontFace() || this._parseKeyframe() || this._parseSupports(isNested) || this._parseViewPort() || this._parseNamespace() || this._parseDocument() || this._parseUnknownAtRule(); }; Parser.prototype._tryParseRuleset = function (isNested) { var mark = this.mark(); if (this._parseSelector(isNested)) { while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma) && this._parseSelector(isNested)) { // loop } if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL)) { this.restoreAtMark(mark); return this._parseRuleset(isNested); } } this.restoreAtMark(mark); return null; }; Parser.prototype._parseRuleset = function (isNested) { if (isNested === void 0) { isNested = false; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.RuleSet); var selectors = node.getSelectors(); if (!selectors.addChild(this._parseSelector(isNested))) { return null; } while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) { if (!selectors.addChild(this._parseSelector(isNested))) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.SelectorExpected); } } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parseRuleSetDeclarationAtStatement = function () { return this._parseAtApply() || this._parseUnknownAtRule(); }; Parser.prototype._parseRuleSetDeclaration = function () { // https://www.w3.org/TR/css-syntax-3/#consume-a-list-of-declarations0 if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { return this._parseRuleSetDeclarationAtStatement(); } return this._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); } } 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()); } } } 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); } } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected, [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR], []); } if (this.prevToken) { node.rParent = this.prevToken.offset; } return this.finish(node); } else if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) { var pos = this.mark(); this.consumeToken(); if (!this.hasWhitespace() && this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { var openParentCount = 1; while (this.token.type !== _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF && openParentCount !== 0) { if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL) { openParentCount++; } else if (this.token.type === _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR) { openParentCount--; } this.consumeToken(); } return this.finish(node); } else { this.restoreAtMark(pos); } } return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected, [], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL]); }; Parser.prototype._parseMediaDeclaration = function (isNested) { if (isNested === void 0) { isNested = false; } if (isNested) { // if nested, the body can contain rulesets, but also declarations return this._tryParseRuleset(true) || this._tryToParseDeclaration() || this._parseStylesheetStatement(true); } return this._parseStylesheetStatement(false); }; Parser.prototype._parseMedia = function (isNested) { if (isNested === void 0) { isNested = false; } // MEDIA_SYM S* media_query_list '{' S* ruleset* '}' S* // media_query_list : S* [media_query [ ',' S* media_query ]* ]? if (!this.peekKeyword('@media')) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Media); this.consumeToken(); // @media if (!node.addChild(this._parseMediaQueryList())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected); } return this._parseBody(node, this._parseMediaDeclaration.bind(this, isNested)); }; Parser.prototype._parseMediaQueryList = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Medialist); if (!node.addChild(this._parseMediaQuery([_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]))) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected); } while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) { if (!node.addChild(this._parseMediaQuery([_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]))) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.MediaQueryExpected); } } return this.finish(node); }; Parser.prototype._parseMediaQuery = function (resyncStopToken) { // http://www.w3.org/TR/css3-mediaqueries/ // media_query : [ONLY | NOT]? S* IDENT S* [ AND S* expression ]* | expression [ AND S* expression ]* // expression : '(' S* IDENT S* [ ':' S* expr ]? ')' S* var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.MediaQuery); var parseExpression = true; var hasContent = false; if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { if (this.acceptIdent('only') || this.acceptIdent('not')) { // optional } if (!node.addChild(this._parseIdent())) { return null; } hasContent = true; parseExpression = this.acceptIdent('and'); } while (parseExpression) { // Allow short-circuting for other language constructs. if (node.addChild(this._parseMediaContentStart())) { parseExpression = this.acceptIdent('and'); continue; } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { if (hasContent) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected, [], resyncStopToken); } return null; } if (!node.addChild(this._parseMediaFeatureName())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected, [], resyncStopToken); } if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) { if (!node.addChild(this._parseExpr())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.TermExpected, [], resyncStopToken); } } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected, [], resyncStopToken); } parseExpression = this.acceptIdent('and'); } return this.finish(node); }; Parser.prototype._parseMediaContentStart = function () { return null; }; Parser.prototype._parseMediaFeatureName = function () { return this._parseIdent(); }; Parser.prototype._parseMedium = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); if (node.addChild(this._parseIdent())) { return this.finish(node); } else { return null; } }; Parser.prototype._parsePageDeclaration = function () { return this._parsePageMarginBox() || this._parseRuleSetDeclaration(); }; Parser.prototype._parsePage = function () { // http://www.w3.org/TR/css3-page/ // page_rule : PAGE_SYM S* page_selector_list '{' S* page_body '}' S* // page_body : /* Can be empty */ declaration? [ ';' S* page_body ]? | page_margin_box page_body if (!this.peekKeyword('@page')) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Page); this.consumeToken(); if (node.addChild(this._parsePageSelector())) { while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) { if (!node.addChild(this._parsePageSelector())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); } } } return this._parseBody(node, this._parsePageDeclaration.bind(this)); }; Parser.prototype._parsePageMarginBox = function () { // page_margin_box : margin_sym S* '{' S* declaration? [ ';' S* declaration? ]* '}' S* if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.PageBoxMarginBox); if (!this.acceptOneKeyword(_languageFacts_facts__WEBPACK_IMPORTED_MODULE_3__.pageBoxDirectives)) { this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.UnknownAtRule, [], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]); } return this._parseBody(node, this._parseRuleSetDeclaration.bind(this)); }; Parser.prototype._parsePageSelector = function () { // page_selector : pseudo_page+ | IDENT pseudo_page* // pseudo_page : ':' [ "left" | "right" | "first" | "blank" ]; if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); node.addChild(this._parseIdent()); // optional ident if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) { if (!node.addChild(this._parseIdent())) { // optional ident return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); } } return this.finish(node); }; Parser.prototype._parseDocument = function () { // -moz-document is experimental but has been pushed to css4 if (!this.peekKeyword('@-moz-document')) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Document); this.consumeToken(); // @-moz-document this.resync([], [_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL]); // ignore all the rules return this._parseBody(node, this._parseStylesheetStatement.bind(this)); }; // https://www.w3.org/TR/css-syntax-3/#consume-an-at-rule Parser.prototype._parseUnknownAtRule = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.UnknownAtRule); node.addChild(this._parseUnknownAtRuleName()); var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; }; var curlyLCount = 0; var curlyDepth = 0; var parensDepth = 0; var bracketsDepth = 0; done: while (true) { switch (this.token.type) { case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SemiColon: if (isTopLevel()) { break done; } break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EOF: if (curlyDepth > 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightCurlyExpected); } else if (bracketsDepth > 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } else { return this.finish(node); } case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyL: curlyLCount++; curlyDepth++; break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.CurlyR: curlyDepth--; // End of at-rule, consume CurlyR and return node if (curlyLCount > 0 && curlyDepth === 0) { this.consumeToken(); if (bracketsDepth > 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected); } else if (parensDepth > 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } break done; } if (curlyDepth < 0) { // The property value has been terminated without a semicolon, and // this is the last declaration in the ruleset. if (parensDepth === 0 && bracketsDepth === 0) { break done; } return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftCurlyExpected); } break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL: parensDepth++; break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR: parensDepth--; if (parensDepth < 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftParenthesisExpected); } break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL: bracketsDepth++; break; case _cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR: bracketsDepth--; if (bracketsDepth < 0) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.LeftSquareBracketExpected); } break; } this.consumeToken(); } return node; }; Parser.prototype._parseUnknownAtRuleName = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.AtKeyword)) { return this.finish(node); } return node; }; Parser.prototype._parseOperator = function () { // these are operators for binary expressions if (this.peekDelim('/') || this.peekDelim('*') || this.peekDelim('+') || this.peekDelim('-') || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Dashmatch) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Includes) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SubstringOperator) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.PrefixOperator) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.SuffixOperator) || this.peekDelim('=')) { // doesn't stick to the standard here var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.Operator); this.consumeToken(); return this.finish(node); } else { return null; } }; Parser.prototype._parseUnaryOperator = function () { if (!this.peekDelim('+') && !this.peekDelim('-')) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseCombinator = function () { if (this.peekDelim('>')) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); var mark = this.mark(); if (!this.hasWhitespace() && this.acceptDelim('>')) { if (!this.hasWhitespace() && this.acceptDelim('>')) { node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorParent; return this.finish(node); } else if (this.peekDelim('+')) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorSibling; return this.finish(node); } else if (this.peekDelim('~')) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorAllSiblings; return this.finish(node); } else if (this.peekDelim('/')) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); var mark = this.mark(); if (!this.hasWhitespace() && this.acceptIdent('deep') && !this.hasWhitespace() && this.acceptDelim('/')) { node.type = _cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.SelectorCombinatorShadowPiercingDescendant; return this.finish(node); } this.restoreAtMark(mark); } return null; }; Parser.prototype._parseSimpleSelector = function () { // simple_selector // : element_name [ HASH | class | attrib | pseudo ]* | [ HASH | class | attrib | pseudo ]+ ; var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.SimpleSelector); var c = 0; if (node.addChild(this._parseElementName())) { c++; } while ((c === 0 || !this.hasWhitespace()) && node.addChild(this._parseSimpleSelectorBody())) { c++; } return c > 0 ? this.finish(node) : null; }; Parser.prototype._parseSimpleSelectorBody = function () { return this._parsePseudo() || this._parseHash() || this._parseClass() || this._parseAttrib(); }; Parser.prototype._parseSelectorIdent = function () { return this._parseIdent(); }; Parser.prototype._parseHash = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Hash) && !this.peekDelim('#')) { return null; } var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.IdentifierSelector); if (this.acceptDelim('#')) { if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); } } else { this.consumeToken(); // TokenType.Hash } return this.finish(node); }; Parser.prototype._parseClass = function () { // class: '.' IDENT ; if (!this.peekDelim('.')) { return null; } var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ClassSelector); this.consumeToken(); // '.' if (this.hasWhitespace() || !node.addChild(this._parseSelectorIdent())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); } return this.finish(node); }; Parser.prototype._parseElementName = function () { // element_name: (ns? '|')? IDENT | '*'; var pos = this.mark(); var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.ElementNameSelector); node.addChild(this._parseNamespacePrefix()); if (!node.addChild(this._parseSelectorIdent()) && !this.acceptDelim('*')) { this.restoreAtMark(pos); return null; } return this.finish(node); }; Parser.prototype._parseNamespacePrefix = function () { var pos = this.mark(); var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.NamespacePrefix); if (!node.addChild(this._parseIdent()) && !this.acceptDelim('*')) { // ns is optional } if (!this.acceptDelim('|')) { this.restoreAtMark(pos); return null; } return this.finish(node); }; Parser.prototype._parseAttrib = function () { // attrib : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* [ IDENT | STRING ] S* ]? ']' if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.AttributeSelector); this.consumeToken(); // BracketL // Optional attrib namespace node.setNamespacePrefix(this._parseNamespacePrefix()); if (!node.setIdentifier(this._parseIdent())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.IdentifierExpected); } if (node.setOperator(this._parseOperator())) { node.setValue(this._parseBinaryExpr()); this.acceptIdent('i'); // case insensitive matching } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected); } return this.finish(node); }; Parser.prototype._parsePseudo = function () { var _this = this; // pseudo: ':' [ IDENT | FUNCTION S* [IDENT S*]? ')' ] var node = this._tryParsePseudoIdentifier(); if (node) { if (!this.hasWhitespace() && this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { var tryAsSelector = function () { var selectors = _this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); if (!selectors.addChild(_this._parseSelector(false))) { return null; } while (_this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma) && selectors.addChild(_this._parseSelector(false))) { // loop } if (_this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return _this.finish(selectors); } return null; }; node.addChild(this.try(tryAsSelector) || this._parseBinaryExpr()); if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } } return this.finish(node); } return null; }; Parser.prototype._tryParsePseudoIdentifier = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) { return null; } var pos = this.mark(); var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.PseudoSelector); this.consumeToken(); // Colon if (this.hasWhitespace()) { this.restoreAtMark(pos); return null; } // optional, support :: 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); } this.consumeToken(); } if (!node.addChild(this._parseBinaryExpr())) { break; } } return this.finish(node); }; Parser.prototype._parseNamedLine = function () { // https://www.w3.org/TR/css-grid-1/#named-lines if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketL)) { return null; } var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.GridLine); this.consumeToken(); while (node.addChild(this._parseIdent())) { // repeat } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BracketR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightSquareBracketExpected); } return this.finish(node); }; Parser.prototype._parseBinaryExpr = function (preparsedLeft, preparsedOper) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.BinaryExpression); if (!node.setLeft((preparsedLeft || this._parseTerm()))) { return null; } if (!node.setOperator(preparsedOper || this._parseOperator())) { return this.finish(node); } if (!node.setRight(this._parseTerm())) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.TermExpected); } // things needed for multiple binary expressions node = this.finish(node); var operator = this._parseOperator(); if (operator) { node = this._parseBinaryExpr(node, operator); } return this.finish(node); }; Parser.prototype._parseTerm = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Term); node.setOperator(this._parseUnaryOperator()); // optional if (node.setExpression(this._parseTermExpression())) { return this.finish(node); } return null; }; Parser.prototype._parseTermExpression = function () { return this._parseURILiteral() || // url before function this._parseFunction() || // function before ident this._parseIdent() || this._parseStringLiteral() || this._parseNumeric() || this._parseHexColor() || this._parseOperation() || this._parseNamedLine(); }; Parser.prototype._parseOperation = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); this.consumeToken(); // ParenthesisL node.addChild(this._parseExpr()); if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseNumeric = function () { if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Num) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Percentage) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Resolution) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Length) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EMS) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.EXS) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Angle) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Time) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Dimension) || this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Freq)) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NumericValue); this.consumeToken(); return this.finish(node); } return null; }; Parser.prototype._parseStringLiteral = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.String) && !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BadString)) { return null; } var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.StringLiteral); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseURILiteral = function () { if (!this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^url(-prefix)?$/i)) { return null; } var pos = this.mark(); var node = this.createNode(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.NodeType.URILiteral); this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident); if (this.hasWhitespace() || !this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } this.scanner.inURL = true; this.consumeToken(); // consume () node.addChild(this._parseURLArgument()); // argument is optional this.scanner.inURL = false; if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseURLArgument = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Node); if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.String) && !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.BadString) && !this.acceptUnquotedString()) { return null; } return this.finish(node); }; Parser.prototype._parseIdent = function (referenceTypes) { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Identifier); if (referenceTypes) { node.referenceTypes = referenceTypes; } node.isCustomProperty = this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident, /^--/); this.consumeToken(); return this.finish(node); }; Parser.prototype._parseFunction = function () { var pos = this.mark(); var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Function); if (!node.setIdentifier(this._parseFunctionIdentifier())) { return null; } if (this.hasWhitespace() || !this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisL)) { this.restoreAtMark(pos); return null; } if (node.getArguments().addChild(this._parseFunctionArgument())) { while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Comma)) { if (this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { break; } if (!node.getArguments().addChild(this._parseFunctionArgument())) { this.markError(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.ExpressionExpected); } } } if (!this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.ParenthesisR)) { return this.finish(node, _cssErrors__WEBPACK_IMPORTED_MODULE_2__.ParseError.RightParenthesisExpected); } return this.finish(node); }; Parser.prototype._parseFunctionIdentifier = function () { if (!this.peek(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident)) { return null; } var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.Identifier); node.referenceTypes = [_cssNodes__WEBPACK_IMPORTED_MODULE_1__.ReferenceType.Function]; if (this.acceptIdent('progid')) { // support for IE7 specific filters: 'progid:DXImageTransform.Microsoft.MotionBlur(strength=13, direction=310)' if (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Colon)) { while (this.accept(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Ident) && this.acceptDelim('.')) { // loop } } return this.finish(node); } this.consumeToken(); return this.finish(node); }; Parser.prototype._parseFunctionArgument = function () { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.FunctionArgument); if (node.setValue(this._parseExpr(true))) { return this.finish(node); } return null; }; Parser.prototype._parseHexColor = function () { if (this.peekRegExp(_cssScanner__WEBPACK_IMPORTED_MODULE_0__.TokenType.Hash, /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{4}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/g)) { var node = this.create(_cssNodes__WEBPACK_IMPORTED_MODULE_1__.HexColorValue); this.consumeToken(); return this.finish(node); } else { return null; } }; return Parser; }()); /***/ }), /* 90 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "TokenType": () => /* binding */ TokenType, /* harmony export */ "MultiLineStream": () => /* binding */ MultiLineStream, /* harmony export */ "Scanner": () => /* binding */ Scanner /* harmony export */ }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var TokenType; (function (TokenType) { TokenType[TokenType["Ident"] = 0] = "Ident"; TokenType[TokenType["AtKeyword"] = 1] = "AtKeyword"; TokenType[TokenType["String"] = 2] = "String"; TokenType[TokenType["BadString"] = 3] = "BadString"; TokenType[TokenType["UnquotedString"] = 4] = "UnquotedString"; TokenType[TokenType["Hash"] = 5] = "Hash"; TokenType[TokenType["Num"] = 6] = "Num"; TokenType[TokenType["Percentage"] = 7] = "Percentage"; TokenType[TokenType["Dimension"] = 8] = "Dimension"; TokenType[TokenType["UnicodeRange"] = 9] = "UnicodeRange"; TokenType[TokenType["CDO"] = 10] = "CDO"; TokenType[TokenType["CDC"] = 11] = "CDC"; TokenType[TokenType["Colon"] = 12] = "Colon"; TokenType[TokenType["SemiColon"] = 13] = "SemiColon"; TokenType[TokenType["CurlyL"] = 14] = "CurlyL"; TokenType[TokenType["CurlyR"] = 15] = "CurlyR"; TokenType[TokenType["ParenthesisL"] = 16] = "ParenthesisL"; TokenType[TokenType["ParenthesisR"] = 17] = "ParenthesisR"; TokenType[TokenType["BracketL"] = 18] = "BracketL"; TokenType[TokenType["BracketR"] = 19] = "BracketR"; TokenType[TokenType["Whitespace"] = 20] = "Whitespace"; TokenType[TokenType["Includes"] = 21] = "Includes"; TokenType[TokenType["Dashmatch"] = 22] = "Dashmatch"; TokenType[TokenType["SubstringOperator"] = 23] = "SubstringOperator"; TokenType[TokenType["PrefixOperator"] = 24] = "PrefixOperator"; TokenType[TokenType["SuffixOperator"] = 25] = "SuffixOperator"; TokenType[TokenType["Delim"] = 26] = "Delim"; TokenType[TokenType["EMS"] = 27] = "EMS"; TokenType[TokenType["EXS"] = 28] = "EXS"; TokenType[TokenType["Length"] = 29] = "Length"; TokenType[TokenType["Angle"] = 30] = "Angle"; TokenType[TokenType["Time"] = 31] = "Time"; TokenType[TokenType["Freq"] = 32] = "Freq"; TokenType[TokenType["Exclamation"] = 33] = "Exclamation"; TokenType[TokenType["Resolution"] = 34] = "Resolution"; TokenType[TokenType["Comma"] = 35] = "Comma"; TokenType[TokenType["Charset"] = 36] = "Charset"; TokenType[TokenType["EscapedJavaScript"] = 37] = "EscapedJavaScript"; TokenType[TokenType["BadEscapedJavaScript"] = 38] = "BadEscapedJavaScript"; TokenType[TokenType["Comment"] = 39] = "Comment"; TokenType[TokenType["SingleLineComment"] = 40] = "SingleLineComment"; TokenType[TokenType["EOF"] = 41] = "EOF"; TokenType[TokenType["CustomToken"] = 42] = "CustomToken"; })(TokenType || (TokenType = {})); var MultiLineStream = /** @class */ (function () { function MultiLineStream(source) { this.source = source; this.len = source.length; this.position = 0; } MultiLineStream.prototype.substring = function (from, to) { if (to === void 0) { to = this.position; } return this.source.substring(from, to); }; MultiLineStream.prototype.eos = function () { return this.len <= this.position; }; MultiLineStream.prototype.pos = function () { return this.position; }; MultiLineStream.prototype.goBackTo = function (pos) { this.position = pos; }; MultiLineStream.prototype.goBack = function (n) { this.position -= n; }; MultiLineStream.prototype.advance = function (n) { this.position += n; }; MultiLineStream.prototype.nextChar = function () { return this.source.charCodeAt(this.position++) || 0; }; MultiLineStream.prototype.peekChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position + n) || 0; }; MultiLineStream.prototype.lookbackChar = function (n) { if (n === void 0) { n = 0; } return this.source.charCodeAt(this.position - n) || 0; }; MultiLineStream.prototype.advanceIfChar = function (ch) { if (ch === this.source.charCodeAt(this.position)) { this.position++; return true; } return false; }; MultiLineStream.prototype.advanceIfChars = function (ch) { if (this.position + ch.length > this.source.length) { return false; } var i = 0; for (; i < ch.length; i++) { if (this.source.charCodeAt(this.position + i) !== ch[i]) { return false; } } this.advance(i); return true; }; MultiLineStream.prototype.advanceWhileChar = function (condition) { var posNow = this.position; while (this.position < this.len && condition(this.source.charCodeAt(this.position))) { this.position++; } return this.position - posNow; }; return MultiLineStream; }()); var _a = 'a'.charCodeAt(0); var _f = 'f'.charCodeAt(0); var _z = 'z'.charCodeAt(0); var _A = 'A'.charCodeAt(0); var _F = 'F'.charCodeAt(0); var _Z = 'Z'.charCodeAt(0); var _0 = '0'.charCodeAt(0); var _9 = '9'.charCodeAt(0); var _TLD = '~'.charCodeAt(0); var _HAT = '^'.charCodeAt(0); var _EQS = '='.charCodeAt(0); var _PIP = '|'.charCodeAt(0); var _MIN = '-'.charCodeAt(0); var _USC = '_'.charCodeAt(0); var _PRC = '%'.charCodeAt(0); var _MUL = '*'.charCodeAt(0); var _LPA = '('.charCodeAt(0); var _RPA = ')'.charCodeAt(0); var _LAN = '<'.charCodeAt(0); var _RAN = '>'.charCodeAt(0); var _ATS = '@'.charCodeAt(0); var _HSH = '#'.charCodeAt(0); var _DLR = '$'.charCodeAt(0); var _BSL = '\\'.charCodeAt(0); var _FSL = '/'.charCodeAt(0); var _NWL = '\n'.charCodeAt(0); var _CAR = '\r'.charCodeAt(0); var _LFD = '\f'.charCodeAt(0); var _DQO = '"'.charCodeAt(0); var _SQO = '\''.charCodeAt(0); var _WSP = ' '.charCodeAt(0); var _TAB = '\t'.charCodeAt(0); var _SEM = ';'.charCodeAt(0); var _COL = ':'.charCodeAt(0); var _CUL = '{'.charCodeAt(0); var _CUR = '}'.charCodeAt(0); var _BRL = '['.charCodeAt(0); var _BRR = ']'.charCodeAt(0); var _CMA = ','.charCodeAt(0); var _DOT = '.'.charCodeAt(0); var _BNG = '!'.charCodeAt(0); var staticTokenTable = {}; staticTokenTable[_SEM] = TokenType.SemiColon; staticTokenTable[_COL] = TokenType.Colon; staticTokenTable[_CUL] = TokenType.CurlyL; staticTokenTable[_CUR] = TokenType.CurlyR; staticTokenTable[_BRR] = TokenType.BracketR; staticTokenTable[_BRL] = TokenType.BracketL; staticTokenTable[_LPA] = TokenType.ParenthesisL; staticTokenTable[_RPA] = TokenType.ParenthesisR; staticTokenTable[_CMA] = TokenType.Comma; var staticUnitTable = {}; staticUnitTable['em'] = TokenType.EMS; staticUnitTable['ex'] = TokenType.EXS; staticUnitTable['px'] = TokenType.Length; staticUnitTable['cm'] = TokenType.Length; staticUnitTable['mm'] = TokenType.Length; staticUnitTable['in'] = TokenType.Length; staticUnitTable['pt'] = TokenType.Length; staticUnitTable['pc'] = TokenType.Length; staticUnitTable['deg'] = TokenType.Angle; staticUnitTable['rad'] = TokenType.Angle; staticUnitTable['grad'] = TokenType.Angle; staticUnitTable['ms'] = TokenType.Time; staticUnitTable['s'] = TokenType.Time; staticUnitTable['hz'] = TokenType.Freq; staticUnitTable['khz'] = TokenType.Freq; staticUnitTable['%'] = TokenType.Percentage; staticUnitTable['fr'] = TokenType.Percentage; staticUnitTable['dpi'] = TokenType.Resolution; staticUnitTable['dpcm'] = TokenType.Resolution; var Scanner = /** @class */ (function () { function Scanner() { this.stream = new MultiLineStream(''); this.ignoreComment = true; this.ignoreWhitespace = true; this.inURL = false; } Scanner.prototype.setSource = function (input) { this.stream = new MultiLineStream(input); }; Scanner.prototype.finishToken = function (offset, type, text) { return { offset: offset, len: this.stream.pos() - offset, type: type, text: text || this.stream.substring(offset) }; }; Scanner.prototype.substring = function (offset, len) { return this.stream.substring(offset, offset + len); }; Scanner.prototype.pos = function () { return this.stream.pos(); }; Scanner.prototype.goBackTo = function (pos) { this.stream.goBackTo(pos); }; Scanner.prototype.scanUnquotedString = function () { var offset = this.stream.pos(); var content = []; if (this._unquotedString(content)) { return this.finishToken(offset, TokenType.UnquotedString, content.join('')); } return null; }; Scanner.prototype.scan = function () { // processes all whitespaces and comments var triviaToken = this.trivia(); if (triviaToken !== null) { return triviaToken; } var offset = this.stream.pos(); // End of file/input if (this.stream.eos()) { return this.finishToken(offset, TokenType.EOF); } return this.scanNext(offset); }; Scanner.prototype.scanNext = function (offset) { // CDO if (this.stream.advanceIfChars([_MIN, _MIN, _RAN])) { return this.finishToken(offset, TokenType.CDC); } var content = []; if (this.ident(content)) { return this.finishToken(offset, TokenType.Ident, content.join('')); } // at-keyword if (this.stream.advanceIfChar(_ATS)) { content = ['@']; if (this._name(content)) { var keywordText = content.join(''); if (keywordText === '@charset') { return this.finishToken(offset, TokenType.Charset, keywordText); } return this.finishToken(offset, TokenType.AtKeyword, keywordText); } else { return this.finishToken(offset, TokenType.Delim); } } // hash if (this.stream.advanceIfChar(_HSH)) { content = ['#']; if (this._name(content)) { return this.finishToken(offset, TokenType.Hash, content.join('')); } else { return this.finishToken(offset, TokenType.Delim); } } // Important if (this.stream.advanceIfChar(_BNG)) { return this.finishToken(offset, TokenType.Exclamation); } // Numbers if (this._number()) { var pos = this.stream.pos(); content = [this.stream.substring(offset, pos)]; if (this.stream.advanceIfChar(_PRC)) { // Percentage 43% return this.finishToken(offset, TokenType.Percentage); } else if (this.ident(content)) { var dim = this.stream.substring(pos).toLowerCase(); var tokenType_1 = staticUnitTable[dim]; if (typeof tokenType_1 !== 'undefined') { // Known dimension 43px return this.finishToken(offset, tokenType_1, content.join('')); } else { // Unknown dimension 43ft return this.finishToken(offset, TokenType.Dimension, content.join('')); } } return this.finishToken(offset, TokenType.Num); } // String, BadString content = []; var tokenType = this._string(content); if (tokenType !== null) { return this.finishToken(offset, tokenType, content.join('')); } // single character tokens tokenType = staticTokenTable[this.stream.peekChar()]; if (typeof tokenType !== 'undefined') { this.stream.advance(1); return this.finishToken(offset, tokenType); } // includes ~= if (this.stream.peekChar(0) === _TLD && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.Includes); } // DashMatch |= if (this.stream.peekChar(0) === _PIP && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.Dashmatch); } // Substring operator *= if (this.stream.peekChar(0) === _MUL && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.SubstringOperator); } // Substring operator ^= if (this.stream.peekChar(0) === _HAT && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.PrefixOperator); } // Substring operator $= if (this.stream.peekChar(0) === _DLR && this.stream.peekChar(1) === _EQS) { this.stream.advance(2); return this.finishToken(offset, TokenType.SuffixOperator); } // Delim this.stream.nextChar(); return this.finishToken(offset, TokenType.Delim); }; Scanner.prototype.trivia = function () { while (true) { var offset = this.stream.pos(); if (this._whitespace()) { if (!this.ignoreWhitespace) { return this.finishToken(offset, TokenType.Whitespace); } } else if (this.comment()) { if (!this.ignoreComment) { return this.finishToken(offset, TokenType.Comment); } } else { return null; } } }; Scanner.prototype.comment = function () { if (this.stream.advanceIfChars([_FSL, _MUL])) { var success_1 = false, hot_1 = false; this.stream.advanceWhileChar(function (ch) { if (hot_1 && ch === _FSL) { success_1 = true; return false; } hot_1 = ch === _MUL; return true; }); if (success_1) { this.stream.advance(1); } return true; } return false; }; Scanner.prototype._number = function () { var npeek = 0, ch; if (this.stream.peekChar() === _DOT) { npeek = 1; } ch = this.stream.peekChar(npeek); if (ch >= _0 && ch <= _9) { this.stream.advance(npeek + 1); this.stream.advanceWhileChar(function (ch) { return ch >= _0 && ch <= _9 || npeek === 0 && ch === _DOT; }); return true; } return false; }; Scanner.prototype._newline = function (result) { var ch = this.stream.peekChar(); switch (ch) { case _CAR: case _LFD: case _NWL: this.stream.advance(1); result.push(String.fromCharCode(ch)); if (ch === _CAR && this.stream.advanceIfChar(_NWL)) { result.push('\n'); } return true; } return false; }; Scanner.prototype._escape = function (result, includeNewLines) { var ch = this.stream.peekChar(); if (ch === _BSL) { this.stream.advance(1); ch = this.stream.peekChar(); var hexNumCount = 0; while (hexNumCount < 6 && (ch >= _0 && ch <= _9 || ch >= _a && ch <= _f || ch >= _A && ch <= _F)) { this.stream.advance(1); ch = this.stream.peekChar(); hexNumCount++; } if (hexNumCount > 0) { try { var hexVal = parseInt(this.stream.substring(this.stream.pos() - hexNumCount), 16); if (hexVal) { result.push(String.fromCharCode(hexVal)); } } catch (e) { // ignore } // optional whitespace or new line, not part of result text if (ch === _WSP || ch === _TAB) { this.stream.advance(1); } else { this._newline([]); } return true; } if (ch !== _CAR && ch !== _LFD && ch !== _NWL) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } else if (includeNewLines) { return this._newline(result); } } return false; }; Scanner.prototype._stringChar = function (closeQuote, result) { // not closeQuote, not backslash, not newline var ch = this.stream.peekChar(); if (ch !== 0 && ch !== closeQuote && ch !== _BSL && ch !== _CAR && ch !== _LFD && ch !== _NWL) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._string = function (result) { if (this.stream.peekChar() === _SQO || this.stream.peekChar() === _DQO) { var closeQuote = this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); while (this._stringChar(closeQuote, result) || this._escape(result, true)) { // loop } if (this.stream.peekChar() === closeQuote) { this.stream.nextChar(); result.push(String.fromCharCode(closeQuote)); return TokenType.String; } else { return TokenType.BadString; } } return null; }; Scanner.prototype._unquotedChar = function (result) { // not closeQuote, not backslash, not newline var ch = this.stream.peekChar(); if (ch !== 0 && ch !== _BSL && ch !== _SQO && ch !== _DQO && ch !== _LPA && ch !== _RPA && ch !== _WSP && ch !== _TAB && ch !== _NWL && ch !== _LFD && ch !== _CAR) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._unquotedString = function (result) { var hasContent = false; while (this._unquotedChar(result) || this._escape(result)) { hasContent = true; } return hasContent; }; Scanner.prototype._whitespace = function () { var n = this.stream.advanceWhileChar(function (ch) { return ch === _WSP || ch === _TAB || ch === _NWL || ch === _LFD || ch === _CAR; }); return n > 0; }; Scanner.prototype._name = function (result) { var matched = false; while (this._identChar(result) || this._escape(result)) { matched = true; } return matched; }; Scanner.prototype.ident = function (result) { var pos = this.stream.pos(); var hasMinus = this._minus(result); if (hasMinus && this._minus(result) /* -- */) { if (this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { // loop } return true; } } else if (this._identFirstChar(result) || this._escape(result)) { while (this._identChar(result) || this._escape(result)) { // loop } return true; } this.stream.goBackTo(pos); return false; }; Scanner.prototype._identFirstChar = function (result) { var ch = this.stream.peekChar(); if (ch === _USC || // _ ch >= _a && ch <= _z || // a-z ch >= _A && ch <= _Z || // A-Z ch >= 0x80 && ch <= 0xFFFF) { // nonascii this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._minus = function (result) { var ch = this.stream.peekChar(); if (ch === _MIN) { this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; Scanner.prototype._identChar = function (result) { var ch = this.stream.peekChar(); if (ch === _USC || // _ ch === _MIN || // - ch >= _a && ch <= _z || // a-z ch >= _A && ch <= _Z || // A-Z ch >= _0 && ch <= _9 || // 0/9 ch >= 0x80 && ch <= 0xFFFF) { // nonascii this.stream.advance(1); result.push(String.fromCharCode(ch)); return true; } return false; }; return Scanner; }()); /***/ }), /* 91 */ /***/ ((__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__(92); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /// /// Nodes for the css 2.1 specification. See for reference: /// http://www.w3.org/TR/CSS21/grammar.html#grammar /// var NodeType; (function (NodeType) { NodeType[NodeType["Undefined"] = 0] = "Undefined"; NodeType[NodeType["Identifier"] = 1] = "Identifier"; NodeType[NodeType["Stylesheet"] = 2] = "Stylesheet"; NodeType[NodeType["Ruleset"] = 3] = "Ruleset"; NodeType[NodeType["Selector"] = 4] = "Selector"; NodeType[NodeType["SimpleSelector"] = 5] = "SimpleSelector"; NodeType[NodeType["SelectorInterpolation"] = 6] = "SelectorInterpolation"; NodeType[NodeType["SelectorCombinator"] = 7] = "SelectorCombinator"; NodeType[NodeType["SelectorCombinatorParent"] = 8] = "SelectorCombinatorParent"; NodeType[NodeType["SelectorCombinatorSibling"] = 9] = "SelectorCombinatorSibling"; NodeType[NodeType["SelectorCombinatorAllSiblings"] = 10] = "SelectorCombinatorAllSiblings"; NodeType[NodeType["SelectorCombinatorShadowPiercingDescendant"] = 11] = "SelectorCombinatorShadowPiercingDescendant"; NodeType[NodeType["Page"] = 12] = "Page"; NodeType[NodeType["PageBoxMarginBox"] = 13] = "PageBoxMarginBox"; NodeType[NodeType["ClassSelector"] = 14] = "ClassSelector"; NodeType[NodeType["IdentifierSelector"] = 15] = "IdentifierSelector"; NodeType[NodeType["ElementNameSelector"] = 16] = "ElementNameSelector"; NodeType[NodeType["PseudoSelector"] = 17] = "PseudoSelector"; NodeType[NodeType["AttributeSelector"] = 18] = "AttributeSelector"; NodeType[NodeType["Declaration"] = 19] = "Declaration"; NodeType[NodeType["Declarations"] = 20] = "Declarations"; NodeType[NodeType["Property"] = 21] = "Property"; NodeType[NodeType["Expression"] = 22] = "Expression"; NodeType[NodeType["BinaryExpression"] = 23] = "BinaryExpression"; NodeType[NodeType["Term"] = 24] = "Term"; NodeType[NodeType["Operator"] = 25] = "Operator"; NodeType[NodeType["Value"] = 26] = "Value"; NodeType[NodeType["StringLiteral"] = 27] = "StringLiteral"; NodeType[NodeType["URILiteral"] = 28] = "URILiteral"; NodeType[NodeType["EscapedValue"] = 29] = "EscapedValue"; NodeType[NodeType["Function"] = 30] = "Function"; NodeType[NodeType["NumericValue"] = 31] = "NumericValue"; NodeType[NodeType["HexColorValue"] = 32] = "HexColorValue"; NodeType[NodeType["MixinDeclaration"] = 33] = "MixinDeclaration"; NodeType[NodeType["MixinReference"] = 34] = "MixinReference"; NodeType[NodeType["VariableName"] = 35] = "VariableName"; NodeType[NodeType["VariableDeclaration"] = 36] = "VariableDeclaration"; NodeType[NodeType["Prio"] = 37] = "Prio"; NodeType[NodeType["Interpolation"] = 38] = "Interpolation"; NodeType[NodeType["NestedProperties"] = 39] = "NestedProperties"; NodeType[NodeType["ExtendsReference"] = 40] = "ExtendsReference"; NodeType[NodeType["SelectorPlaceholder"] = 41] = "SelectorPlaceholder"; NodeType[NodeType["Debug"] = 42] = "Debug"; NodeType[NodeType["If"] = 43] = "If"; NodeType[NodeType["Else"] = 44] = "Else"; NodeType[NodeType["For"] = 45] = "For"; NodeType[NodeType["Each"] = 46] = "Each"; NodeType[NodeType["While"] = 47] = "While"; NodeType[NodeType["MixinContentReference"] = 48] = "MixinContentReference"; NodeType[NodeType["MixinContentDeclaration"] = 49] = "MixinContentDeclaration"; NodeType[NodeType["Media"] = 50] = "Media"; NodeType[NodeType["Keyframe"] = 51] = "Keyframe"; NodeType[NodeType["FontFace"] = 52] = "FontFace"; NodeType[NodeType["Import"] = 53] = "Import"; NodeType[NodeType["Namespace"] = 54] = "Namespace"; NodeType[NodeType["Invocation"] = 55] = "Invocation"; NodeType[NodeType["FunctionDeclaration"] = 56] = "FunctionDeclaration"; NodeType[NodeType["ReturnStatement"] = 57] = "ReturnStatement"; NodeType[NodeType["MediaQuery"] = 58] = "MediaQuery"; NodeType[NodeType["FunctionParameter"] = 59] = "FunctionParameter"; NodeType[NodeType["FunctionArgument"] = 60] = "FunctionArgument"; NodeType[NodeType["KeyframeSelector"] = 61] = "KeyframeSelector"; NodeType[NodeType["ViewPort"] = 62] = "ViewPort"; NodeType[NodeType["Document"] = 63] = "Document"; NodeType[NodeType["AtApplyRule"] = 64] = "AtApplyRule"; NodeType[NodeType["CustomPropertyDeclaration"] = 65] = "CustomPropertyDeclaration"; NodeType[NodeType["CustomPropertySet"] = 66] = "CustomPropertySet"; NodeType[NodeType["ListEntry"] = 67] = "ListEntry"; NodeType[NodeType["Supports"] = 68] = "Supports"; NodeType[NodeType["SupportsCondition"] = 69] = "SupportsCondition"; NodeType[NodeType["NamespacePrefix"] = 70] = "NamespacePrefix"; NodeType[NodeType["GridLine"] = 71] = "GridLine"; NodeType[NodeType["Plugin"] = 72] = "Plugin"; NodeType[NodeType["UnknownAtRule"] = 73] = "UnknownAtRule"; NodeType[NodeType["Use"] = 74] = "Use"; NodeType[NodeType["ModuleConfiguration"] = 75] = "ModuleConfiguration"; NodeType[NodeType["Forward"] = 76] = "Forward"; NodeType[NodeType["ForwardVisibility"] = 77] = "ForwardVisibility"; NodeType[NodeType["Module"] = 78] = "Module"; })(NodeType || (NodeType = {})); var ReferenceType; (function (ReferenceType) { ReferenceType[ReferenceType["Mixin"] = 0] = "Mixin"; ReferenceType[ReferenceType["Rule"] = 1] = "Rule"; ReferenceType[ReferenceType["Variable"] = 2] = "Variable"; ReferenceType[ReferenceType["Function"] = 3] = "Function"; ReferenceType[ReferenceType["Keyframe"] = 4] = "Keyframe"; ReferenceType[ReferenceType["Unknown"] = 5] = "Unknown"; ReferenceType[ReferenceType["Module"] = 6] = "Module"; ReferenceType[ReferenceType["Forward"] = 7] = "Forward"; ReferenceType[ReferenceType["ForwardVisibility"] = 8] = "ForwardVisibility"; })(ReferenceType || (ReferenceType = {})); function getNodeAtOffset(node, offset) { var candidate = null; if (!node || offset < node.offset || offset > node.end) { return null; } // Find the shortest node at the position node.accept(function (node) { if (node.offset === -1 && node.length === -1) { return true; } if (node.offset <= offset && node.end >= offset) { if (!candidate) { candidate = node; } else if (node.length <= candidate.length) { candidate = node; } return true; } return false; }); return candidate; } function getNodePath(node, offset) { var candidate = getNodeAtOffset(node, offset); var path = []; while (candidate) { path.unshift(candidate); candidate = candidate.parent; } return path; } function getParentDeclaration(node) { var decl = node.findParent(NodeType.Declaration); var value = decl && decl.getValue(); if (value && value.encloses(node)) { return decl; } return null; } var Node = /** @class */ (function () { function Node(offset, len, nodeType) { if (offset === void 0) { offset = -1; } if (len === void 0) { len = -1; } this.parent = null; this.offset = offset; this.length = len; if (nodeType) { this.nodeType = nodeType; } } Object.defineProperty(Node.prototype, "end", { get: function () { return this.offset + this.length; }, enumerable: false, configurable: true }); Object.defineProperty(Node.prototype, "type", { get: function () { return this.nodeType || NodeType.Undefined; }, set: function (type) { this.nodeType = type; }, enumerable: false, configurable: true }); Node.prototype.getTextProvider = function () { var node = this; while (node && !node.textProvider) { node = node.parent; } if (node) { return node.textProvider; } return function () { return 'unknown'; }; }; Node.prototype.getText = function () { return this.getTextProvider()(this.offset, this.length); }; Node.prototype.matches = function (str) { return this.length === str.length && this.getTextProvider()(this.offset, this.length) === str; }; Node.prototype.startsWith = function (str) { return this.length >= str.length && this.getTextProvider()(this.offset, str.length) === str; }; Node.prototype.endsWith = function (str) { return this.length >= str.length && this.getTextProvider()(this.end - str.length, str.length) === str; }; Node.prototype.accept = function (visitor) { if (visitor(this) && this.children) { for (var _i = 0, _a = this.children; _i < _a.length; _i++) { var child = _a[_i]; child.accept(visitor); } } }; Node.prototype.acceptVisitor = function (visitor) { this.accept(visitor.visitNode.bind(visitor)); }; Node.prototype.adoptChild = function (node, index) { if (index === void 0) { index = -1; } if (node.parent && node.parent.children) { var idx = node.parent.children.indexOf(node); if (idx >= 0) { node.parent.children.splice(idx, 1); } } node.parent = this; var children = this.children; if (!children) { children = this.children = []; } if (index !== -1) { children.splice(index, 0, node); } else { children.push(node); } return node; }; Node.prototype.attachTo = function (parent, index) { if (index === void 0) { index = -1; } if (parent) { parent.adoptChild(this, index); } return this; }; Node.prototype.collectIssues = function (results) { if (this.issues) { results.push.apply(results, this.issues); } }; Node.prototype.addIssue = function (issue) { if (!this.issues) { this.issues = []; } this.issues.push(issue); }; Node.prototype.hasIssue = function (rule) { return Array.isArray(this.issues) && this.issues.some(function (i) { return i.getRule() === rule; }); }; Node.prototype.isErroneous = function (recursive) { if (recursive === void 0) { recursive = false; } if (this.issues && this.issues.length > 0) { return true; } return recursive && Array.isArray(this.children) && this.children.some(function (c) { return c.isErroneous(true); }); }; Node.prototype.setNode = function (field, node, index) { if (index === void 0) { index = -1; } if (node) { node.attachTo(this, index); this[field] = node; return true; } return false; }; Node.prototype.addChild = function (node) { if (node) { if (!this.children) { this.children = []; } node.attachTo(this); this.updateOffsetAndLength(node); return true; } return false; }; Node.prototype.updateOffsetAndLength = function (node) { if (node.offset < this.offset || this.offset === -1) { this.offset = node.offset; } var nodeEnd = node.end; if ((nodeEnd > this.end) || this.length === -1) { this.length = nodeEnd - this.offset; } }; Node.prototype.hasChildren = function () { return !!this.children && this.children.length > 0; }; Node.prototype.getChildren = function () { return this.children ? this.children.slice(0) : []; }; Node.prototype.getChild = function (index) { if (this.children && index < this.children.length) { return this.children[index]; } return null; }; Node.prototype.addChildren = function (nodes) { for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; this.addChild(node); } }; Node.prototype.findFirstChildBeforeOffset = function (offset) { if (this.children) { var current = null; for (var i = this.children.length - 1; i >= 0; i--) { // iterate until we find a child that has a start offset smaller than the input offset current = this.children[i]; if (current.offset <= offset) { return current; } } } return null; }; Node.prototype.findChildAtOffset = function (offset, goDeep) { var current = this.findFirstChildBeforeOffset(offset); if (current && current.end >= offset) { if (goDeep) { return current.findChildAtOffset(offset, true) || current; } return current; } return null; }; Node.prototype.encloses = function (candidate) { return this.offset <= candidate.offset && this.offset + this.length >= candidate.offset + candidate.length; }; Node.prototype.getParent = function () { var result = this.parent; while (result instanceof Nodelist) { result = result.parent; } return result; }; Node.prototype.findParent = function (type) { var result = this; while (result && result.type !== type) { result = result.parent; } return result; }; Node.prototype.findAParent = function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } var result = this; while (result && !types.some(function (t) { return result.type === t; })) { result = result.parent; } return result; }; Node.prototype.setData = function (key, value) { if (!this.options) { this.options = {}; } this.options[key] = value; }; Node.prototype.getData = function (key) { if (!this.options || !this.options.hasOwnProperty(key)) { return null; } return this.options[key]; }; return Node; }()); var Nodelist = /** @class */ (function (_super) { __extends(Nodelist, _super); function Nodelist(parent, index) { if (index === void 0) { index = -1; } var _this = _super.call(this, -1, -1) || this; _this.attachTo(parent, index); _this.offset = -1; _this.length = -1; return _this; } return Nodelist; }(Node)); var Identifier = /** @class */ (function (_super) { __extends(Identifier, _super); function Identifier(offset, length) { var _this = _super.call(this, offset, length) || this; _this.isCustomProperty = false; return _this; } Object.defineProperty(Identifier.prototype, "type", { get: function () { return NodeType.Identifier; }, enumerable: false, configurable: true }); Identifier.prototype.containsInterpolation = function () { return this.hasChildren(); }; return Identifier; }(Node)); var Stylesheet = /** @class */ (function (_super) { __extends(Stylesheet, _super); function Stylesheet(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Stylesheet.prototype, "type", { get: function () { return NodeType.Stylesheet; }, enumerable: false, configurable: true }); return Stylesheet; }(Node)); var Declarations = /** @class */ (function (_super) { __extends(Declarations, _super); function Declarations(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Declarations.prototype, "type", { get: function () { return NodeType.Declarations; }, enumerable: false, configurable: true }); return Declarations; }(Node)); var BodyDeclaration = /** @class */ (function (_super) { __extends(BodyDeclaration, _super); function BodyDeclaration(offset, length) { return _super.call(this, offset, length) || this; } BodyDeclaration.prototype.getDeclarations = function () { return this.declarations; }; BodyDeclaration.prototype.setDeclarations = function (decls) { return this.setNode('declarations', decls); }; return BodyDeclaration; }(Node)); var RuleSet = /** @class */ (function (_super) { __extends(RuleSet, _super); function RuleSet(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(RuleSet.prototype, "type", { get: function () { return NodeType.Ruleset; }, enumerable: false, configurable: true }); RuleSet.prototype.getSelectors = function () { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; }; RuleSet.prototype.isNested = function () { return !!this.parent && this.parent.findParent(NodeType.Declarations) !== null; }; return RuleSet; }(BodyDeclaration)); var Selector = /** @class */ (function (_super) { __extends(Selector, _super); function Selector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Selector.prototype, "type", { get: function () { return NodeType.Selector; }, enumerable: false, configurable: true }); return Selector; }(Node)); var SimpleSelector = /** @class */ (function (_super) { __extends(SimpleSelector, _super); function SimpleSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(SimpleSelector.prototype, "type", { get: function () { return NodeType.SimpleSelector; }, enumerable: false, configurable: true }); return SimpleSelector; }(Node)); var AtApplyRule = /** @class */ (function (_super) { __extends(AtApplyRule, _super); function AtApplyRule(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(AtApplyRule.prototype, "type", { get: function () { return NodeType.AtApplyRule; }, enumerable: false, configurable: true }); AtApplyRule.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; AtApplyRule.prototype.getIdentifier = function () { return this.identifier; }; AtApplyRule.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return AtApplyRule; }(Node)); var AbstractDeclaration = /** @class */ (function (_super) { __extends(AbstractDeclaration, _super); function AbstractDeclaration(offset, length) { return _super.call(this, offset, length) || this; } return AbstractDeclaration; }(Node)); var CustomPropertyDeclaration = /** @class */ (function (_super) { __extends(CustomPropertyDeclaration, _super); function CustomPropertyDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(CustomPropertyDeclaration.prototype, "type", { get: function () { return NodeType.CustomPropertyDeclaration; }, enumerable: false, configurable: true }); CustomPropertyDeclaration.prototype.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; }, enumerable: false, configurable: true }); return CustomPropertySet; }(BodyDeclaration)); var Declaration = /** @class */ (function (_super) { __extends(Declaration, _super); function Declaration(offset, length) { var _this = _super.call(this, offset, length) || this; _this.property = null; return _this; } Object.defineProperty(Declaration.prototype, "type", { get: function () { return NodeType.Declaration; }, enumerable: false, configurable: true }); Declaration.prototype.setProperty = function (node) { return this.setNode('property', node); }; Declaration.prototype.getProperty = function () { return this.property; }; Declaration.prototype.getFullPropertyName = function () { var propertyName = this.property ? this.property.getName() : 'unknown'; if (this.parent instanceof Declarations && this.parent.getParent() instanceof NestedProperties) { var parentDecl = this.parent.getParent().getParent(); if (parentDecl instanceof Declaration) { return parentDecl.getFullPropertyName() + propertyName; } } return propertyName; }; Declaration.prototype.getNonPrefixedPropertyName = function () { var propertyName = this.getFullPropertyName(); if (propertyName && propertyName.charAt(0) === '-') { var vendorPrefixEnd = propertyName.indexOf('-', 1); if (vendorPrefixEnd !== -1) { return propertyName.substring(vendorPrefixEnd + 1); } } return propertyName; }; Declaration.prototype.setValue = function (value) { return this.setNode('value', value); }; Declaration.prototype.getValue = function () { return this.value; }; Declaration.prototype.setNestedProperties = function (value) { return this.setNode('nestedProperties', value); }; Declaration.prototype.getNestedProperties = function () { return this.nestedProperties; }; return Declaration; }(AbstractDeclaration)); var Property = /** @class */ (function (_super) { __extends(Property, _super); function Property(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Property.prototype, "type", { get: function () { return NodeType.Property; }, enumerable: false, configurable: true }); Property.prototype.setIdentifier = function (value) { return this.setNode('identifier', value); }; Property.prototype.getIdentifier = function () { return this.identifier; }; Property.prototype.getName = function () { return (0,_utils_strings__WEBPACK_IMPORTED_MODULE_0__.trim)(this.getText(), /[_\+]+$/); /* +_: less merge */ }; Property.prototype.isCustomProperty = function () { return !!this.identifier && this.identifier.isCustomProperty; }; return Property; }(Node)); var Invocation = /** @class */ (function (_super) { __extends(Invocation, _super); function Invocation(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Invocation.prototype, "type", { get: function () { return NodeType.Invocation; }, enumerable: false, configurable: true }); Invocation.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; return Invocation; }(Node)); var Function = /** @class */ (function (_super) { __extends(Function, _super); function Function(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Function.prototype, "type", { get: function () { return NodeType.Function; }, enumerable: false, configurable: true }); Function.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Function.prototype.getIdentifier = function () { return this.identifier; }; Function.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return Function; }(Invocation)); var FunctionParameter = /** @class */ (function (_super) { __extends(FunctionParameter, _super); function FunctionParameter(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionParameter.prototype, "type", { get: function () { return NodeType.FunctionParameter; }, enumerable: false, configurable: true }); FunctionParameter.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionParameter.prototype.getIdentifier = function () { return this.identifier; }; FunctionParameter.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionParameter.prototype.setDefaultValue = function (node) { return this.setNode('defaultValue', node, 0); }; FunctionParameter.prototype.getDefaultValue = function () { return this.defaultValue; }; return FunctionParameter; }(Node)); var FunctionArgument = /** @class */ (function (_super) { __extends(FunctionArgument, _super); function FunctionArgument(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionArgument.prototype, "type", { get: function () { return NodeType.FunctionArgument; }, enumerable: false, configurable: true }); FunctionArgument.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionArgument.prototype.getIdentifier = function () { return this.identifier; }; FunctionArgument.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionArgument.prototype.setValue = function (node) { return this.setNode('value', node, 0); }; FunctionArgument.prototype.getValue = function () { return this.value; }; return FunctionArgument; }(Node)); var IfStatement = /** @class */ (function (_super) { __extends(IfStatement, _super); function IfStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(IfStatement.prototype, "type", { get: function () { return NodeType.If; }, enumerable: false, configurable: true }); IfStatement.prototype.setExpression = function (node) { return this.setNode('expression', node, 0); }; IfStatement.prototype.setElseClause = function (elseClause) { return this.setNode('elseClause', elseClause); }; return IfStatement; }(BodyDeclaration)); var ForStatement = /** @class */ (function (_super) { __extends(ForStatement, _super); function ForStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ForStatement.prototype, "type", { get: function () { return NodeType.For; }, enumerable: false, configurable: true }); ForStatement.prototype.setVariable = function (node) { return this.setNode('variable', node, 0); }; return ForStatement; }(BodyDeclaration)); var EachStatement = /** @class */ (function (_super) { __extends(EachStatement, _super); function EachStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(EachStatement.prototype, "type", { get: function () { return NodeType.Each; }, enumerable: false, configurable: true }); EachStatement.prototype.getVariables = function () { if (!this.variables) { this.variables = new Nodelist(this); } return this.variables; }; return EachStatement; }(BodyDeclaration)); var WhileStatement = /** @class */ (function (_super) { __extends(WhileStatement, _super); function WhileStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(WhileStatement.prototype, "type", { get: function () { return NodeType.While; }, enumerable: false, configurable: true }); return WhileStatement; }(BodyDeclaration)); var ElseStatement = /** @class */ (function (_super) { __extends(ElseStatement, _super); function ElseStatement(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ElseStatement.prototype, "type", { get: function () { return NodeType.Else; }, enumerable: false, configurable: true }); return ElseStatement; }(BodyDeclaration)); var FunctionDeclaration = /** @class */ (function (_super) { __extends(FunctionDeclaration, _super); function FunctionDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FunctionDeclaration.prototype, "type", { get: function () { return NodeType.FunctionDeclaration; }, enumerable: false, configurable: true }); FunctionDeclaration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; FunctionDeclaration.prototype.getIdentifier = function () { return this.identifier; }; FunctionDeclaration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; FunctionDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; return FunctionDeclaration; }(BodyDeclaration)); var ViewPort = /** @class */ (function (_super) { __extends(ViewPort, _super); function ViewPort(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ViewPort.prototype, "type", { get: function () { return NodeType.ViewPort; }, enumerable: false, configurable: true }); return ViewPort; }(BodyDeclaration)); var FontFace = /** @class */ (function (_super) { __extends(FontFace, _super); function FontFace(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(FontFace.prototype, "type", { get: function () { return NodeType.FontFace; }, enumerable: false, configurable: true }); return FontFace; }(BodyDeclaration)); var NestedProperties = /** @class */ (function (_super) { __extends(NestedProperties, _super); function NestedProperties(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(NestedProperties.prototype, "type", { get: function () { return NodeType.NestedProperties; }, enumerable: false, configurable: true }); return NestedProperties; }(BodyDeclaration)); var Keyframe = /** @class */ (function (_super) { __extends(Keyframe, _super); function Keyframe(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Keyframe.prototype, "type", { get: function () { return NodeType.Keyframe; }, enumerable: false, configurable: true }); Keyframe.prototype.setKeyword = function (keyword) { return this.setNode('keyword', keyword, 0); }; Keyframe.prototype.getKeyword = function () { return this.keyword; }; Keyframe.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Keyframe.prototype.getIdentifier = function () { return this.identifier; }; Keyframe.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; return Keyframe; }(BodyDeclaration)); var KeyframeSelector = /** @class */ (function (_super) { __extends(KeyframeSelector, _super); function KeyframeSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(KeyframeSelector.prototype, "type", { get: function () { return NodeType.KeyframeSelector; }, enumerable: false, configurable: true }); return KeyframeSelector; }(BodyDeclaration)); var Import = /** @class */ (function (_super) { __extends(Import, _super); function Import(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Import.prototype, "type", { get: function () { return NodeType.Import; }, enumerable: false, configurable: true }); Import.prototype.setMedialist = function (node) { if (node) { node.attachTo(this); return true; } return false; }; return Import; }(Node)); var Use = /** @class */ (function (_super) { __extends(Use, _super); function Use() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Use.prototype, "type", { get: function () { return NodeType.Use; }, enumerable: false, configurable: true }); Use.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; Use.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Use.prototype.getIdentifier = function () { return this.identifier; }; return Use; }(Node)); var ModuleConfiguration = /** @class */ (function (_super) { __extends(ModuleConfiguration, _super); function ModuleConfiguration() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ModuleConfiguration.prototype, "type", { get: function () { return NodeType.ModuleConfiguration; }, enumerable: false, configurable: true }); ModuleConfiguration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; ModuleConfiguration.prototype.getIdentifier = function () { return this.identifier; }; ModuleConfiguration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; ModuleConfiguration.prototype.setValue = function (node) { return this.setNode('value', node, 0); }; ModuleConfiguration.prototype.getValue = function () { return this.value; }; return ModuleConfiguration; }(Node)); var Forward = /** @class */ (function (_super) { __extends(Forward, _super); function Forward() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Forward.prototype, "type", { get: function () { return NodeType.Forward; }, enumerable: false, configurable: true }); Forward.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Forward.prototype.getIdentifier = function () { return this.identifier; }; return Forward; }(Node)); var ForwardVisibility = /** @class */ (function (_super) { __extends(ForwardVisibility, _super); function ForwardVisibility() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ForwardVisibility.prototype, "type", { get: function () { return NodeType.ForwardVisibility; }, enumerable: false, configurable: true }); ForwardVisibility.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; ForwardVisibility.prototype.getIdentifier = function () { return this.identifier; }; return ForwardVisibility; }(Node)); var Namespace = /** @class */ (function (_super) { __extends(Namespace, _super); function Namespace(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Namespace.prototype, "type", { get: function () { return NodeType.Namespace; }, enumerable: false, configurable: true }); return Namespace; }(Node)); var Media = /** @class */ (function (_super) { __extends(Media, _super); function Media(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Media.prototype, "type", { get: function () { return NodeType.Media; }, enumerable: false, configurable: true }); return Media; }(BodyDeclaration)); var Supports = /** @class */ (function (_super) { __extends(Supports, _super); function Supports(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Supports.prototype, "type", { get: function () { return NodeType.Supports; }, enumerable: false, configurable: true }); return Supports; }(BodyDeclaration)); var Document = /** @class */ (function (_super) { __extends(Document, _super); function Document(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Document.prototype, "type", { get: function () { return NodeType.Document; }, enumerable: false, configurable: true }); return Document; }(BodyDeclaration)); var Medialist = /** @class */ (function (_super) { __extends(Medialist, _super); function Medialist(offset, length) { return _super.call(this, offset, length) || this; } Medialist.prototype.getMediums = function () { if (!this.mediums) { this.mediums = new Nodelist(this); } return this.mediums; }; return Medialist; }(Node)); var MediaQuery = /** @class */ (function (_super) { __extends(MediaQuery, _super); function MediaQuery(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MediaQuery.prototype, "type", { get: function () { return NodeType.MediaQuery; }, enumerable: false, configurable: true }); return MediaQuery; }(Node)); var SupportsCondition = /** @class */ (function (_super) { __extends(SupportsCondition, _super); function SupportsCondition(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(SupportsCondition.prototype, "type", { get: function () { return NodeType.SupportsCondition; }, enumerable: false, configurable: true }); return SupportsCondition; }(Node)); var Page = /** @class */ (function (_super) { __extends(Page, _super); function Page(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Page.prototype, "type", { get: function () { return NodeType.Page; }, enumerable: false, configurable: true }); return Page; }(BodyDeclaration)); var PageBoxMarginBox = /** @class */ (function (_super) { __extends(PageBoxMarginBox, _super); function PageBoxMarginBox(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(PageBoxMarginBox.prototype, "type", { get: function () { return NodeType.PageBoxMarginBox; }, enumerable: false, configurable: true }); return PageBoxMarginBox; }(BodyDeclaration)); var Expression = /** @class */ (function (_super) { __extends(Expression, _super); function Expression(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Expression.prototype, "type", { get: function () { return NodeType.Expression; }, enumerable: false, configurable: true }); return Expression; }(Node)); var BinaryExpression = /** @class */ (function (_super) { __extends(BinaryExpression, _super); function BinaryExpression(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(BinaryExpression.prototype, "type", { get: function () { return NodeType.BinaryExpression; }, enumerable: false, configurable: true }); BinaryExpression.prototype.setLeft = function (left) { return this.setNode('left', left); }; BinaryExpression.prototype.getLeft = function () { return this.left; }; BinaryExpression.prototype.setRight = function (right) { return this.setNode('right', right); }; BinaryExpression.prototype.getRight = function () { return this.right; }; BinaryExpression.prototype.setOperator = function (value) { return this.setNode('operator', value); }; BinaryExpression.prototype.getOperator = function () { return this.operator; }; return BinaryExpression; }(Node)); var Term = /** @class */ (function (_super) { __extends(Term, _super); function Term(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Term.prototype, "type", { get: function () { return NodeType.Term; }, enumerable: false, configurable: true }); Term.prototype.setOperator = function (value) { return this.setNode('operator', value); }; Term.prototype.getOperator = function () { return this.operator; }; Term.prototype.setExpression = function (value) { return this.setNode('expression', value); }; Term.prototype.getExpression = function () { return this.expression; }; return Term; }(Node)); var AttributeSelector = /** @class */ (function (_super) { __extends(AttributeSelector, _super); function AttributeSelector(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(AttributeSelector.prototype, "type", { get: function () { return NodeType.AttributeSelector; }, enumerable: false, configurable: true }); AttributeSelector.prototype.setNamespacePrefix = function (value) { return this.setNode('namespacePrefix', value); }; AttributeSelector.prototype.getNamespacePrefix = function () { return this.namespacePrefix; }; AttributeSelector.prototype.setIdentifier = function (value) { return this.setNode('identifier', value); }; AttributeSelector.prototype.getIdentifier = function () { return this.identifier; }; AttributeSelector.prototype.setOperator = function (operator) { return this.setNode('operator', operator); }; AttributeSelector.prototype.getOperator = function () { return this.operator; }; AttributeSelector.prototype.setValue = function (value) { return this.setNode('value', value); }; AttributeSelector.prototype.getValue = function () { return this.value; }; return AttributeSelector; }(Node)); var Operator = /** @class */ (function (_super) { __extends(Operator, _super); function Operator(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Operator.prototype, "type", { get: function () { return NodeType.Operator; }, enumerable: false, configurable: true }); return Operator; }(Node)); var HexColorValue = /** @class */ (function (_super) { __extends(HexColorValue, _super); function HexColorValue(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(HexColorValue.prototype, "type", { get: function () { return NodeType.HexColorValue; }, enumerable: false, configurable: true }); return HexColorValue; }(Node)); var _dot = '.'.charCodeAt(0), _0 = '0'.charCodeAt(0), _9 = '9'.charCodeAt(0); var NumericValue = /** @class */ (function (_super) { __extends(NumericValue, _super); function NumericValue(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(NumericValue.prototype, "type", { get: function () { return NodeType.NumericValue; }, enumerable: false, configurable: true }); NumericValue.prototype.getValue = function () { var raw = this.getText(); var unitIdx = 0; var code; for (var i = 0, len = raw.length; i < len; i++) { code = raw.charCodeAt(i); if (!(_0 <= code && code <= _9 || code === _dot)) { break; } unitIdx += 1; } return { value: raw.substring(0, unitIdx), unit: unitIdx < raw.length ? raw.substring(unitIdx) : undefined }; }; return NumericValue; }(Node)); var VariableDeclaration = /** @class */ (function (_super) { __extends(VariableDeclaration, _super); function VariableDeclaration(offset, length) { var _this = _super.call(this, offset, length) || this; _this.variable = null; _this.value = null; _this.needsSemicolon = true; return _this; } Object.defineProperty(VariableDeclaration.prototype, "type", { get: function () { return NodeType.VariableDeclaration; }, enumerable: false, configurable: true }); VariableDeclaration.prototype.setVariable = function (node) { if (node) { node.attachTo(this); this.variable = node; return true; } return false; }; VariableDeclaration.prototype.getVariable = function () { return this.variable; }; VariableDeclaration.prototype.getName = function () { return this.variable ? this.variable.getName() : ''; }; VariableDeclaration.prototype.setValue = function (node) { if (node) { node.attachTo(this); this.value = node; return true; } return false; }; VariableDeclaration.prototype.getValue = function () { return this.value; }; return VariableDeclaration; }(AbstractDeclaration)); var Interpolation = /** @class */ (function (_super) { __extends(Interpolation, _super); // private _interpolations: void; // workaround for https://github.com/Microsoft/TypeScript/issues/18276 function Interpolation(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Interpolation.prototype, "type", { get: function () { return NodeType.Interpolation; }, enumerable: false, configurable: true }); return Interpolation; }(Node)); var Variable = /** @class */ (function (_super) { __extends(Variable, _super); function Variable(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(Variable.prototype, "type", { get: function () { return NodeType.VariableName; }, enumerable: false, configurable: true }); Variable.prototype.getName = function () { return this.getText(); }; return Variable; }(Node)); var ExtendsReference = /** @class */ (function (_super) { __extends(ExtendsReference, _super); function ExtendsReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(ExtendsReference.prototype, "type", { get: function () { return NodeType.ExtendsReference; }, enumerable: false, configurable: true }); ExtendsReference.prototype.getSelectors = function () { if (!this.selectors) { this.selectors = new Nodelist(this); } return this.selectors; }; return ExtendsReference; }(Node)); var MixinContentReference = /** @class */ (function (_super) { __extends(MixinContentReference, _super); function MixinContentReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinContentReference.prototype, "type", { get: function () { return NodeType.MixinContentReference; }, enumerable: false, configurable: true }); MixinContentReference.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; return MixinContentReference; }(Node)); var MixinContentDeclaration = /** @class */ (function (_super) { __extends(MixinContentDeclaration, _super); function MixinContentDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinContentDeclaration.prototype, "type", { get: function () { return NodeType.MixinContentReference; }, enumerable: false, configurable: true }); MixinContentDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; return MixinContentDeclaration; }(BodyDeclaration)); var MixinReference = /** @class */ (function (_super) { __extends(MixinReference, _super); function MixinReference(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinReference.prototype, "type", { get: function () { return NodeType.MixinReference; }, enumerable: false, configurable: true }); MixinReference.prototype.getNamespaces = function () { if (!this.namespaces) { this.namespaces = new Nodelist(this); } return this.namespaces; }; MixinReference.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; MixinReference.prototype.getIdentifier = function () { return this.identifier; }; MixinReference.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; MixinReference.prototype.getArguments = function () { if (!this.arguments) { this.arguments = new Nodelist(this); } return this.arguments; }; MixinReference.prototype.setContent = function (node) { return this.setNode('content', node); }; MixinReference.prototype.getContent = function () { return this.content; }; return MixinReference; }(Node)); var MixinDeclaration = /** @class */ (function (_super) { __extends(MixinDeclaration, _super); function MixinDeclaration(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(MixinDeclaration.prototype, "type", { get: function () { return NodeType.MixinDeclaration; }, enumerable: false, configurable: true }); MixinDeclaration.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; MixinDeclaration.prototype.getIdentifier = function () { return this.identifier; }; MixinDeclaration.prototype.getName = function () { return this.identifier ? this.identifier.getText() : ''; }; MixinDeclaration.prototype.getParameters = function () { if (!this.parameters) { this.parameters = new Nodelist(this); } return this.parameters; }; MixinDeclaration.prototype.setGuard = function (node) { if (node) { node.attachTo(this); this.guard = node; } return false; }; return MixinDeclaration; }(BodyDeclaration)); var UnknownAtRule = /** @class */ (function (_super) { __extends(UnknownAtRule, _super); function UnknownAtRule(offset, length) { return _super.call(this, offset, length) || this; } Object.defineProperty(UnknownAtRule.prototype, "type", { get: function () { return NodeType.UnknownAtRule; }, enumerable: false, configurable: true }); UnknownAtRule.prototype.setAtRuleName = function (atRuleName) { this.atRuleName = atRuleName; }; UnknownAtRule.prototype.getAtRuleName = function () { return this.atRuleName; }; return UnknownAtRule; }(BodyDeclaration)); var ListEntry = /** @class */ (function (_super) { __extends(ListEntry, _super); function ListEntry() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ListEntry.prototype, "type", { get: function () { return NodeType.ListEntry; }, enumerable: false, configurable: true }); ListEntry.prototype.setKey = function (node) { return this.setNode('key', node, 0); }; ListEntry.prototype.setValue = function (node) { return this.setNode('value', node, 1); }; return ListEntry; }(Node)); var LessGuard = /** @class */ (function (_super) { __extends(LessGuard, _super); function LessGuard() { return _super !== null && _super.apply(this, arguments) || this; } LessGuard.prototype.getConditions = function () { if (!this.conditions) { this.conditions = new Nodelist(this); } return this.conditions; }; return LessGuard; }(Node)); var GuardCondition = /** @class */ (function (_super) { __extends(GuardCondition, _super); function GuardCondition() { return _super !== null && _super.apply(this, arguments) || this; } GuardCondition.prototype.setVariable = function (node) { return this.setNode('variable', node); }; return GuardCondition; }(Node)); var Module = /** @class */ (function (_super) { __extends(Module, _super); function Module() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(Module.prototype, "type", { get: function () { return NodeType.Module; }, enumerable: false, configurable: true }); Module.prototype.setIdentifier = function (node) { return this.setNode('identifier', node, 0); }; Module.prototype.getIdentifier = function () { return this.identifier; }; return Module; }(Node)); var Level; (function (Level) { Level[Level["Ignore"] = 1] = "Ignore"; Level[Level["Warning"] = 2] = "Warning"; Level[Level["Error"] = 4] = "Error"; })(Level || (Level = {})); var Marker = /** @class */ (function () { function Marker(node, rule, level, message, offset, length) { if (offset === void 0) { offset = node.offset; } if (length === void 0) { length = node.length; } this.node = node; this.rule = rule; this.level = level; this.message = message || rule.message; this.offset = offset; this.length = length; } Marker.prototype.getRule = function () { return this.rule; }; Marker.prototype.getLevel = function () { return this.level; }; Marker.prototype.getOffset = function () { return this.offset; }; Marker.prototype.getLength = function () { return this.length; }; Marker.prototype.getNode = function () { return this.node; }; Marker.prototype.getMessage = function () { return this.message; }; return Marker; }()); /* export class DefaultVisitor implements IVisitor { public visitNode(node:Node):boolean { switch (node.type) { case NodeType.Stylesheet: return this.visitStylesheet( node); case NodeType.FontFace: return this.visitFontFace( node); case NodeType.Ruleset: return this.visitRuleSet( node); case NodeType.Selector: return this.visitSelector( node); case NodeType.SimpleSelector: return this.visitSimpleSelector( node); case NodeType.Declaration: return this.visitDeclaration( node); case NodeType.Function: return this.visitFunction( node); case NodeType.FunctionDeclaration: return this.visitFunctionDeclaration( node); case NodeType.FunctionParameter: return this.visitFunctionParameter( node); case NodeType.FunctionArgument: return this.visitFunctionArgument( node); case NodeType.Term: return this.visitTerm( node); case NodeType.Declaration: return this.visitExpression( node); case NodeType.NumericValue: return this.visitNumericValue( node); case NodeType.Page: return this.visitPage( node); case NodeType.PageBoxMarginBox: return this.visitPageBoxMarginBox( node); case NodeType.Property: return this.visitProperty( node); case NodeType.NumericValue: return this.visitNodelist( node); case NodeType.Import: return this.visitImport( node); case NodeType.Namespace: return this.visitNamespace( node); case NodeType.Keyframe: return this.visitKeyframe( node); case NodeType.KeyframeSelector: return this.visitKeyframeSelector( node); case NodeType.MixinDeclaration: return this.visitMixinDeclaration( node); case NodeType.MixinReference: return this.visitMixinReference( node); case NodeType.Variable: return this.visitVariable( node); case NodeType.VariableDeclaration: return this.visitVariableDeclaration( node); } return this.visitUnknownNode(node); } public visitFontFace(node:FontFace):boolean { return true; } public visitKeyframe(node:Keyframe):boolean { return true; } public visitKeyframeSelector(node:KeyframeSelector):boolean { return true; } public visitStylesheet(node:Stylesheet):boolean { return true; } public visitProperty(Node:Property):boolean { return true; } public visitRuleSet(node:RuleSet):boolean { return true; } public visitSelector(node:Selector):boolean { return true; } public visitSimpleSelector(node:SimpleSelector):boolean { return true; } public visitDeclaration(node:Declaration):boolean { return true; } public visitFunction(node:Function):boolean { return true; } public visitFunctionDeclaration(node:FunctionDeclaration):boolean { return true; } public visitInvocation(node:Invocation):boolean { return true; } public visitTerm(node:Term):boolean { return true; } public visitImport(node:Import):boolean { return true; } public visitNamespace(node:Namespace):boolean { return true; } public visitExpression(node:Expression):boolean { return true; } public visitNumericValue(node:NumericValue):boolean { return true; } public visitPage(node:Page):boolean { return true; } public visitPageBoxMarginBox(node:PageBoxMarginBox):boolean { return true; } public visitNodelist(node:Nodelist):boolean { return true; } public visitVariableDeclaration(node:VariableDeclaration):boolean { return true; } public visitVariable(node:Variable):boolean { return true; } public visitMixinDeclaration(node:MixinDeclaration):boolean { return true; } public visitMixinReference(node:MixinReference):boolean { return true; } public visitUnknownNode(node:Node):boolean { return true; } } */ var ParseErrorCollector = /** @class */ (function () { function ParseErrorCollector() { this.entries = []; } ParseErrorCollector.entries = function (node) { var visitor = new ParseErrorCollector(); node.acceptVisitor(visitor); return visitor.entries; }; ParseErrorCollector.prototype.visitNode = function (node) { if (node.isErroneous()) { node.collectIssues(this.entries); } return true; }; return ParseErrorCollector; }()); /***/ }), /* 92 */ /***/ ((__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; } /***/ }), /* 93 */ /***/ ((__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__(94); /*--------------------------------------------------------------------------------------------- * 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")), }; /***/ }), /* 94 */ /***/ ((__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__(80); var ral_1 = __webpack_require__(95); var common_1 = __webpack_require__(96); var common_2 = __webpack_require__(96); Object.defineProperty(exports, "MessageFormat", ({ enumerable: true, get: function () { return common_2.MessageFormat; } })); Object.defineProperty(exports, "BundleFormat", ({ enumerable: true, get: function () { return common_2.BundleFormat; } })); var toString = Object.prototype.toString; function isNumber(value) { return toString.call(value) === '[object Number]'; } function isString(value) { return toString.call(value) === '[object String]'; } function isBoolean(value) { return value === true || value === false; } function readJsonFileSync(filename) { return JSON.parse(fs.readFileSync(filename, 'utf8')); } var resolvedBundles; var options; function initializeSettings() { options = { locale: undefined, language: undefined, languagePackSupport: false, cacheLanguageResolution: true, messageFormat: common_1.MessageFormat.bundle }; if (isString(process.env.VSCODE_NLS_CONFIG)) { try { var vscodeOptions_1 = JSON.parse(process.env.VSCODE_NLS_CONFIG); var language = void 0; if (vscodeOptions_1.availableLanguages) { var value = vscodeOptions_1.availableLanguages['*']; if (isString(value)) { language = value; } } if (isString(vscodeOptions_1.locale)) { options.locale = vscodeOptions_1.locale.toLowerCase(); } if (language === undefined) { options.language = options.locale; } else if (language !== 'en') { options.language = language; } if (isBoolean(vscodeOptions_1._languagePackSupport)) { options.languagePackSupport = vscodeOptions_1._languagePackSupport; } if (isString(vscodeOptions_1._cacheRoot)) { options.cacheRoot = vscodeOptions_1._cacheRoot; } if (isString(vscodeOptions_1._languagePackId)) { options.languagePackId = vscodeOptions_1._languagePackId; } if (isString(vscodeOptions_1._translationsConfigFile)) { options.translationsConfigFile = vscodeOptions_1._translationsConfigFile; try { options.translationsConfig = readJsonFileSync(options.translationsConfigFile); } catch (error) { // We can't read the translation config file. Mark the cache as corrupted. if (vscodeOptions_1._corruptedFile) { var dirname = path.dirname(vscodeOptions_1._corruptedFile); fs.exists(dirname, function (exists) { if (exists) { fs.writeFile(vscodeOptions_1._corruptedFile, 'corrupted', 'utf8', function (err) { console.error(err); }); } }); } } } } catch (_a) { // Do nothing. } } common_1.setPseudo(options.locale === 'pseudo'); resolvedBundles = Object.create(null); } initializeSettings(); function supportsLanguagePack() { return options.languagePackSupport === true && options.cacheRoot !== undefined && options.languagePackId !== undefined && options.translationsConfigFile !== undefined && options.translationsConfig !== undefined; } function createScopedLocalizeFunction(messages) { return function (key, message) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } if (isNumber(key)) { if (key >= messages.length) { console.error("Broken localize call found. Index out of bounds. Stacktrace is\n: " + new Error('').stack); return; } return common_1.format(messages[key], args); } else { if (isString(message)) { console.warn("Message " + message + " didn't get externalized correctly."); return common_1.format(message, args); } else { console.error("Broken localize call found. Stacktrace is\n: " + new Error('').stack); } } }; } function resolveLanguage(file) { var resolvedLanguage; if (options.cacheLanguageResolution && resolvedLanguage) { resolvedLanguage = resolvedLanguage; } else { if (common_1.isPseudo || !options.language) { resolvedLanguage = '.nls.json'; } else { var locale = options.language; while (locale) { var candidate = '.nls.' + locale + '.json'; if (fs.existsSync(file + candidate)) { resolvedLanguage = candidate; break; } else { var index = locale.lastIndexOf('-'); if (index > 0) { locale = locale.substring(0, index); } else { resolvedLanguage = '.nls.json'; locale = null; } } } } if (options.cacheLanguageResolution) { resolvedLanguage = resolvedLanguage; } } return file + resolvedLanguage; } function findInTheBoxBundle(root) { var language = options.language; while (language) { var candidate = path.join(root, "nls.bundle." + language + ".json"); if (fs.existsSync(candidate)) { return candidate; } else { var index = language.lastIndexOf('-'); if (index > 0) { language = language.substring(0, index); } else { language = undefined; } } } // Test if we can reslove the default bundle. if (language === undefined) { var candidate = path.join(root, 'nls.bundle.json'); if (fs.existsSync(candidate)) { return candidate; } } return undefined; } function mkdir(directory) { try { fs.mkdirSync(directory); } catch (err) { if (err.code === 'EEXIST') { return; } else if (err.code === 'ENOENT') { var parent = path.dirname(directory); if (parent !== directory) { mkdir(parent); fs.mkdirSync(directory); } } else { throw err; } } } function createDefaultNlsBundle(folder) { var metaData = readJsonFileSync(path.join(folder, 'nls.metadata.json')); var result = Object.create(null); for (var module_1 in metaData) { var entry = metaData[module_1]; result[module_1] = entry.messages; } return result; } function createNLSBundle(header, metaDataPath) { var languagePackLocation = options.translationsConfig[header.id]; if (!languagePackLocation) { return undefined; } var languagePack = readJsonFileSync(languagePackLocation).contents; var metaData = readJsonFileSync(path.join(metaDataPath, 'nls.metadata.json')); var result = Object.create(null); for (var module_2 in metaData) { var entry = metaData[module_2]; var translations = languagePack[header.outDir + "/" + module_2]; if (translations) { var resultMessages = []; for (var i = 0; i < entry.keys.length; i++) { var messageKey = entry.keys[i]; var key = isString(messageKey) ? messageKey : messageKey.key; var translatedMessage = translations[key]; if (translatedMessage === undefined) { translatedMessage = entry.messages[i]; } resultMessages.push(translatedMessage); } result[module_2] = resultMessages; } else { result[module_2] = entry.messages; } } return result; } function touch(file) { var d = new Date(); fs.utimes(file, d, d, function () { // Do nothing. Ignore }); } function cacheBundle(key, bundle) { resolvedBundles[key] = bundle; return bundle; } function loadNlsBundleOrCreateFromI18n(header, bundlePath) { var result; var bundle = path.join(options.cacheRoot, header.id + "-" + header.hash + ".json"); var useMemoryOnly = false; var writeBundle = false; try { result = JSON.parse(fs.readFileSync(bundle, { encoding: 'utf8', flag: 'r' })); touch(bundle); return result; } catch (err) { if (err.code === 'ENOENT') { writeBundle = true; } else if (err instanceof SyntaxError) { // We have a syntax error. So no valid JSON. Use console.log("Syntax error parsing message bundle: " + err.message + "."); fs.unlink(bundle, function (err) { if (err) { console.error("Deleting corrupted bundle " + bundle + " failed."); } }); useMemoryOnly = true; } else { throw err; } } result = createNLSBundle(header, bundlePath); if (!result || useMemoryOnly) { return result; } if (writeBundle) { try { fs.writeFileSync(bundle, JSON.stringify(result), { encoding: 'utf8', flag: 'wx' }); } catch (err) { if (err.code === 'EEXIST') { return result; } throw err; } } return result; } function loadDefaultNlsBundle(bundlePath) { try { return createDefaultNlsBundle(bundlePath); } catch (err) { console.log("Generating default bundle from meta data failed.", err); return undefined; } } function loadNlsBundle(header, bundlePath) { var result; // Core decided to use a language pack. Do the same in the extension if (supportsLanguagePack()) { try { result = loadNlsBundleOrCreateFromI18n(header, bundlePath); } catch (err) { console.log("Load or create bundle failed ", err); } } if (!result) { // No language pack found, but core is running in language pack mode // Don't try to use old in the box bundles since the might be stale // Fall right back to the default bundle. if (options.languagePackSupport) { return loadDefaultNlsBundle(bundlePath); } var candidate = findInTheBoxBundle(bundlePath); if (candidate) { try { return readJsonFileSync(candidate); } catch (err) { console.log("Loading in the box message bundle failed.", err); } } result = loadDefaultNlsBundle(bundlePath); } return result; } function tryFindMetaDataHeaderFile(file) { var result; var dirname = path.dirname(file); while (true) { result = path.join(dirname, 'nls.metadata.header.json'); if (fs.existsSync(result)) { break; } var parent = path.dirname(dirname); if (parent === dirname) { result = undefined; break; } else { dirname = parent; } } return result; } function loadMessageBundle(file) { if (!file) { // No file. We are in dev mode. Return the default // localize function. return common_1.localize; } // Remove extension since we load json files. var ext = path.extname(file); if (ext) { file = file.substr(0, file.length - ext.length); } if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.bundle) { var headerFile = tryFindMetaDataHeaderFile(file); if (headerFile) { var bundlePath = path.dirname(headerFile); var bundle = resolvedBundles[bundlePath]; if (bundle === undefined) { try { var header = JSON.parse(fs.readFileSync(headerFile, 'utf8')); try { var nlsBundle = loadNlsBundle(header, bundlePath); bundle = cacheBundle(bundlePath, nlsBundle ? { header: header, nlsBundle: nlsBundle } : null); } catch (err) { console.error('Failed to load nls bundle', err); bundle = cacheBundle(bundlePath, null); } } catch (err) { console.error('Failed to read header file', err); bundle = cacheBundle(bundlePath, null); } } if (bundle) { var module_3 = file.substr(bundlePath.length + 1).replace(/\\/g, '/'); var messages = bundle.nlsBundle[module_3]; if (messages === undefined) { console.error("Messages for file " + file + " not found. See console for details."); return function () { return 'Messages not found.'; }; } return createScopedLocalizeFunction(messages); } } } if (options.messageFormat === common_1.MessageFormat.both || options.messageFormat === common_1.MessageFormat.file) { // Try to load a single file bundle try { var json = readJsonFileSync(resolveLanguage(file)); if (Array.isArray(json)) { return createScopedLocalizeFunction(json); } else { if (common_1.isDefined(json.messages) && common_1.isDefined(json.keys)) { return createScopedLocalizeFunction(json.messages); } else { console.error("String bundle '" + file + "' uses an unsupported format."); return function () { return 'File bundle has unsupported format. See console for details'; }; } } } catch (err) { if (err.code !== 'ENOENT') { console.error('Failed to load single file bundle', err); } } } console.error("Failed to load message bundle for file " + file); return function () { return 'Failed to load message bundle. See console for details.'; }; } exports.loadMessageBundle = loadMessageBundle; function config(opts) { if (opts) { if (isString(opts.locale)) { options.locale = opts.locale.toLowerCase(); options.language = options.locale; resolvedBundles = Object.create(null); } if (opts.messageFormat !== undefined) { options.messageFormat = opts.messageFormat; } if (opts.bundleFormat === common_1.BundleFormat.standalone && options.languagePackSupport === true) { options.languagePackSupport = false; } } common_1.setPseudo(options.locale === 'pseudo'); return loadMessageBundle; } exports.config = config; ral_1.default.install(Object.freeze({ loadMessageBundle: loadMessageBundle, config: config })); //# sourceMappingURL=main.js.map /***/ }), /* 95 */ /***/ ((__unused_webpack_module, exports) => { Object.defineProperty(exports, "__esModule", ({ value: true })); var _ral; function RAL() { if (_ral === undefined) { throw new Error("No runtime abstraction layer installed"); } return _ral; } (function (RAL) { function install(ral) { if (ral === undefined) { throw new Error("No runtime abstraction layer provided"); } _ral = ral; } RAL.install = install; })(RAL || (RAL = {})); exports.default = RAL; //# sourceMappingURL=ral.js.map /***/ }), /* 96 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.config = exports.loadMessageBundle = exports.localize = exports.format = exports.setPseudo = exports.isPseudo = exports.isDefined = exports.BundleFormat = exports.MessageFormat = void 0; var ral_1 = __webpack_require__(95); var MessageFormat; (function (MessageFormat) { MessageFormat["file"] = "file"; MessageFormat["bundle"] = "bundle"; MessageFormat["both"] = "both"; })(MessageFormat = exports.MessageFormat || (exports.MessageFormat = {})); var BundleFormat; (function (BundleFormat) { // the nls.bundle format BundleFormat["standalone"] = "standalone"; BundleFormat["languagePack"] = "languagePack"; })(BundleFormat = exports.BundleFormat || (exports.BundleFormat = {})); var LocalizeInfo; (function (LocalizeInfo) { function is(value) { var candidate = value; return candidate && isDefined(candidate.key) && isDefined(candidate.comment); } LocalizeInfo.is = is; })(LocalizeInfo || (LocalizeInfo = {})); function isDefined(value) { return typeof value !== 'undefined'; } exports.isDefined = isDefined; exports.isPseudo = false; function setPseudo(pseudo) { exports.isPseudo = pseudo; } exports.setPseudo = setPseudo; function format(message, args) { var result; if (exports.isPseudo) { // FF3B and FF3D is the Unicode zenkaku representation for [ and ] message = '\uFF3B' + message.replace(/[aouei]/g, '$&$&') + '\uFF3D'; } if (args.length === 0) { result = message; } else { result = message.replace(/\{(\d+)\}/g, function (match, rest) { var index = rest[0]; var arg = args[index]; var replacement = match; if (typeof arg === 'string') { replacement = arg; } else if (typeof arg === 'number' || typeof arg === 'boolean' || arg === void 0 || arg === null) { replacement = String(arg); } return replacement; }); } return result; } exports.format = format; function localize(_key, message) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } return format(message, args); } exports.localize = localize; function loadMessageBundle(file) { return ral_1.default().loadMessageBundle(file); } exports.loadMessageBundle = loadMessageBundle; function config(opts) { return ral_1.default().config(opts); } exports.config = config; //# sourceMappingURL=common.js.map /***/ }), /* 97 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "browserNames": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.browserNames, /* harmony export */ "getBrowserLabel": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.getBrowserLabel, /* harmony export */ "getEntryDescription": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.getEntryDescription, /* harmony export */ "textToMarkedString": () => /* reexport safe */ _entry__WEBPACK_IMPORTED_MODULE_0__.textToMarkedString, /* harmony export */ "colorFrom256RGB": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFrom256RGB, /* harmony export */ "colorFromHSL": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFromHSL, /* harmony export */ "colorFromHex": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFromHex, /* harmony export */ "colorFunctions": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorFunctions, /* harmony export */ "colorKeywords": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colorKeywords, /* harmony export */ "colors": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.colors, /* harmony export */ "getColorValue": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.getColorValue, /* harmony export */ "hexDigit": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.hexDigit, /* harmony export */ "hslFromColor": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.hslFromColor, /* harmony export */ "isColorConstructor": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.isColorConstructor, /* harmony export */ "isColorValue": () => /* reexport safe */ _colors__WEBPACK_IMPORTED_MODULE_1__.isColorValue, /* harmony export */ "basicShapeFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions, /* harmony export */ "boxKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.boxKeywords, /* harmony export */ "cssWideKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords, /* harmony export */ "geometryBoxKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords, /* harmony export */ "html5Tags": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.html5Tags, /* harmony export */ "imageFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.imageFunctions, /* harmony export */ "lineStyleKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords, /* harmony export */ "lineWidthKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.lineWidthKeywords, /* harmony export */ "pageBoxDirectives": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.pageBoxDirectives, /* harmony export */ "positionKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.positionKeywords, /* harmony export */ "repeatStyleKeywords": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords, /* harmony export */ "svgElements": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.svgElements, /* harmony export */ "transitionTimingFunctions": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions, /* harmony export */ "units": () => /* reexport safe */ _builtinData__WEBPACK_IMPORTED_MODULE_2__.units /* harmony export */ }); /* harmony import */ var _entry__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(98); /* harmony import */ var _colors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(99); /* harmony import */ var _builtinData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(100); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ /***/ }), /* 98 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "browserNames": () => /* binding */ browserNames, /* harmony export */ "getEntryDescription": () => /* binding */ getEntryDescription, /* harmony export */ "textToMarkedString": () => /* binding */ textToMarkedString, /* harmony export */ "getBrowserLabel": () => /* binding */ getBrowserLabel /* harmony export */ }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var browserNames = { E: 'Edge', FF: 'Firefox', S: 'Safari', C: 'Chrome', IE: 'IE', O: 'Opera' }; function getEntryStatus(status) { switch (status) { case 'experimental': return '⚠️ Property is experimental. Be cautious when using it.️\n\n'; case 'nonstandard': return '🚨️ Property is nonstandard. Avoid using it.\n\n'; case 'obsolete': return '🚨️️️ Property is obsolete. Avoid using it.\n\n'; default: return ''; } } function getEntryDescription(entry, doesSupportMarkdown) { var result; if (doesSupportMarkdown) { result = { kind: 'markdown', value: getEntryMarkdownDescription(entry) }; } else { result = { kind: 'plaintext', value: getEntryStringDescription(entry) }; } if (result.value === '') { return undefined; } return result; } function textToMarkedString(text) { text = text.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash return text.replace(//g, '>'); } function getEntryStringDescription(entry) { if (!entry.description || entry.description === '') { return ''; } if (typeof entry.description !== 'string') { return entry.description.value; } var result = ''; if (entry.status) { result += getEntryStatus(entry.status); } result += entry.description; var browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += '\n(' + browserLabel + ')'; } if ('syntax' in entry) { result += "\n\nSyntax: " + entry.syntax; } if (entry.references && entry.references.length > 0) { result += '\n\n'; result += entry.references.map(function (r) { return r.name + ": " + r.url; }).join(' | '); } return result; } function getEntryMarkdownDescription(entry) { if (!entry.description || entry.description === '') { return ''; } var result = ''; if (entry.status) { result += getEntryStatus(entry.status); } var description = typeof entry.description === 'string' ? entry.description : entry.description.value; result += textToMarkedString(description); var browserLabel = getBrowserLabel(entry.browsers); if (browserLabel) { result += '\n\n(' + textToMarkedString(browserLabel) + ')'; } if ('syntax' in entry && entry.syntax) { result += "\n\nSyntax: " + textToMarkedString(entry.syntax); } if (entry.references && entry.references.length > 0) { result += '\n\n'; result += entry.references.map(function (r) { return "[" + r.name + "](" + r.url + ")"; }).join(' | '); } return result; } /** * Input is like `["E12","FF49","C47","IE","O"]` * Output is like `Edge 12, Firefox 49, Chrome 47, IE, Opera` */ function getBrowserLabel(browsers) { if (browsers === void 0) { browsers = []; } if (browsers.length === 0) { return null; } return browsers .map(function (b) { var result = ''; var matches = b.match(/([A-Z]+)(\d+)?/); var name = matches[1]; var version = matches[2]; if (name in browserNames) { result += browserNames[name]; } if (version) { result += ' ' + version; } return result; }) .join(', '); } /***/ }), /* 99 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "colorFunctions": () => /* binding */ colorFunctions, /* harmony export */ "colors": () => /* binding */ colors, /* harmony export */ "colorKeywords": () => /* binding */ colorKeywords, /* harmony export */ "isColorConstructor": () => /* binding */ isColorConstructor, /* harmony export */ "isColorValue": () => /* binding */ isColorValue, /* harmony export */ "hexDigit": () => /* binding */ hexDigit, /* harmony export */ "colorFromHex": () => /* binding */ colorFromHex, /* harmony export */ "colorFrom256RGB": () => /* binding */ colorFrom256RGB, /* harmony export */ "colorFromHSL": () => /* binding */ colorFromHSL, /* harmony export */ "hslFromColor": () => /* binding */ hslFromColor, /* harmony export */ "getColorValue": () => /* binding */ getColorValue /* harmony export */ }); /* harmony import */ var _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91); /* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(94); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_1__.loadMessageBundle(); var colorFunctions = [ { func: 'rgb($red, $green, $blue)', desc: localize('css.builtin.rgb', 'Creates a Color from red, green, and blue values.') }, { func: 'rgba($red, $green, $blue, $alpha)', desc: localize('css.builtin.rgba', 'Creates a Color from red, green, blue, and alpha values.') }, { func: 'hsl($hue, $saturation, $lightness)', desc: localize('css.builtin.hsl', 'Creates a Color from hue, saturation, and lightness values.') }, { func: 'hsla($hue, $saturation, $lightness, $alpha)', desc: localize('css.builtin.hsla', 'Creates a Color from hue, saturation, lightness, and alpha values.') } ]; var colors = { aliceblue: '#f0f8ff', antiquewhite: '#faebd7', aqua: '#00ffff', aquamarine: '#7fffd4', azure: '#f0ffff', beige: '#f5f5dc', bisque: '#ffe4c4', black: '#000000', blanchedalmond: '#ffebcd', blue: '#0000ff', blueviolet: '#8a2be2', brown: '#a52a2a', burlywood: '#deb887', cadetblue: '#5f9ea0', chartreuse: '#7fff00', chocolate: '#d2691e', coral: '#ff7f50', cornflowerblue: '#6495ed', cornsilk: '#fff8dc', crimson: '#dc143c', cyan: '#00ffff', darkblue: '#00008b', darkcyan: '#008b8b', darkgoldenrod: '#b8860b', darkgray: '#a9a9a9', darkgrey: '#a9a9a9', darkgreen: '#006400', darkkhaki: '#bdb76b', darkmagenta: '#8b008b', darkolivegreen: '#556b2f', darkorange: '#ff8c00', darkorchid: '#9932cc', darkred: '#8b0000', darksalmon: '#e9967a', darkseagreen: '#8fbc8f', darkslateblue: '#483d8b', darkslategray: '#2f4f4f', darkslategrey: '#2f4f4f', darkturquoise: '#00ced1', darkviolet: '#9400d3', deeppink: '#ff1493', deepskyblue: '#00bfff', dimgray: '#696969', dimgrey: '#696969', dodgerblue: '#1e90ff', firebrick: '#b22222', floralwhite: '#fffaf0', forestgreen: '#228b22', fuchsia: '#ff00ff', gainsboro: '#dcdcdc', ghostwhite: '#f8f8ff', gold: '#ffd700', goldenrod: '#daa520', gray: '#808080', grey: '#808080', green: '#008000', greenyellow: '#adff2f', honeydew: '#f0fff0', hotpink: '#ff69b4', indianred: '#cd5c5c', indigo: '#4b0082', ivory: '#fffff0', khaki: '#f0e68c', lavender: '#e6e6fa', lavenderblush: '#fff0f5', lawngreen: '#7cfc00', lemonchiffon: '#fffacd', lightblue: '#add8e6', lightcoral: '#f08080', lightcyan: '#e0ffff', lightgoldenrodyellow: '#fafad2', lightgray: '#d3d3d3', lightgrey: '#d3d3d3', lightgreen: '#90ee90', lightpink: '#ffb6c1', lightsalmon: '#ffa07a', lightseagreen: '#20b2aa', lightskyblue: '#87cefa', lightslategray: '#778899', lightslategrey: '#778899', lightsteelblue: '#b0c4de', lightyellow: '#ffffe0', lime: '#00ff00', limegreen: '#32cd32', linen: '#faf0e6', magenta: '#ff00ff', maroon: '#800000', mediumaquamarine: '#66cdaa', mediumblue: '#0000cd', mediumorchid: '#ba55d3', mediumpurple: '#9370d8', mediumseagreen: '#3cb371', mediumslateblue: '#7b68ee', mediumspringgreen: '#00fa9a', mediumturquoise: '#48d1cc', mediumvioletred: '#c71585', midnightblue: '#191970', mintcream: '#f5fffa', mistyrose: '#ffe4e1', moccasin: '#ffe4b5', navajowhite: '#ffdead', navy: '#000080', oldlace: '#fdf5e6', olive: '#808000', olivedrab: '#6b8e23', orange: '#ffa500', orangered: '#ff4500', orchid: '#da70d6', palegoldenrod: '#eee8aa', palegreen: '#98fb98', paleturquoise: '#afeeee', palevioletred: '#d87093', papayawhip: '#ffefd5', peachpuff: '#ffdab9', peru: '#cd853f', pink: '#ffc0cb', plum: '#dda0dd', powderblue: '#b0e0e6', purple: '#800080', red: '#ff0000', rebeccapurple: '#663399', rosybrown: '#bc8f8f', royalblue: '#4169e1', saddlebrown: '#8b4513', salmon: '#fa8072', sandybrown: '#f4a460', seagreen: '#2e8b57', seashell: '#fff5ee', sienna: '#a0522d', silver: '#c0c0c0', skyblue: '#87ceeb', slateblue: '#6a5acd', slategray: '#708090', slategrey: '#708090', snow: '#fffafa', springgreen: '#00ff7f', steelblue: '#4682b4', tan: '#d2b48c', teal: '#008080', thistle: '#d8bfd8', tomato: '#ff6347', turquoise: '#40e0d0', violet: '#ee82ee', wheat: '#f5deb3', white: '#ffffff', whitesmoke: '#f5f5f5', yellow: '#ffff00', yellowgreen: '#9acd32' }; var colorKeywords = { 'currentColor': 'The value of the \'color\' property. The computed value of the \'currentColor\' keyword is the computed value of the \'color\' property. If the \'currentColor\' keyword is set on the \'color\' property itself, it is treated as \'color:inherit\' at parse time.', 'transparent': 'Fully transparent. This keyword can be considered a shorthand for rgba(0,0,0,0) which is its computed value.', }; function getNumericValue(node, factor) { var val = node.getText(); var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(%?)$/); if (m) { if (m[2]) { factor = 100.0; } var result = parseFloat(m[1]) / factor; if (result >= 0 && result <= 1) { return result; } } throw new Error(); } function getAngle(node) { var val = node.getText(); var m = val.match(/^([-+]?[0-9]*\.?[0-9]+)(deg)?$/); if (m) { return parseFloat(val) % 360; } throw new Error(); } function isColorConstructor(node) { var name = node.getName(); if (!name) { return false; } return /^(rgb|rgba|hsl|hsla)$/gi.test(name); } /** * Returns true if the node is a color value - either * defined a hex number, as rgb or rgba function, or * as color name. */ function isColorValue(node) { if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.HexColorValue) { return true; } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Function) { return isColorConstructor(node); } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Identifier) { if (node.parent && node.parent.type !== _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) { return false; } var candidateColor = node.getText().toLowerCase(); if (candidateColor === 'none') { return false; } if (colors[candidateColor]) { return true; } } return false; } var Digit0 = 48; var Digit9 = 57; var A = 65; var F = 70; var a = 97; var f = 102; function hexDigit(charCode) { if (charCode < Digit0) { return 0; } if (charCode <= Digit9) { return charCode - Digit0; } if (charCode < a) { charCode += (a - A); } if (charCode >= a && charCode <= f) { return charCode - a + 10; } return 0; } function colorFromHex(text) { if (text[0] !== '#') { return null; } switch (text.length) { case 4: return { red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0, green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0, blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0, alpha: 1 }; case 5: return { red: (hexDigit(text.charCodeAt(1)) * 0x11) / 255.0, green: (hexDigit(text.charCodeAt(2)) * 0x11) / 255.0, blue: (hexDigit(text.charCodeAt(3)) * 0x11) / 255.0, alpha: (hexDigit(text.charCodeAt(4)) * 0x11) / 255.0, }; case 7: return { red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0, green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0, blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0, alpha: 1 }; case 9: return { red: (hexDigit(text.charCodeAt(1)) * 0x10 + hexDigit(text.charCodeAt(2))) / 255.0, green: (hexDigit(text.charCodeAt(3)) * 0x10 + hexDigit(text.charCodeAt(4))) / 255.0, blue: (hexDigit(text.charCodeAt(5)) * 0x10 + hexDigit(text.charCodeAt(6))) / 255.0, alpha: (hexDigit(text.charCodeAt(7)) * 0x10 + hexDigit(text.charCodeAt(8))) / 255.0 }; } return null; } function colorFrom256RGB(red, green, blue, alpha) { if (alpha === void 0) { alpha = 1.0; } return { red: red / 255.0, green: green / 255.0, blue: blue / 255.0, alpha: alpha }; } function colorFromHSL(hue, sat, light, alpha) { if (alpha === void 0) { alpha = 1.0; } hue = hue / 60.0; if (sat === 0) { return { red: light, green: light, blue: light, alpha: alpha }; } else { var hueToRgb = function (t1, t2, hue) { while (hue < 0) { hue += 6; } while (hue >= 6) { hue -= 6; } if (hue < 1) { return (t2 - t1) * hue + t1; } if (hue < 3) { return t2; } if (hue < 4) { return (t2 - t1) * (4 - hue) + t1; } return t1; }; var t2 = light <= 0.5 ? (light * (sat + 1)) : (light + sat - (light * sat)); var t1 = light * 2 - t2; return { red: hueToRgb(t1, t2, hue + 2), green: hueToRgb(t1, t2, hue), blue: hueToRgb(t1, t2, hue - 2), alpha: alpha }; } } function hslFromColor(rgba) { var r = rgba.red; var g = rgba.green; var b = rgba.blue; var a = rgba.alpha; var max = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var s = 0; var l = (min + max) / 2; var chroma = max - min; if (chroma > 0) { s = Math.min((l <= 0.5 ? chroma / (2 * l) : chroma / (2 - (2 * l))), 1); switch (max) { case r: h = (g - b) / chroma + (g < b ? 6 : 0); break; case g: h = (b - r) / chroma + 2; break; case b: h = (r - g) / chroma + 4; break; } h *= 60; h = Math.round(h); } return { h: h, s: s, l: l, a: a }; } function getColorValue(node) { if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.HexColorValue) { var text = node.getText(); return colorFromHex(text); } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Function) { var functionNode = node; var name = functionNode.getName(); var colorValues = functionNode.getArguments().getChildren(); if (!name || colorValues.length < 3 || colorValues.length > 4) { return null; } try { var alpha = colorValues.length === 4 ? getNumericValue(colorValues[3], 1) : 1; if (name === 'rgb' || name === 'rgba') { return { red: getNumericValue(colorValues[0], 255.0), green: getNumericValue(colorValues[1], 255.0), blue: getNumericValue(colorValues[2], 255.0), alpha: alpha }; } else if (name === 'hsl' || name === 'hsla') { var h = getAngle(colorValues[0]); var s = getNumericValue(colorValues[1], 100.0); var l = getNumericValue(colorValues[2], 100.0); return colorFromHSL(h, s, l, alpha); } } catch (e) { // parse error on numeric value return null; } } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Identifier) { if (node.parent && node.parent.type !== _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) { return null; } var term = node.parent; if (term && term.parent && term.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.BinaryExpression) { var expression = term.parent; if (expression.parent && expression.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ListEntry && expression.parent.key === expression) { return null; } } var candidateColor = node.getText().toLowerCase(); if (candidateColor === 'none') { return null; } var colorHex = colors[candidateColor]; if (colorHex) { return colorFromHex(colorHex); } } return null; } /***/ }), /* 100 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "positionKeywords": () => /* binding */ positionKeywords, /* harmony export */ "repeatStyleKeywords": () => /* binding */ repeatStyleKeywords, /* harmony export */ "lineStyleKeywords": () => /* binding */ lineStyleKeywords, /* harmony export */ "lineWidthKeywords": () => /* binding */ lineWidthKeywords, /* harmony export */ "boxKeywords": () => /* binding */ boxKeywords, /* harmony export */ "geometryBoxKeywords": () => /* binding */ geometryBoxKeywords, /* harmony export */ "cssWideKeywords": () => /* binding */ cssWideKeywords, /* harmony export */ "imageFunctions": () => /* binding */ imageFunctions, /* harmony export */ "transitionTimingFunctions": () => /* binding */ transitionTimingFunctions, /* harmony export */ "basicShapeFunctions": () => /* binding */ basicShapeFunctions, /* harmony export */ "units": () => /* binding */ units, /* harmony export */ "html5Tags": () => /* binding */ html5Tags, /* harmony export */ "svgElements": () => /* binding */ svgElements, /* harmony export */ "pageBoxDirectives": () => /* binding */ pageBoxDirectives /* harmony export */ }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var positionKeywords = { 'bottom': 'Computes to ‘100%’ for the vertical position if one or two values are given, otherwise specifies the bottom edge as the origin for the next offset.', 'center': 'Computes to ‘50%’ (‘left 50%’) for the horizontal position if the horizontal position is not otherwise specified, or ‘50%’ (‘top 50%’) for the vertical position if it is.', 'left': 'Computes to ‘0%’ for the horizontal position if one or two values are given, otherwise specifies the left edge as the origin for the next offset.', 'right': 'Computes to ‘100%’ for the horizontal position if one or two values are given, otherwise specifies the right edge as the origin for the next offset.', 'top': 'Computes to ‘0%’ for the vertical position if one or two values are given, otherwise specifies the top edge as the origin for the next offset.' }; var repeatStyleKeywords = { 'no-repeat': 'Placed once and not repeated in this direction.', 'repeat': 'Repeated in this direction as often as needed to cover the background painting area.', 'repeat-x': 'Computes to ‘repeat no-repeat’.', 'repeat-y': 'Computes to ‘no-repeat repeat’.', 'round': 'Repeated as often as will fit within the background positioning area. If it doesn’t fit a whole number of times, it is rescaled so that it does.', 'space': 'Repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area.' }; var lineStyleKeywords = { 'dashed': 'A series of square-ended dashes.', 'dotted': 'A series of round dots.', 'double': 'Two parallel solid lines with some space between them.', 'groove': 'Looks as if it were carved in the canvas.', 'hidden': 'Same as ‘none’, but has different behavior in the border conflict resolution rules for border-collapsed tables.', 'inset': 'Looks as if the content on the inside of the border is sunken into the canvas.', 'none': 'No border. Color and width are ignored.', 'outset': 'Looks as if the content on the inside of the border is coming out of the canvas.', 'ridge': 'Looks as if it were coming out of the canvas.', 'solid': 'A single line segment.' }; var lineWidthKeywords = ['medium', 'thick', 'thin']; var boxKeywords = { 'border-box': 'The background is painted within (clipped to) the border box.', 'content-box': 'The background is painted within (clipped to) the content box.', 'padding-box': 'The background is painted within (clipped to) the padding box.' }; var geometryBoxKeywords = { 'margin-box': 'Uses the margin box as reference box.', 'fill-box': 'Uses the object bounding box as reference box.', 'stroke-box': 'Uses the stroke bounding box as reference box.', 'view-box': 'Uses the nearest SVG viewport as reference box.' }; var cssWideKeywords = { 'initial': 'Represents the value specified as the property’s initial value.', 'inherit': 'Represents the computed value of the property on the element’s parent.', 'unset': 'Acts as either `inherit` or `initial`, depending on whether the property is inherited or not.' }; var imageFunctions = { 'url()': 'Reference an image file by URL', 'image()': 'Provide image fallbacks and annotations.', '-webkit-image-set()': 'Provide multiple resolutions. Remember to use unprefixed image-set() in addition.', 'image-set()': 'Provide multiple resolutions of an image and const the UA decide which is most appropriate in a given situation.', '-moz-element()': 'Use an element in the document as an image. Remember to use unprefixed element() in addition.', 'element()': 'Use an element in the document as an image.', 'cross-fade()': 'Indicates the two images to be combined and how far along in the transition the combination is.', '-webkit-gradient()': 'Deprecated. Use modern linear-gradient() or radial-gradient() instead.', '-webkit-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', '-moz-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', '-o-linear-gradient()': 'Linear gradient. Remember to use unprefixed version in addition.', 'linear-gradient()': 'A linear gradient is created by specifying a straight gradient line, and then several colors placed along that line.', '-webkit-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', '-moz-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', '-o-repeating-linear-gradient()': 'Repeating Linear gradient. Remember to use unprefixed version in addition.', 'repeating-linear-gradient()': 'Same as linear-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.', '-webkit-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.', '-moz-radial-gradient()': 'Radial gradient. Remember to use unprefixed version in addition.', 'radial-gradient()': 'Colors emerge from a single point and smoothly spread outward in a circular or elliptical shape.', '-webkit-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.', '-moz-repeating-radial-gradient()': 'Repeating radial gradient. Remember to use unprefixed version in addition.', 'repeating-radial-gradient()': 'Same as radial-gradient, except the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last specified color-stop’s position and the first specified color-stop’s position.' }; var transitionTimingFunctions = { 'ease': 'Equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).', 'ease-in': 'Equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).', 'ease-in-out': 'Equivalent to cubic-bezier(0.42, 0, 0.58, 1.0).', 'ease-out': 'Equivalent to cubic-bezier(0, 0, 0.58, 1.0).', 'linear': 'Equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).', 'step-end': 'Equivalent to steps(1, end).', 'step-start': 'Equivalent to steps(1, start).', 'steps()': 'The first parameter specifies the number of intervals in the function. The second parameter, which is optional, is either the value “start” or “end”.', 'cubic-bezier()': 'Specifies a cubic-bezier curve. The four values specify points P1 and P2 of the curve as (x1, y1, x2, y2).', 'cubic-bezier(0.6, -0.28, 0.735, 0.045)': 'Ease-in Back. Overshoots.', 'cubic-bezier(0.68, -0.55, 0.265, 1.55)': 'Ease-in-out Back. Overshoots.', 'cubic-bezier(0.175, 0.885, 0.32, 1.275)': 'Ease-out Back. Overshoots.', 'cubic-bezier(0.6, 0.04, 0.98, 0.335)': 'Ease-in Circular. Based on half circle.', 'cubic-bezier(0.785, 0.135, 0.15, 0.86)': 'Ease-in-out Circular. Based on half circle.', 'cubic-bezier(0.075, 0.82, 0.165, 1)': 'Ease-out Circular. Based on half circle.', 'cubic-bezier(0.55, 0.055, 0.675, 0.19)': 'Ease-in Cubic. Based on power of three.', 'cubic-bezier(0.645, 0.045, 0.355, 1)': 'Ease-in-out Cubic. Based on power of three.', 'cubic-bezier(0.215, 0.610, 0.355, 1)': 'Ease-out Cubic. Based on power of three.', 'cubic-bezier(0.95, 0.05, 0.795, 0.035)': 'Ease-in Exponential. Based on two to the power ten.', 'cubic-bezier(1, 0, 0, 1)': 'Ease-in-out Exponential. Based on two to the power ten.', 'cubic-bezier(0.19, 1, 0.22, 1)': 'Ease-out Exponential. Based on two to the power ten.', 'cubic-bezier(0.47, 0, 0.745, 0.715)': 'Ease-in Sine.', 'cubic-bezier(0.445, 0.05, 0.55, 0.95)': 'Ease-in-out Sine.', 'cubic-bezier(0.39, 0.575, 0.565, 1)': 'Ease-out Sine.', 'cubic-bezier(0.55, 0.085, 0.68, 0.53)': 'Ease-in Quadratic. Based on power of two.', 'cubic-bezier(0.455, 0.03, 0.515, 0.955)': 'Ease-in-out Quadratic. Based on power of two.', 'cubic-bezier(0.25, 0.46, 0.45, 0.94)': 'Ease-out Quadratic. Based on power of two.', 'cubic-bezier(0.895, 0.03, 0.685, 0.22)': 'Ease-in Quartic. Based on power of four.', 'cubic-bezier(0.77, 0, 0.175, 1)': 'Ease-in-out Quartic. Based on power of four.', 'cubic-bezier(0.165, 0.84, 0.44, 1)': 'Ease-out Quartic. Based on power of four.', 'cubic-bezier(0.755, 0.05, 0.855, 0.06)': 'Ease-in Quintic. Based on power of five.', 'cubic-bezier(0.86, 0, 0.07, 1)': 'Ease-in-out Quintic. Based on power of five.', 'cubic-bezier(0.23, 1, 0.320, 1)': 'Ease-out Quintic. Based on power of five.' }; var basicShapeFunctions = { 'circle()': 'Defines a circle.', 'ellipse()': 'Defines an ellipse.', 'inset()': 'Defines an inset rectangle.', 'polygon()': 'Defines a polygon.' }; var units = { 'length': ['em', 'rem', 'ex', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vw', 'vh', 'vmin', 'vmax'], 'angle': ['deg', 'rad', 'grad', 'turn'], 'time': ['ms', 's'], 'frequency': ['Hz', 'kHz'], 'resolution': ['dpi', 'dpcm', 'dppx'], 'percentage': ['%', 'fr'] }; var html5Tags = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'const', 'video', 'wbr']; var svgElements = ['circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'foreignObject', 'g', 'hatch', 'hatchpath', 'image', 'line', 'linearGradient', 'marker', 'mask', 'mesh', 'meshpatch', 'meshrow', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'set', 'solidcolor', 'stop', 'svg', 'switch', 'symbol', 'text', 'textPath', 'tspan', 'use', 'view']; var pageBoxDirectives = [ '@bottom-center', '@bottom-left', '@bottom-left-corner', '@bottom-right', '@bottom-right-corner', '@left-bottom', '@left-middle', '@left-top', '@right-bottom', '@right-middle', '@right-top', '@top-center', '@top-left', '@top-left-corner', '@top-right', '@top-right-corner' ]; /***/ }), /* 101 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "values": () => /* binding */ values, /* harmony export */ "isDefined": () => /* binding */ isDefined /* harmony export */ }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ function values(obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); } function isDefined(obj) { return typeof obj !== 'undefined'; } /***/ }), /* 102 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "CSSCompletion": () => /* binding */ CSSCompletion /* harmony export */ }); /* harmony import */ var _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91); /* harmony import */ var _parser_cssSymbolScope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(103); /* harmony import */ var _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(97); /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(92); /* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(105); /* harmony import */ var vscode_nls__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94); /* harmony import */ var _utils_objects__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(101); /* harmony import */ var _pathCompletion__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(108); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var localize = vscode_nls__WEBPACK_IMPORTED_MODULE_4__.loadMessageBundle(); var SnippetFormat = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.InsertTextFormat.Snippet; var SortTexts; (function (SortTexts) { // char code 32, comes before everything SortTexts["Enums"] = " "; SortTexts["Normal"] = "d"; SortTexts["VendorPrefixed"] = "x"; SortTexts["Term"] = "y"; SortTexts["Variable"] = "z"; })(SortTexts || (SortTexts = {})); var CSSCompletion = /** @class */ (function () { function CSSCompletion(variablePrefix, lsOptions, cssDataManager) { if (variablePrefix === void 0) { variablePrefix = null; } this.variablePrefix = variablePrefix; this.lsOptions = lsOptions; this.cssDataManager = cssDataManager; this.completionParticipants = []; } CSSCompletion.prototype.configure = function (settings) { this.settings = settings; }; CSSCompletion.prototype.getSymbolContext = function () { if (!this.symbolContext) { this.symbolContext = new _parser_cssSymbolScope__WEBPACK_IMPORTED_MODULE_1__.Symbols(this.styleSheet); } return this.symbolContext; }; CSSCompletion.prototype.setCompletionParticipants = function (registeredCompletionParticipants) { this.completionParticipants = registeredCompletionParticipants || []; }; CSSCompletion.prototype.doComplete2 = function (document, position, styleSheet, documentContext) { return __awaiter(this, void 0, void 0, function () { var participant, contributedParticipants, result, pathCompletionResult; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this.lsOptions.fileSystemProvider || !this.lsOptions.fileSystemProvider.readDirectory) { return [2 /*return*/, this.doComplete(document, position, styleSheet)]; } participant = new _pathCompletion__WEBPACK_IMPORTED_MODULE_5__.PathCompletionParticipant(this.lsOptions.fileSystemProvider.readDirectory); contributedParticipants = this.completionParticipants; this.completionParticipants = [participant].concat(contributedParticipants); result = this.doComplete(document, position, styleSheet); _a.label = 1; case 1: _a.trys.push([1, , 3, 4]); return [4 /*yield*/, participant.computeCompletions(document, documentContext)]; case 2: pathCompletionResult = _a.sent(); return [2 /*return*/, { isIncomplete: result.isIncomplete || pathCompletionResult.isIncomplete, items: pathCompletionResult.items.concat(result.items) }]; case 3: this.completionParticipants = contributedParticipants; return [7 /*endfinally*/]; case 4: return [2 /*return*/]; } }); }); }; CSSCompletion.prototype.doComplete = function (document, position, styleSheet) { this.offset = document.offsetAt(position); this.position = position; this.currentWord = getCurrentWord(document, this.offset); this.defaultReplaceRange = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Range.create(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); this.textDocument = document; this.styleSheet = styleSheet; try { var result = { isIncomplete: false, items: [] }; this.nodePath = _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.getNodePath(this.styleSheet, this.offset); for (var i = this.nodePath.length - 1; i >= 0; i--) { var node = this.nodePath[i]; if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Property) { this.getCompletionsForDeclarationProperty(node.getParent(), result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Expression) { if (node.parent instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Interpolation) { this.getVariableProposals(null, result); } else { this.getCompletionsForExpression(node, result); } } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SimpleSelector) { var parentRef = node.findAParent(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Ruleset); if (parentRef) { if (parentRef.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference) { this.getCompletionsForExtendsReference(parentRef, node, result); } else { var parentRuleSet = parentRef; this.getCompletionsForSelector(parentRuleSet, parentRuleSet && parentRuleSet.isNested(), result); } } } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument) { this.getCompletionsForFunctionArgument(node, node.getParent(), result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declarations) { this.getCompletionsForDeclarations(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.VariableDeclaration) { this.getCompletionsForVariableDeclaration(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) { this.getCompletionsForRuleSet(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Interpolation) { this.getCompletionsForInterpolation(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionDeclaration) { this.getCompletionsForFunctionDeclaration(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.MixinReference) { this.getCompletionsForMixinReference(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function) { this.getCompletionsForFunctionArgument(null, node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Supports) { this.getCompletionsForSupports(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) { this.getCompletionsForSupportsCondition(node, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.URILiteral) { this.getCompletionForUriLiteralValue(node, result); } else if (node.parent === null) { this.getCompletionForTopLevel(result); } else if (node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.StringLiteral && this.isImportPathParent(node.parent.type)) { this.getCompletionForImportPath(node, result); // } else if (node instanceof nodes.Variable) { // this.getCompletionsForVariableDeclaration() } else { continue; } if (result.items.length > 0 || this.offset > node.offset) { return this.finalize(result); } } this.getCompletionsForStylesheet(result); if (result.items.length === 0) { if (this.variablePrefix && this.currentWord.indexOf(this.variablePrefix) === 0) { this.getVariableProposals(null, result); } } return this.finalize(result); } finally { // don't hold on any state, clear symbolContext this.position = null; this.currentWord = null; this.textDocument = null; this.styleSheet = null; this.symbolContext = null; this.defaultReplaceRange = null; this.nodePath = null; } }; CSSCompletion.prototype.isImportPathParent = function (type) { return type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Import; }; CSSCompletion.prototype.finalize = function (result) { return result; }; CSSCompletion.prototype.findInNodePath = function () { var types = []; for (var _i = 0; _i < arguments.length; _i++) { types[_i] = arguments[_i]; } for (var i = this.nodePath.length - 1; i >= 0; i--) { var node = this.nodePath[i]; if (types.indexOf(node.type) !== -1) { return node; } } return null; }; CSSCompletion.prototype.getCompletionsForDeclarationProperty = function (declaration, result) { return this.getPropertyProposals(declaration, result); }; CSSCompletion.prototype.getPropertyProposals = function (declaration, result) { var _this = this; var triggerPropertyValueCompletion = this.isTriggerPropertyValueCompletionEnabled; var completePropertyWithSemicolon = this.isCompletePropertyWithSemicolonEnabled; var properties = this.cssDataManager.getProperties(); properties.forEach(function (entry) { var range; var insertText; var retrigger = false; if (declaration) { range = _this.getCompletionRange(declaration.getProperty()); insertText = entry.name; if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition)) { insertText += ': '; retrigger = true; } } else { range = _this.getCompletionRange(null); insertText = entry.name + ': '; retrigger = true; } // Empty .selector { | } case if (!declaration && completePropertyWithSemicolon) { insertText += '$0;'; } // Cases such as .selector { p; } or .selector { p:; } if (declaration && !declaration.semicolonPosition) { if (completePropertyWithSemicolon && _this.offset >= _this.textDocument.offsetAt(range.end)) { insertText += '$0;'; } } var item = { label: entry.name, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemTag.Deprecated] : [], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(range, insertText), insertTextFormat: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.InsertTextFormat.Snippet, kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Property }; if (!entry.restrictions) { retrigger = false; } if (triggerPropertyValueCompletion && retrigger) { item.command = { title: 'Suggest', command: 'editor.action.triggerSuggest' }; } var relevance = typeof entry.relevance === 'number' ? Math.min(Math.max(entry.relevance, 0), 99) : 50; var sortTextSuffix = (255 - relevance).toString(16); var sortTextPrefix = _utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(entry.name, '-') ? SortTexts.VendorPrefixed : SortTexts.Normal; item.sortText = sortTextPrefix + '_' + sortTextSuffix; result.items.push(item); }); this.completionParticipants.forEach(function (participant) { if (participant.onCssProperty) { participant.onCssProperty({ propertyName: _this.currentWord, range: _this.defaultReplaceRange }); } }); return result; }; Object.defineProperty(CSSCompletion.prototype, "isTriggerPropertyValueCompletionEnabled", { get: function () { if (!this.settings || !this.settings.completion || this.settings.completion.triggerPropertyValueCompletion === undefined) { return true; } return this.settings.completion.triggerPropertyValueCompletion; }, enumerable: false, configurable: true }); Object.defineProperty(CSSCompletion.prototype, "isCompletePropertyWithSemicolonEnabled", { get: function () { if (!this.settings || !this.settings.completion || this.settings.completion.completePropertyWithSemicolon === undefined) { return true; } return this.settings.completion.completePropertyWithSemicolon; }, enumerable: false, configurable: true }); CSSCompletion.prototype.getCompletionsForDeclarationValue = function (node, result) { var _this = this; var propertyName = node.getFullPropertyName(); var entry = this.cssDataManager.getProperty(propertyName); var existingNode = node.getValue() || null; while (existingNode && existingNode.hasChildren()) { existingNode = existingNode.findChildAtOffset(this.offset, false); } this.completionParticipants.forEach(function (participant) { if (participant.onCssPropertyValue) { participant.onCssPropertyValue({ propertyName: propertyName, propertyValue: _this.currentWord, range: _this.getCompletionRange(existingNode) }); } }); if (entry) { if (entry.restrictions) { for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) { var restriction = _a[_i]; switch (restriction) { case 'color': this.getColorProposals(entry, existingNode, result); break; case 'position': this.getPositionProposals(entry, existingNode, result); break; case 'repeat': this.getRepeatStyleProposals(entry, existingNode, result); break; case 'line-style': this.getLineStyleProposals(entry, existingNode, result); break; case 'line-width': this.getLineWidthProposals(entry, existingNode, result); break; case 'geometry-box': this.getGeometryBoxProposals(entry, existingNode, result); break; case 'box': this.getBoxProposals(entry, existingNode, result); break; case 'image': this.getImageProposals(entry, existingNode, result); break; case 'timing-function': this.getTimingFunctionProposals(entry, existingNode, result); break; case 'shape': this.getBasicShapeProposals(entry, existingNode, result); break; } } } this.getValueEnumProposals(entry, existingNode, result); this.getCSSWideKeywordProposals(entry, existingNode, result); this.getUnitProposals(entry, existingNode, result); } else { var existingValues = collectValues(this.styleSheet, node); for (var _b = 0, _c = existingValues.getEntries(); _b < _c.length; _b++) { var existingValue = _c[_b]; result.items.push({ label: existingValue, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), existingValue), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } } this.getVariableProposals(existingNode, result); this.getTermProposals(entry, existingNode, result); return result; }; CSSCompletion.prototype.getValueEnumProposals = function (entry, existingNode, result) { if (entry.values) { for (var _i = 0, _a = entry.values; _i < _a.length; _i++) { var value = _a[_i]; var insertString = value.name; var insertTextFormat = void 0; if (_utils_strings__WEBPACK_IMPORTED_MODULE_7__.endsWith(insertString, ')')) { var from = insertString.lastIndexOf('('); if (from !== -1) { insertString = insertString.substr(0, from) + '($1)'; insertTextFormat = SnippetFormat; } } var sortText = SortTexts.Enums; if (_utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(value.name, '-')) { sortText += SortTexts.VendorPrefixed; } var item = { label: value.name, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(value, this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemTag.Deprecated] : [], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertString), sortText: sortText, kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value, insertTextFormat: insertTextFormat }; result.items.push(item); } } return result; }; CSSCompletion.prototype.getCSSWideKeywordProposals = function (entry, existingNode, result) { for (var keywords in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords) { result.items.push({ label: keywords, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.cssWideKeywords[keywords], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), keywords), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getCompletionsForInterpolation = function (node, result) { if (this.offset >= node.offset + 2) { this.getVariableProposals(null, result); } return result; }; CSSCompletion.prototype.getVariableProposals = function (existingNode, result) { var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { var symbol = symbols_1[_i]; var insertText = _utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(symbol.name, '--') ? "var(" + symbol.name + ")" : symbol.name; var completionItem = { label: symbol.name, documentation: symbol.value ? _utils_strings__WEBPACK_IMPORTED_MODULE_7__.getLimitedString(symbol.value) : symbol.value, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Variable, sortText: SortTexts.Variable }; if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) { completionItem.kind = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Color; } if (symbol.node.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionParameter) { var mixinNode = (symbol.node.getParent()); if (mixinNode.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.MixinDeclaration) { completionItem.detail = localize('completion.argument', 'argument from \'{0}\'', mixinNode.getName()); } } result.items.push(completionItem); } return result; }; CSSCompletion.prototype.getVariableProposalsForCSSVarFunction = function (result) { var symbols = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); symbols = symbols.filter(function (symbol) { return _utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(symbol.name, '--'); }); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; var completionItem = { label: symbol.name, documentation: symbol.value ? _utils_strings__WEBPACK_IMPORTED_MODULE_7__.getLimitedString(symbol.value) : symbol.value, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(null), symbol.name), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Variable }; if (typeof completionItem.documentation === 'string' && isColorString(completionItem.documentation)) { completionItem.kind = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Color; } result.items.push(completionItem); } return result; }; CSSCompletion.prototype.getUnitProposals = function (entry, existingNode, result) { var currentWord = '0'; if (this.currentWord.length > 0) { var numMatch = this.currentWord.match(/^-?\d[\.\d+]*/); if (numMatch) { currentWord = numMatch[0]; result.isIncomplete = currentWord.length === this.currentWord.length; } } else if (this.currentWord.length === 0) { result.isIncomplete = true; } if (existingNode && existingNode.parent && existingNode.parent.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Term) { existingNode = existingNode.getParent(); // include the unary operator } if (entry.restrictions) { for (var _i = 0, _a = entry.restrictions; _i < _a.length; _i++) { var restriction = _a[_i]; var units = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.units[restriction]; if (units) { for (var _b = 0, units_1 = units; _b < units_1.length; _b++) { var unit = units_1[_b]; var insertText = currentWord + unit; result.items.push({ label: insertText, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Unit }); } } } } return result; }; CSSCompletion.prototype.getCompletionRange = function (existingNode) { if (existingNode && existingNode.offset <= this.offset && this.offset <= existingNode.end) { var end = existingNode.end !== -1 ? this.textDocument.positionAt(existingNode.end) : this.position; var start = this.textDocument.positionAt(existingNode.offset); if (start.line === end.line) { return _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Range.create(start, end); // multi line edits are not allowed } } return this.defaultReplaceRange; }; CSSCompletion.prototype.getColorProposals = function (entry, existingNode, result) { for (var color in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors) { result.items.push({ label: color, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors[color], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), color), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Color }); } for (var color in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorKeywords) { result.items.push({ label: color, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorKeywords[color], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), color), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } var colorValues = new Set(); this.styleSheet.acceptVisitor(new ColorValueCollector(colorValues, this.offset)); for (var _i = 0, _a = colorValues.getEntries(); _i < _a.length; _i++) { var color = _a[_i]; result.items.push({ label: color, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), color), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Color }); } var _loop_1 = function (p) { var tabStop = 1; var replaceFunction = function (_match, p1) { return '${' + tabStop++ + ':' + p1 + '}'; }; var insertText = p.func.replace(/\[?\$(\w+)\]?/g, replaceFunction); result.items.push({ label: p.func.substr(0, p.func.indexOf('(')), detail: p.func, documentation: p.desc, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this_1.getCompletionRange(existingNode), insertText), insertTextFormat: SnippetFormat, kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function }); }; var this_1 = this; for (var _b = 0, _c = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colorFunctions; _b < _c.length; _b++) { var p = _c[_b]; _loop_1(p); } return result; }; CSSCompletion.prototype.getPositionProposals = function (entry, existingNode, result) { for (var position in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.positionKeywords) { result.items.push({ label: position, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.positionKeywords[position], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), position), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getRepeatStyleProposals = function (entry, existingNode, result) { for (var repeat in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords) { result.items.push({ label: repeat, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.repeatStyleKeywords[repeat], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), repeat), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getLineStyleProposals = function (entry, existingNode, result) { for (var lineStyle in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords) { result.items.push({ label: lineStyle, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineStyleKeywords[lineStyle], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), lineStyle), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getLineWidthProposals = function (entry, existingNode, result) { for (var _i = 0, _a = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.lineWidthKeywords; _i < _a.length; _i++) { var lineWidth = _a[_i]; result.items.push({ label: lineWidth, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), lineWidth), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getGeometryBoxProposals = function (entry, existingNode, result) { for (var box in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords) { result.items.push({ label: box, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.geometryBoxKeywords[box], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), box), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getBoxProposals = function (entry, existingNode, result) { for (var box in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.boxKeywords) { result.items.push({ label: box, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.boxKeywords[box], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), box), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Value }); } return result; }; CSSCompletion.prototype.getImageProposals = function (entry, existingNode, result) { for (var image in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.imageFunctions) { var insertText = moveCursorInsideParenthesis(image); result.items.push({ label: image, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.imageFunctions[image], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, insertTextFormat: image !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getTimingFunctionProposals = function (entry, existingNode, result) { for (var timing in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions) { var insertText = moveCursorInsideParenthesis(timing); result.items.push({ label: timing, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.transitionTimingFunctions[timing], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, insertTextFormat: timing !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getBasicShapeProposals = function (entry, existingNode, result) { for (var shape in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions) { var insertText = moveCursorInsideParenthesis(shape); result.items.push({ label: shape, documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.basicShapeFunctions[shape], textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, insertTextFormat: shape !== insertText ? SnippetFormat : void 0 }); } return result; }; CSSCompletion.prototype.getCompletionsForStylesheet = function (result) { var node = this.styleSheet.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionForTopLevel(result); } if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) { return this.getCompletionsForRuleSet(node, result); } if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Supports) { return this.getCompletionsForSupports(node, result); } return result; }; CSSCompletion.prototype.getCompletionForTopLevel = function (result) { var _this = this; this.cssDataManager.getAtDirectives().forEach(function (entry) { result.items.push({ label: entry.name, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(_this.getCompletionRange(null), entry.name), documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemTag.Deprecated] : [], kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Keyword }); }); this.getCompletionsForSelector(null, false, result); return result; }; CSSCompletion.prototype.getCompletionsForRuleSet = function (ruleSet, result) { var declarations = ruleSet.getDeclarations(); var isAfter = declarations && declarations.endsWith('}') && this.offset >= declarations.end; if (isAfter) { return this.getCompletionForTopLevel(result); } var isInSelectors = !declarations || this.offset <= declarations.offset; if (isInSelectors) { return this.getCompletionsForSelector(ruleSet, ruleSet.isNested(), result); } return this.getCompletionsForDeclarations(ruleSet.getDeclarations(), result); }; CSSCompletion.prototype.getCompletionsForSelector = function (ruleSet, isNested, result) { var _this = this; var existingNode = this.findInNodePath(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.PseudoSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.IdentifierSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ClassSelector, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ElementNameSelector); if (!existingNode && this.offset - this.currentWord.length > 0 && this.textDocument.getText()[this.offset - this.currentWord.length - 1] === ':') { // after the ':' of a pseudo selector, no node generated for just ':' this.currentWord = ':' + this.currentWord; this.defaultReplaceRange = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Range.create(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); } var pseudoClasses = this.cssDataManager.getPseudoClasses(); pseudoClasses.forEach(function (entry) { var insertText = moveCursorInsideParenthesis(entry.name); var item = { label: entry.name, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(_this.getCompletionRange(existingNode), insertText), documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemTag.Deprecated] : [], kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (_utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(entry.name, ':-')) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); var pseudoElements = this.cssDataManager.getPseudoElements(); pseudoElements.forEach(function (entry) { var insertText = moveCursorInsideParenthesis(entry.name); var item = { label: entry.name, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(_this.getCompletionRange(existingNode), insertText), documentation: _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.getEntryDescription(entry, _this.doesSupportMarkdown()), tags: isDeprecated(entry) ? [_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemTag.Deprecated] : [], kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, insertTextFormat: entry.name !== insertText ? SnippetFormat : void 0 }; if (_utils_strings__WEBPACK_IMPORTED_MODULE_7__.startsWith(entry.name, '::-')) { item.sortText = SortTexts.VendorPrefixed; } result.items.push(item); }); if (!isNested) { // show html tags only for top level for (var _i = 0, _a = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.html5Tags; _i < _a.length; _i++) { var entry = _a[_i]; result.items.push({ label: entry, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Keyword }); } for (var _b = 0, _c = _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.svgElements; _b < _c.length; _b++) { var entry = _c[_b]; result.items.push({ label: entry, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), entry), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Keyword }); } } var visited = {}; visited[this.currentWord] = true; var docText = this.textDocument.getText(); this.styleSheet.accept(function (n) { if (n.type === _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.SimpleSelector && n.length > 0) { var selector = docText.substr(n.offset, n.length); if (selector.charAt(0) === '.' && !visited[selector]) { visited[selector] = true; result.items.push({ label: selector, textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(_this.getCompletionRange(existingNode), selector), kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Keyword }); } return false; } return true; }); if (ruleSet && ruleSet.isNested()) { var selector = ruleSet.getSelectors().findFirstChildBeforeOffset(this.offset); if (selector && ruleSet.getSelectors().getChildren().indexOf(selector) === 0) { this.getPropertyProposals(null, result); } } return result; }; CSSCompletion.prototype.getCompletionsForDeclarations = function (declarations, result) { if (!declarations || this.offset === declarations.offset) { // incomplete nodes return result; } var node = declarations.findFirstChildBeforeOffset(this.offset); if (!node) { return this.getCompletionsForDeclarationProperty(null, result); } if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.AbstractDeclaration) { var declaration = node; if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition) || this.offset <= declaration.colonPosition) { // complete property return this.getCompletionsForDeclarationProperty(declaration, result); } else if (((0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.semicolonPosition) && declaration.semicolonPosition < this.offset)) { if (this.offset === declaration.semicolonPosition + 1) { return result; // don't show new properties right after semicolon (see Bug 15421:[intellisense] [css] Be less aggressive when manually typing CSS) } // complete next property return this.getCompletionsForDeclarationProperty(null, result); } if (declaration instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration) { // complete value return this.getCompletionsForDeclarationValue(declaration, result); } } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ExtendsReference) { this.getCompletionsForExtendsReference(node, null, result); } else if (this.currentWord && this.currentWord[0] === '@') { this.getCompletionsForDeclarationProperty(null, result); } else if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.RuleSet) { this.getCompletionsForDeclarationProperty(null, result); } return result; }; CSSCompletion.prototype.getCompletionsForVariableDeclaration = function (declaration, result) { if (this.offset && (0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(declaration.colonPosition) && this.offset > declaration.colonPosition) { this.getVariableProposals(declaration.getValue(), result); } return result; }; CSSCompletion.prototype.getCompletionsForExpression = function (expression, result) { var parent = expression.getParent(); if (parent instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument) { this.getCompletionsForFunctionArgument(parent, parent.getParent(), result); return result; } var declaration = expression.findParent(_parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Declaration); if (!declaration) { this.getTermProposals(undefined, null, result); return result; } var node = expression.findChildAtOffset(this.offset, true); if (!node) { return this.getCompletionsForDeclarationValue(declaration, result); } if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NumericValue || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier) { return this.getCompletionsForDeclarationValue(declaration, result); } return result; }; CSSCompletion.prototype.getCompletionsForFunctionArgument = function (arg, func, result) { var identifier = func.getIdentifier(); if (identifier && identifier.matches('var')) { if (!func.getArguments().hasChildren() || func.getArguments().getChild(0) === arg) { this.getVariableProposalsForCSSVarFunction(result); } } return result; }; CSSCompletion.prototype.getCompletionsForFunctionDeclaration = function (decl, result) { var declarations = decl.getDeclarations(); if (declarations && this.offset > declarations.offset && this.offset < declarations.end) { this.getTermProposals(undefined, null, result); } return result; }; CSSCompletion.prototype.getCompletionsForMixinReference = function (ref, result) { var _this = this; var allMixins = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Mixin); for (var _i = 0, allMixins_1 = allMixins; _i < allMixins_1.length; _i++) { var mixinSymbol = allMixins_1[_i]; if (mixinSymbol.node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.MixinDeclaration) { result.items.push(this.makeTermProposal(mixinSymbol, mixinSymbol.node.getParameters(), null)); } } var identifierNode = ref.getIdentifier() || null; this.completionParticipants.forEach(function (participant) { if (participant.onCssMixinReference) { participant.onCssMixinReference({ mixinName: _this.currentWord, range: _this.getCompletionRange(identifierNode) }); } }); return result; }; CSSCompletion.prototype.getTermProposals = function (entry, existingNode, result) { var allFunctions = this.getSymbolContext().findSymbolsAtOffset(this.offset, _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function); for (var _i = 0, allFunctions_1 = allFunctions; _i < allFunctions_1.length; _i++) { var functionSymbol = allFunctions_1[_i]; if (functionSymbol.node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionDeclaration) { result.items.push(this.makeTermProposal(functionSymbol, functionSymbol.node.getParameters(), existingNode)); } } return result; }; CSSCompletion.prototype.makeTermProposal = function (symbol, parameters, existingNode) { var decl = symbol.node; var params = parameters.getChildren().map(function (c) { return (c instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionParameter) ? c.getName() : c.getText(); }); var insertText = symbol.name + '(' + params.map(function (p, index) { return '${' + (index + 1) + ':' + p + '}'; }).join(', ') + ')'; return { label: symbol.name, detail: symbol.name + '(' + params.join(', ') + ')', textEdit: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.TextEdit.replace(this.getCompletionRange(existingNode), insertText), insertTextFormat: SnippetFormat, kind: _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.CompletionItemKind.Function, sortText: SortTexts.Term }; }; CSSCompletion.prototype.getCompletionsForSupportsCondition = function (supportsCondition, result) { var child = supportsCondition.findFirstChildBeforeOffset(this.offset); if (child) { if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration) { if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(child.colonPosition) || this.offset <= child.colonPosition) { return this.getCompletionsForDeclarationProperty(child, result); } else { return this.getCompletionsForDeclarationValue(child, result); } } else if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } } if ((0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(supportsCondition.lParent) && this.offset > supportsCondition.lParent && (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(supportsCondition.rParent) || this.offset <= supportsCondition.rParent)) { return this.getCompletionsForDeclarationProperty(null, result); } return result; }; CSSCompletion.prototype.getCompletionsForSupports = function (supports, result) { var declarations = supports.getDeclarations(); var inInCondition = !declarations || this.offset <= declarations.offset; if (inInCondition) { var child = supports.findFirstChildBeforeOffset(this.offset); if (child instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.SupportsCondition) { return this.getCompletionsForSupportsCondition(child, result); } return result; } return this.getCompletionForTopLevel(result); }; CSSCompletion.prototype.getCompletionsForExtendsReference = function (extendsRef, existingNode, result) { return result; }; CSSCompletion.prototype.getCompletionForUriLiteralValue = function (uriLiteralNode, result) { var uriValue; var position; var range; // No children, empty value if (!uriLiteralNode.hasChildren()) { uriValue = ''; position = this.position; var emptyURIValuePosition = this.textDocument.positionAt(uriLiteralNode.offset + 'url('.length); range = _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.Range.create(emptyURIValuePosition, emptyURIValuePosition); } else { var uriValueNode = uriLiteralNode.getChild(0); uriValue = uriValueNode.getText(); position = this.position; range = this.getCompletionRange(uriValueNode); } this.completionParticipants.forEach(function (participant) { if (participant.onCssURILiteralValue) { participant.onCssURILiteralValue({ uriValue: uriValue, position: position, range: range }); } }); return result; }; CSSCompletion.prototype.getCompletionForImportPath = function (importPathNode, result) { var _this = this; this.completionParticipants.forEach(function (participant) { if (participant.onCssImportPath) { participant.onCssImportPath({ pathValue: importPathNode.getText(), position: _this.position, range: _this.getCompletionRange(importPathNode) }); } }); return result; }; CSSCompletion.prototype.doesSupportMarkdown = function () { var _a, _b, _c; if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.supportsMarkdown)) { if (!(0,_utils_objects__WEBPACK_IMPORTED_MODULE_6__.isDefined)(this.lsOptions.clientCapabilities)) { this.supportsMarkdown = true; return this.supportsMarkdown; } var documentationFormat = (_c = (_b = (_a = this.lsOptions.clientCapabilities.textDocument) === null || _a === void 0 ? void 0 : _a.completion) === null || _b === void 0 ? void 0 : _b.completionItem) === null || _c === void 0 ? void 0 : _c.documentationFormat; this.supportsMarkdown = Array.isArray(documentationFormat) && documentationFormat.indexOf(_cssLanguageTypes__WEBPACK_IMPORTED_MODULE_3__.MarkupKind.Markdown) !== -1; } return this.supportsMarkdown; }; return CSSCompletion; }()); function isDeprecated(entry) { if (entry.status && (entry.status === 'nonstandard' || entry.status === 'obsolete')) { return true; } return false; } /** * Rank number should all be same length strings */ function computeRankNumber(n) { var nstr = n.toString(); switch (nstr.length) { case 4: return nstr; case 3: return '0' + nstr; case 2: return '00' + nstr; case 1: return '000' + nstr; default: return '0000'; } } var Set = /** @class */ (function () { function Set() { this.entries = {}; } Set.prototype.add = function (entry) { this.entries[entry] = true; }; Set.prototype.getEntries = function () { return Object.keys(this.entries); }; return Set; }()); function moveCursorInsideParenthesis(text) { return text.replace(/\(\)$/, "($1)"); } function collectValues(styleSheet, declaration) { var fullPropertyName = declaration.getFullPropertyName(); var entries = new Set(); function visitValue(node) { if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NumericValue || node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.HexColorValue) { entries.add(node.getText()); } return true; } function matchesProperty(decl) { var propertyName = decl.getFullPropertyName(); return fullPropertyName === propertyName; } function vistNode(node) { if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Declaration && node !== declaration) { if (matchesProperty(node)) { var value = node.getValue(); if (value) { value.accept(visitValue); } } } return true; } styleSheet.accept(vistNode); return entries; } var ColorValueCollector = /** @class */ (function () { function ColorValueCollector(entries, currentOffset) { this.entries = entries; this.currentOffset = currentOffset; // nothing to do } ColorValueCollector.prototype.visitNode = function (node) { if (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.HexColorValue || (node instanceof _parser_cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function && _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.isColorConstructor(node))) { if (this.currentOffset < node.offset || node.end < this.currentOffset) { this.entries.add(node.getText()); } } return true; }; return ColorValueCollector; }()); function getCurrentWord(document, offset) { var i = offset - 1; var text = document.getText(); while (i >= 0 && ' \t\n\r":{[()]},*>+'.indexOf(text.charAt(i)) === -1) { i--; } return text.substring(i + 1, offset); } function isColorString(s) { // From https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444 return (s.toLowerCase() in _languageFacts_facts__WEBPACK_IMPORTED_MODULE_2__.colors) || /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(s); } /***/ }), /* 103 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Scope": () => /* binding */ Scope, /* harmony export */ "GlobalScope": () => /* binding */ GlobalScope, /* harmony export */ "Symbol": () => /* binding */ Symbol, /* harmony export */ "ScopeBuilder": () => /* binding */ ScopeBuilder, /* harmony export */ "Symbols": () => /* binding */ Symbols /* harmony export */ }); /* harmony import */ var _cssNodes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91); /* harmony import */ var _utils_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(104); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __extends = (undefined && undefined.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var Scope = /** @class */ (function () { function Scope(offset, length) { this.offset = offset; this.length = length; this.symbols = []; this.parent = null; this.children = []; } Scope.prototype.addChild = function (scope) { this.children.push(scope); scope.setParent(this); }; Scope.prototype.setParent = function (scope) { this.parent = scope; }; Scope.prototype.findScope = function (offset, length) { if (length === void 0) { length = 0; } if (this.offset <= offset && this.offset + this.length > offset + length || this.offset === offset && this.length === length) { return this.findInScope(offset, length); } return null; }; Scope.prototype.findInScope = function (offset, length) { if (length === void 0) { length = 0; } // find the first scope child that has an offset larger than offset + length var end = offset + length; var idx = (0,_utils_arrays__WEBPACK_IMPORTED_MODULE_1__.findFirst)(this.children, function (s) { return s.offset > end; }); if (idx === 0) { // all scopes have offsets larger than our end return this; } var res = this.children[idx - 1]; if (res.offset <= offset && res.offset + res.length >= offset + length) { return res.findInScope(offset, length); } return this; }; Scope.prototype.addSymbol = function (symbol) { this.symbols.push(symbol); }; Scope.prototype.getSymbol = function (name, type) { for (var index = 0; index < this.symbols.length; index++) { var symbol = this.symbols[index]; if (symbol.name === name && symbol.type === type) { return symbol; } } return null; }; Scope.prototype.getSymbols = function () { return this.symbols; }; return Scope; }()); var GlobalScope = /** @class */ (function (_super) { __extends(GlobalScope, _super); function GlobalScope() { return _super.call(this, 0, Number.MAX_VALUE) || this; } return GlobalScope; }(Scope)); var Symbol = /** @class */ (function () { function Symbol(name, value, node, type) { this.name = name; this.value = value; this.node = node; this.type = type; } return Symbol; }()); var ScopeBuilder = /** @class */ (function () { function ScopeBuilder(scope) { this.scope = scope; } ScopeBuilder.prototype.addSymbol = function (node, name, value, type) { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); if (current) { current.addSymbol(new Symbol(name, value, node, type)); } } }; ScopeBuilder.prototype.addScope = function (node) { if (node.offset !== -1) { var current = this.scope.findScope(node.offset, node.length); if (current && (current.offset !== node.offset || current.length !== node.length)) { // scope already known? var newScope = new Scope(node.offset, node.length); current.addChild(newScope); return newScope; } return current; } return null; }; ScopeBuilder.prototype.addSymbolToChildScope = function (scopeNode, node, name, value, type) { if (scopeNode && scopeNode.offset !== -1) { var current = this.addScope(scopeNode); // create the scope or gets the existing one if (current) { current.addSymbol(new Symbol(name, value, node, type)); } } }; ScopeBuilder.prototype.visitNode = function (node) { switch (node.type) { case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Keyframe: this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Keyframe); return true; case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.CustomPropertyDeclaration: return this.visitCustomPropertyDeclarationNode(node); case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.VariableDeclaration: return this.visitVariableDeclarationNode(node); case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Ruleset: return this.visitRuleSet(node); case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.MixinDeclaration: this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Mixin); return true; case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionDeclaration: this.addSymbol(node, node.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function); return true; case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.FunctionParameter: { return this.visitFunctionParameterNode(node); } case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Declarations: this.addScope(node); return true; case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.For: var forNode = node; var scopeNode = forNode.getDeclarations(); if (scopeNode && forNode.variable) { this.addSymbolToChildScope(scopeNode, forNode.variable, forNode.variable.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); } return true; case _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Each: { var eachNode = node; var scopeNode_1 = eachNode.getDeclarations(); if (scopeNode_1) { var variables = eachNode.getVariables().getChildren(); for (var _i = 0, variables_1 = variables; _i < variables_1.length; _i++) { var variable = variables_1[_i]; this.addSymbolToChildScope(scopeNode_1, variable, variable.getName(), void 0, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); } } return true; } } return true; }; ScopeBuilder.prototype.visitRuleSet = function (node) { var current = this.scope.findScope(node.offset, node.length); if (current) { for (var _i = 0, _a = node.getSelectors().getChildren(); _i < _a.length; _i++) { var child = _a[_i]; if (child instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Selector) { if (child.getChildren().length === 1) { // only selectors with a single element can be extended current.addSymbol(new Symbol(child.getChild(0).getText(), void 0, child, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Rule)); } } } } return true; }; ScopeBuilder.prototype.visitVariableDeclarationNode = function (node) { var value = node.getValue() ? node.getValue().getText() : void 0; this.addSymbol(node, node.getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); return true; }; ScopeBuilder.prototype.visitFunctionParameterNode = function (node) { // parameters are part of the body scope var scopeNode = node.getParent().getDeclarations(); if (scopeNode) { var valueNode = node.getDefaultValue(); var value = valueNode ? valueNode.getText() : void 0; this.addSymbolToChildScope(scopeNode, node, node.getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); } return true; }; ScopeBuilder.prototype.visitCustomPropertyDeclarationNode = function (node) { var value = node.getValue() ? node.getValue().getText() : ''; this.addCSSVariable(node.getProperty(), node.getProperty().getName(), value, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable); return true; }; ScopeBuilder.prototype.addCSSVariable = function (node, name, value, type) { if (node.offset !== -1) { this.scope.addSymbol(new Symbol(name, value, node, type)); } }; return ScopeBuilder; }()); var Symbols = /** @class */ (function () { function Symbols(node) { this.global = new GlobalScope(); node.acceptVisitor(new ScopeBuilder(this.global)); } Symbols.prototype.findSymbolsAtOffset = function (offset, referenceType) { var scope = this.global.findScope(offset, 0); var result = []; var names = {}; while (scope) { var symbols = scope.getSymbols(); for (var i = 0; i < symbols.length; i++) { var symbol = symbols[i]; if (symbol.type === referenceType && !names[symbol.name]) { result.push(symbol); names[symbol.name] = true; } } scope = scope.parent; } return result; }; Symbols.prototype.internalFindSymbol = function (node, referenceTypes) { var scopeNode = node; if (node.parent instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionParameter && node.parent.getParent() instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.BodyDeclaration) { scopeNode = node.parent.getParent().getDeclarations(); } if (node.parent instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.FunctionArgument && node.parent.getParent() instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Function) { var funcId = node.parent.getParent().getIdentifier(); if (funcId) { var functionSymbol = this.internalFindSymbol(funcId, [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Function]); if (functionSymbol) { scopeNode = functionSymbol.node.getDeclarations(); } } } if (!scopeNode) { return null; } var name = node.getText(); var scope = this.global.findScope(scopeNode.offset, scopeNode.length); while (scope) { for (var index = 0; index < referenceTypes.length; index++) { var type = referenceTypes[index]; var symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } } scope = scope.parent; } return null; }; Symbols.prototype.evaluateReferenceTypes = function (node) { if (node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Identifier) { var referenceTypes = node.referenceTypes; if (referenceTypes) { return referenceTypes; } else { if (node.isCustomProperty) { return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable]; } // are a reference to a keyframe? var decl = _cssNodes__WEBPACK_IMPORTED_MODULE_0__.getParentDeclaration(node); if (decl) { var propertyName = decl.getNonPrefixedPropertyName(); if ((propertyName === 'animation' || propertyName === 'animation-name') && decl.getValue() && decl.getValue().offset === node.offset) { return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Keyframe]; } } } } else if (node instanceof _cssNodes__WEBPACK_IMPORTED_MODULE_0__.Variable) { return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Variable]; } var selector = node.findAParent(_cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Selector, _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.ExtendsReference); if (selector) { return [_cssNodes__WEBPACK_IMPORTED_MODULE_0__.ReferenceType.Rule]; } return null; }; Symbols.prototype.findSymbolFromNode = function (node) { if (!node) { return null; } while (node.type === _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Interpolation) { node = node.getParent(); } var referenceTypes = this.evaluateReferenceTypes(node); if (referenceTypes) { return this.internalFindSymbol(node, referenceTypes); } return null; }; Symbols.prototype.matchesSymbol = function (node, symbol) { if (!node) { return false; } while (node.type === _cssNodes__WEBPACK_IMPORTED_MODULE_0__.NodeType.Interpolation) { node = node.getParent(); } if (!node.matches(symbol.name)) { return false; } var referenceTypes = this.evaluateReferenceTypes(node); if (!referenceTypes || referenceTypes.indexOf(symbol.type) === -1) { return false; } var nodeSymbol = this.internalFindSymbol(node, referenceTypes); return nodeSymbol === symbol; }; Symbols.prototype.findSymbol = function (name, type, offset) { var scope = this.global.findScope(offset); while (scope) { var symbol = scope.getSymbol(name, type); if (symbol) { return symbol; } scope = scope.parent; } return null; }; return Symbols; }()); /***/ }), /* 104 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "findFirst": () => /* binding */ findFirst, /* harmony export */ "includes": () => /* binding */ includes, /* harmony export */ "union": () => /* binding */ union /* harmony export */ }); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ /** * Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false * are located before all elements where p(x) is true. * @returns the least x for which p(x) is true or array.length if no element fullfills the given function. */ function findFirst(array, p) { var low = 0, high = array.length; if (high === 0) { return 0; // no children } while (low < high) { var mid = Math.floor((low + high) / 2); if (p(array[mid])) { high = mid; } else { low = mid + 1; } } return low; } function includes(array, item) { return array.indexOf(item) !== -1; } function union() { var arrays = []; for (var _i = 0; _i < arguments.length; _i++) { arrays[_i] = arguments[_i]; } var result = []; for (var _a = 0, arrays_1 = arrays; _a < arrays_1.length; _a++) { var array = arrays_1[_a]; for (var _b = 0, array_1 = array; _b < array_1.length; _b++) { var item = array_1[_b]; if (!includes(result, item)) { result.push(item); } } } return result; } /***/ }), /* 105 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "TextDocument": () => /* reexport safe */ vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__.TextDocument, /* harmony export */ "CodeAction": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeAction, /* harmony export */ "CodeActionContext": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionContext, /* harmony export */ "CodeActionKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeActionKind, /* harmony export */ "CodeLens": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CodeLens, /* harmony export */ "Color": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Color, /* harmony export */ "ColorInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorInformation, /* harmony export */ "ColorPresentation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ColorPresentation, /* harmony export */ "Command": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Command, /* harmony export */ "CompletionItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItem, /* harmony export */ "CompletionItemKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemKind, /* harmony export */ "CompletionItemTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionItemTag, /* harmony export */ "CompletionList": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CompletionList, /* harmony export */ "CreateFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.CreateFile, /* harmony export */ "DeleteFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DeleteFile, /* harmony export */ "Diagnostic": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Diagnostic, /* harmony export */ "DiagnosticCode": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticCode, /* harmony export */ "DiagnosticRelatedInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticRelatedInformation, /* harmony export */ "DiagnosticSeverity": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticSeverity, /* harmony export */ "DiagnosticTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DiagnosticTag, /* harmony export */ "DocumentHighlight": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlight, /* harmony export */ "DocumentHighlightKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentHighlightKind, /* harmony export */ "DocumentLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentLink, /* harmony export */ "DocumentSymbol": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.DocumentSymbol, /* harmony export */ "EOL": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.EOL, /* harmony export */ "FoldingRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRange, /* harmony export */ "FoldingRangeKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FoldingRangeKind, /* harmony export */ "FormattingOptions": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.FormattingOptions, /* harmony export */ "Hover": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Hover, /* harmony export */ "InsertReplaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertReplaceEdit, /* harmony export */ "InsertTextFormat": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.InsertTextFormat, /* harmony export */ "Location": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Location, /* harmony export */ "LocationLink": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.LocationLink, /* harmony export */ "MarkedString": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkedString, /* harmony export */ "MarkupContent": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupContent, /* harmony export */ "MarkupKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind, /* harmony export */ "ParameterInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.ParameterInformation, /* harmony export */ "Position": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Position, /* harmony export */ "Range": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.Range, /* harmony export */ "RenameFile": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.RenameFile, /* harmony export */ "SelectionRange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SelectionRange, /* harmony export */ "SignatureInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SignatureInformation, /* harmony export */ "SymbolInformation": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolInformation, /* harmony export */ "SymbolKind": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolKind, /* harmony export */ "SymbolTag": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.SymbolTag, /* harmony export */ "TextDocumentEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentEdit, /* harmony export */ "TextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentIdentifier, /* harmony export */ "TextDocumentItem": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextDocumentItem, /* harmony export */ "TextEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.TextEdit, /* harmony export */ "VersionedTextDocumentIdentifier": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.VersionedTextDocumentIdentifier, /* harmony export */ "WorkspaceChange": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceChange, /* harmony export */ "WorkspaceEdit": () => /* reexport safe */ vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.WorkspaceEdit, /* harmony export */ "ClientCapabilities": () => /* binding */ ClientCapabilities, /* harmony export */ "FileType": () => /* binding */ FileType /* harmony export */ }); /* harmony import */ var vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(106); /* harmony import */ var vscode_languageserver_textdocument__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(107); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var ClientCapabilities; (function (ClientCapabilities) { ClientCapabilities.LATEST = { textDocument: { completion: { completionItem: { documentationFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText] } }, hover: { contentFormat: [vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.Markdown, vscode_languageserver_types__WEBPACK_IMPORTED_MODULE_0__.MarkupKind.PlainText] } } }; })(ClientCapabilities || (ClientCapabilities = {})); var FileType; (function (FileType) { /** * The file type is unknown. */ FileType[FileType["Unknown"] = 0] = "Unknown"; /** * A regular file. */ FileType[FileType["File"] = 1] = "File"; /** * A directory. */ FileType[FileType["Directory"] = 2] = "Directory"; /** * A symbolic link to a file. */ FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; })(FileType || (FileType = {})); /***/ }), /* 106 */ /***/ ((__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) }; } 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 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 (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 () { 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 { 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://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 } }; 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)) && (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 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 = {})); /***/ }), /* 107 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "TextDocument": () => /* binding */ TextDocument /* harmony export */ }); /* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ var FullTextDocument = /** @class */ (function () { function FullTextDocument(uri, languageId, version, content) { this._uri = uri; this._languageId = languageId; this._version = version; this._content = content; this._lineOffsets = undefined; } Object.defineProperty(FullTextDocument.prototype, "uri", { get: function () { return this._uri; }, enumerable: true, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "languageId", { get: function () { return this._languageId; }, enumerable: true, configurable: true }); Object.defineProperty(FullTextDocument.prototype, "version", { get: function () { return this._version; }, enumerable: true, configurable: true }); FullTextDocument.prototype.getText = function (range) { if (range) { var start = this.offsetAt(range.start); var end = this.offsetAt(range.end); return this._content.substring(start, end); } return this._content; }; FullTextDocument.prototype.update = function (changes, version) { for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) { var change = changes_1[_i]; if (FullTextDocument.isIncremental(change)) { // makes sure start is before end var range = getWellformedRange(change.range); // update content var startOffset = this.offsetAt(range.start); var endOffset = this.offsetAt(range.end); this._content = this._content.substring(0, startOffset) + change.text + this._content.substring(endOffset, this._content.length); // update the offsets var startLine = Math.max(range.start.line, 0); var endLine = Math.max(range.end.line, 0); var lineOffsets = this._lineOffsets; var addedLineOffsets = computeLineOffsets(change.text, false, startOffset); if (endLine - startLine === addedLineOffsets.length) { for (var i = 0, len = addedLineOffsets.length; i < len; i++) { lineOffsets[i + startLine + 1] = addedLineOffsets[i]; } } else { if (addedLineOffsets.length < 10000) { lineOffsets.splice.apply(lineOffsets, [startLine + 1, endLine - startLine].concat(addedLineOffsets)); } else { // avoid too many arguments for splice this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); } } var diff = change.text.length - (endOffset - startOffset); if (diff !== 0) { for (var i = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i < len; i++) { lineOffsets[i] = lineOffsets[i] + diff; } } } else if (FullTextDocument.isFull(change)) { this._content = change.text; this._lineOffsets = undefined; } else { throw new Error('Unknown change event received'); } } this._version = version; }; FullTextDocument.prototype.getLineOffsets = function () { if (this._lineOffsets === undefined) { this._lineOffsets = computeLineOffsets(this._content, true); } return this._lineOffsets; }; FullTextDocument.prototype.positionAt = function (offset) { offset = Math.max(Math.min(offset, this._content.length), 0); var lineOffsets = this.getLineOffsets(); var low = 0, high = lineOffsets.length; if (high === 0) { return { line: 0, character: offset }; } while (low < high) { var mid = Math.floor((low + high) / 2); if (lineOffsets[mid] > offset) { high = mid; } else { low = mid + 1; } } // low is the least x for which the line offset is larger than the current offset // or array.length if no line offset is larger than the current offset var line = low - 1; return { line: line, character: offset - lineOffsets[line] }; }; FullTextDocument.prototype.offsetAt = function (position) { var lineOffsets = this.getLineOffsets(); if (position.line >= lineOffsets.length) { return this._content.length; } else if (position.line < 0) { return 0; } var lineOffset = lineOffsets[position.line]; var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); }; Object.defineProperty(FullTextDocument.prototype, "lineCount", { get: function () { return this.getLineOffsets().length; }, enumerable: true, configurable: true }); FullTextDocument.isIncremental = function (event) { var candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range !== undefined && (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); }; FullTextDocument.isFull = function (event) { var candidate = event; return candidate !== undefined && candidate !== null && typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; }; return FullTextDocument; }()); var TextDocument; (function (TextDocument) { /** * Creates a new text document. * * @param uri The document's uri. * @param languageId The document's language Id. * @param version The document's initial version number. * @param content The document's content. */ function create(uri, languageId, version, content) { return new FullTextDocument(uri, languageId, version, content); } TextDocument.create = create; /** * Updates a TextDocument by modifing its content. * * @param document the document to update. Only documents created by TextDocument.create are valid inputs. * @param changes the changes to apply to the document. * @returns The updated TextDocument. Note: That's the same document instance passed in as first parameter. * */ function update(document, changes, version) { if (document instanceof FullTextDocument) { document.update(changes, version); return document; } else { throw new Error('TextDocument.update: document must be created by TextDocument.create'); } } TextDocument.update = update; function applyEdits(document, edits) { var text = document.getText(); var sortedEdits = mergeSort(edits.map(getWellformedEdit), function (a, b) { var diff = a.range.start.line - b.range.start.line; if (diff === 0) { return a.range.start.character - b.range.start.character; } return diff; }); var lastModifiedOffset = 0; var spans = []; for (var _i = 0, sortedEdits_1 = sortedEdits; _i < sortedEdits_1.length; _i++) { var e = sortedEdits_1[_i]; var startOffset = document.offsetAt(e.range.start); if (startOffset < lastModifiedOffset) { throw new Error('Overlapping edit'); } else if (startOffset > lastModifiedOffset) { spans.push(text.substring(lastModifiedOffset, startOffset)); } if (e.newText.length) { spans.push(e.newText); } lastModifiedOffset = document.offsetAt(e.range.end); } spans.push(text.substr(lastModifiedOffset)); return spans.join(''); } TextDocument.applyEdits = applyEdits; })(TextDocument || (TextDocument = {})); function mergeSort(data, compare) { if (data.length <= 1) { // sorted return data; } var p = (data.length / 2) | 0; var left = data.slice(0, p); var right = data.slice(p); mergeSort(left, compare); mergeSort(right, compare); var leftIdx = 0; var rightIdx = 0; var i = 0; while (leftIdx < left.length && rightIdx < right.length) { var ret = compare(left[leftIdx], right[rightIdx]); if (ret <= 0) { // smaller_equal -> take left to preserve order data[i++] = left[leftIdx++]; } else { // greater -> take right data[i++] = right[rightIdx++]; } } while (leftIdx < left.length) { data[i++] = left[leftIdx++]; } while (rightIdx < right.length) { data[i++] = right[rightIdx++]; } return data; } function computeLineOffsets(text, isAtLineStart, textOffset) { if (textOffset === void 0) { textOffset = 0; } var result = isAtLineStart ? [textOffset] : []; for (var i = 0; i < text.length; i++) { var ch = text.charCodeAt(i); if (ch === 13 /* CarriageReturn */ || ch === 10 /* LineFeed */) { if (ch === 13 /* CarriageReturn */ && i + 1 < text.length && text.charCodeAt(i + 1) === 10 /* LineFeed */) { i++; } result.push(textOffset + i + 1); } } return result; } function getWellformedRange(range) { var start = range.start; var end = range.end; if (start.line > end.line || (start.line === end.line && start.character > end.character)) { return { start: end, end: start }; } return range; } function getWellformedEdit(textEdit) { var range = getWellformedRange(textEdit.range); if (range !== textEdit.range) { return { newText: textEdit.newText, range: range }; } return textEdit; } /***/ }), /* 108 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "PathCompletionParticipant": () => /* binding */ PathCompletionParticipant /* harmony export */ }); /* harmony import */ var _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(105); /* harmony import */ var _utils_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(92); /* harmony import */ var _utils_resources__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(109); /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (undefined && undefined.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; var PathCompletionParticipant = /** @class */ (function () { function PathCompletionParticipant(readDirectory) { this.readDirectory = readDirectory; this.literalCompletions = []; this.importCompletions = []; } PathCompletionParticipant.prototype.onCssURILiteralValue = function (context) { this.literalCompletions.push(context); }; PathCompletionParticipant.prototype.onCssImportPath = function (context) { this.importCompletions.push(context); }; PathCompletionParticipant.prototype.computeCompletions = function (document, documentContext) { return __awaiter(this, void 0, void 0, function () { var result, _i, _a, literalCompletion, uriValue, fullValue, items, _b, items_1, item, _c, _d, importCompletion, pathValue, fullValue, suggestions, _e, suggestions_1, item; return __generator(this, function (_f) { switch (_f.label) { case 0: result = { items: [], isIncomplete: false }; _i = 0, _a = this.literalCompletions; _f.label = 1; case 1: if (!(_i < _a.length)) return [3 /*break*/, 5]; literalCompletion = _a[_i]; uriValue = literalCompletion.uriValue; fullValue = stripQuotes(uriValue); if (!(fullValue === '.' || fullValue === '..')) return [3 /*break*/, 2]; result.isIncomplete = true; return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this.providePathSuggestions(uriValue, literalCompletion.position, literalCompletion.range, document, documentContext)]; case 3: items = _f.sent(); for (_b = 0, items_1 = items; _b < items_1.length; _b++) { item = items_1[_b]; result.items.push(item); } _f.label = 4; case 4: _i++; return [3 /*break*/, 1]; case 5: _c = 0, _d = this.importCompletions; _f.label = 6; case 6: if (!(_c < _d.length)) return [3 /*break*/, 10]; importCompletion = _d[_c]; pathValue = importCompletion.pathValue; fullValue = stripQuotes(pathValue); if (!(fullValue === '.' || fullValue === '..')) return [3 /*break*/, 7]; result.isIncomplete = true; return [3 /*break*/, 9]; case 7: return [4 /*yield*/, this.providePathSuggestions(pathValue, importCompletion.position, importCompletion.range, document, documentContext)]; case 8: suggestions = _f.sent(); if (document.languageId === 'scss') { suggestions.forEach(function (s) { if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.startsWith)(s.label, '_') && (0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.endsWith)(s.label, '.scss')) { if (s.textEdit) { s.textEdit.newText = s.label.slice(1, -5); } else { s.label = s.label.slice(1, -5); } } }); } for (_e = 0, suggestions_1 = suggestions; _e < suggestions_1.length; _e++) { item = suggestions_1[_e]; result.items.push(item); } _f.label = 9; case 9: _c++; return [3 /*break*/, 6]; case 10: return [2 /*return*/, result]; } }); }); }; PathCompletionParticipant.prototype.providePathSuggestions = function (pathValue, position, range, document, documentContext) { return __awaiter(this, void 0, void 0, function () { var fullValue, isValueQuoted, valueBeforeCursor, currentDocUri, fullValueRange, replaceRange, valueBeforeLastSlash, parentDir, result, infos, _i, infos_1, _a, name, type, e_1; return __generator(this, function (_b) { switch (_b.label) { case 0: fullValue = stripQuotes(pathValue); isValueQuoted = (0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.startsWith)(pathValue, "'") || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.startsWith)(pathValue, "\""); valueBeforeCursor = isValueQuoted ? fullValue.slice(0, position.character - (range.start.character + 1)) : fullValue.slice(0, position.character - range.start.character); currentDocUri = document.uri; fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range; replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange); valueBeforeLastSlash = valueBeforeCursor.substring(0, valueBeforeCursor.lastIndexOf('/') + 1); parentDir = documentContext.resolveReference(valueBeforeLastSlash || '.', currentDocUri); if (!parentDir) return [3 /*break*/, 4]; _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); result = []; return [4 /*yield*/, this.readDirectory(parentDir)]; case 2: infos = _b.sent(); for (_i = 0, infos_1 = infos; _i < infos_1.length; _i++) { _a = infos_1[_i], name = _a[0], type = _a[1]; // Exclude paths that start with `.` if (name.charCodeAt(0) !== CharCode_dot && (type === _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__.FileType.Directory || (0,_utils_resources__WEBPACK_IMPORTED_MODULE_1__.joinPath)(parentDir, name) !== currentDocUri)) { result.push(createCompletionItem(name, type === _cssLanguageTypes__WEBPACK_IMPORTED_MODULE_0__.FileType.Directory, replaceRange)); } } return [2 /*return*/, result]; case 3: e_1 = _b.sent(); return [3 /*break*/, 4]; case 4: return [2 /*return*/, []]; } }); }); }; return PathCompletionParticipant; }()); var CharCode_dot = '.'.charCodeAt(0); function stripQuotes(fullValue) { if ((0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.startsWith)(fullValue, "'") || (0,_utils_strings__WEBPACK_IMPORTED_MODULE_2__.startsWith)(fullValue, "\"")) { return fullValue.slice(1, -1); } else { return fullValue; } } function pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange) { var replaceRange; var lastIndexOfSlash = valueBeforeCursor.lastIndexOf('/'); if (lastIndexOfSlash === -1) { replaceRange = fullValueRange; } else { // For cases where cursor is in the middle of attribute value, like