@microsoft/compose-language-service
Version:
Language service for Docker Compose documents
18 lines • 831 B
JavaScript
/*!--------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as async from 'async_hooks';
import { ErrorCodes, ResponseError } from 'vscode-languageserver';
const als = new async.AsyncLocalStorage();
export function getCurrentContext() {
const ctx = als.getStore();
if (!ctx) {
throw new ResponseError(ErrorCodes.InternalError, 'Failed to get action context');
}
return ctx;
}
export function runWithContext(context, callback) {
return als.run(context, callback);
}
//# sourceMappingURL=ActionContext.js.map