-
Notifications
You must be signed in to change notification settings - Fork 137
Azure Functions extension API
Eric Jizba edited this page Mar 23, 2021
·
1 revision
We provide an API for our extension that can be retrieved like this:
import { extensions } from "vscode";
import { AzureExtensionApiProvider } from "vscode-azureextensionui/api";
import { AzureFunctionsExtensionApi } from "./vscode-azurefunctions.api";
export async function getExtensionApi(): Promise<AzureFunctionsExtensionApi | undefined> {
const extensionId = 'ms-azuretools.vscode-azurefunctions';
const extension = extensions.getExtension<AzureExtensionApiProvider>(extensionId);
return extension?.exports?.getApi<AzureFunctionsExtensionApi>('^1.0.0');
}
It is recommended that you either list our extension as a dependency in your package.json
and/or add more logic to make sure our extension is both installed and activated before you use the API. We also recommend copying the following "types" files to your repo, which has more information about the API:
- Azure Functions extension: https://github.com/microsoft/vscode-azurefunctions/blob/main/src/vscode-azurefunctions.api.d.ts
- API Provider: https://github.com/microsoft/vscode-azuretools/blob/main/ui/api.d.ts
NOTE: Using commands directly through
executeCommand
has been deprecated.