-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetResourceFilter.ts
More file actions
32 lines (28 loc) · 967 Bytes
/
setResourceFilter.ts
File metadata and controls
32 lines (28 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as vscode from "vscode";
import { CloudinaryTreeDataProvider } from "../tree/treeDataProvider";
type ResourceType = "all" | "image" | "video" | "raw";
/**
* Registers a command to let users filter Cloudinary assets by resource type.
* @param context - VS Code extension context.
* @param provider - Cloudinary tree data provider instance.
*/
function registerFilter(
context: vscode.ExtensionContext,
provider: CloudinaryTreeDataProvider
) {
context.subscriptions.push(
vscode.commands.registerCommand(
"cloudinary.setResourceFilter",
async () => {
const options: ResourceType[] = ["all", "image", "video", "raw"];
const selected = await vscode.window.showQuickPick(options, {
placeHolder: "Filter Cloudinary assets by type",
});
if (selected) {
provider.refresh({ resourceTypeFilter: selected as ResourceType });
}
}
)
);
}
export default registerFilter;