UNPKG

@microsoft/compose-language-service

Version:
23 lines 1.09 kB
"use strict"; /*!-------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.runWithContext = exports.getCurrentContext = void 0; const async = require("async_hooks"); const vscode_languageserver_1 = require("vscode-languageserver"); const als = new async.AsyncLocalStorage(); function getCurrentContext() { const ctx = als.getStore(); if (!ctx) { throw new vscode_languageserver_1.ResponseError(vscode_languageserver_1.ErrorCodes.InternalError, 'Failed to get action context'); } return ctx; } exports.getCurrentContext = getCurrentContext; function runWithContext(context, callback) { return als.run(context, callback); } exports.runWithContext = runWithContext; //# sourceMappingURL=ActionContext.js.map