@microsoft/vscode-azureresources-api
Advanced tools
Comparing version
@@ -9,2 +9,7 @@ | ||
## [2.2.0] - 2024-01-30 | ||
* Add `getAzExtResourceType` function | ||
* Add "Arc-enabled Machines" resource type | ||
## [2.1.0] - 2023-06-13 | ||
@@ -11,0 +16,0 @@ |
@@ -41,2 +41,3 @@ import type { Environment } from '@azure/ms-rest-azure-env'; | ||
AppServices = "AppServices", | ||
ArcEnabledMachines = "ArcEnabledMachines", | ||
AzureCosmosDb = "AzureCosmosDb", | ||
@@ -270,2 +271,13 @@ ContainerApps = "ContainerApps", | ||
/** | ||
* Gets a normalized type for an Azure resource, accounting for the fact that some | ||
* Azure resources share values for type and/or kind | ||
* @param resource - The resource to check the {@link AzExtResourceType} for | ||
* @returns The normalized Azure resource type | ||
*/ | ||
export declare function getAzExtResourceType(resource: { | ||
type: string; | ||
kind?: string; | ||
}): AzExtResourceType | undefined; | ||
export declare function getAzureResourcesExtensionApi(extensionContext: vscode.ExtensionContext, apiVersionRange: '2.0.0', options?: GetApiOptions): Promise<AzureResourcesExtensionApi>; | ||
@@ -272,0 +284,0 @@ |
@@ -15,2 +15,3 @@ "use strict"; | ||
AzExtResourceType["AppServices"] = "AppServices"; | ||
AzExtResourceType["ArcEnabledMachines"] = "ArcEnabledMachines"; | ||
AzExtResourceType["AzureCosmosDb"] = "AzureCosmosDb"; | ||
@@ -17,0 +18,0 @@ AzExtResourceType["ContainerApps"] = "ContainerApps"; |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./extensionApi"), exports); | ||
__exportStar(require("./getAzExtResourceType"), exports); | ||
__exportStar(require("./resources/azure"), exports); | ||
@@ -25,0 +26,0 @@ __exportStar(require("./resources/base"), exports); |
{ | ||
"name": "@microsoft/vscode-azureresources-api", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Type declarations and client library for the Azure Resources extension API", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -143,10 +143,11 @@ # VS Code Azure Resources API | ||
detail: string; | ||
type?: string; // Optional: resource type associated with the command. Used to show an icon next to the command. | ||
}[]; | ||
``` | ||
> [View defintion of `AzExtResourceType`](../src/AzExtResourceType.ts) | ||
> [View definition of `AzExtResourceType`](../src/AzExtResourceType.ts) | ||
The contribution object from the Azure Functions extension is shown below as an example. | ||
This extension declares that it registers a BranchDataProvider for the `FunctionApp` resource type in the Azure resources view, and a BranchDataProvider for the `func` resource type in the Workspace resources view. It also registers a WorkspaceResourceProvider. Finally, it contributes a command to the "Create Resource..." quick pick prompt for creating a Funciton App. | ||
This extension declares that it registers a BranchDataProvider for the `FunctionApp` resource type in the Azure resources view, and a BranchDataProvider for the `func` resource type in the Workspace resources view. It also registers a WorkspaceResourceProvider. Finally, it contributes a command to the "Create Resource..." quick pick prompt for creating a Function App. | ||
@@ -244,2 +245,56 @@ | ||
## Contributing to the Workspace resources view | ||
### `view/title` commands | ||
Client extensions are encouraged to make commands accessible via the workspace `view/title` menu. Commands should be grouped by extension into submenus. Submenu icons and titles should be the same as the client extension's icon and title. This is to prevent the `view/title` menu from becoming too cluttered. | ||
 | ||
Here's an example of how the Azure Functions extension contributes commands to the workspace `view/title` menu. See [the Azure Functions package.json](https://github.com/microsoft/vscode-azurefunctions/blob/main/package.json) for reference. | ||
```jsonc | ||
"submenus": [ | ||
// define the submenu | ||
{ | ||
"id": "azureFunctions.submenus.workspaceActions", | ||
"icon": "resources/azure-functions.png", | ||
"label": "Azure Functions" | ||
} | ||
], | ||
"menus": { | ||
// add commands to the submenu | ||
"azureFunctions.submenus.workspaceActions": [ | ||
{ | ||
"command": "azureFunctions.createFunction", | ||
"group": "1_projects@1" | ||
}, | ||
{ | ||
"command": "azureFunctions.createNewProject", | ||
"group": "1_projects@2" | ||
}, | ||
{ | ||
"command": "azureFunctions.deploy", | ||
"group": "2_deploy@1" | ||
}, | ||
{ | ||
"command": "azureFunctions.createFunctionApp", | ||
"group": "3_create@1" | ||
}, | ||
{ | ||
"command": "azureFunctions.createFunctionAppAdvanced", | ||
"group": "3_create@2" | ||
} | ||
], | ||
// add the submenu to the workspace view/title menu | ||
"view/title": [ | ||
{ | ||
"submenu": "azureFunctions.submenus.workspaceActions", | ||
"when": "view == azureWorkspace", | ||
"group": "navigation@1" | ||
} | ||
], | ||
} | ||
``` | ||
## Extension dependencies | ||
@@ -246,0 +301,0 @@ |
56691
24.21%16
14.29%786
16.44%363
17.86%