Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: show plugins and clients in panel #5784

Merged
merged 47 commits into from
Nov 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
04a13a8
load workspace content inside tree
thewahome Nov 13, 2024
2c31d69
expand node if item is available
Nov 14, 2024
7465f16
expand if items exist
Nov 14, 2024
3a01185
add view action buttons to the items
thewahome Nov 14, 2024
fd4b56f
activate selecting the path from the tree
thewahome Nov 15, 2024
9b7ec58
reorder panels in view
thewahome Nov 15, 2024
14259aa
When no clients or plugins, open root collapsed
thewahome Nov 15, 2024
2287b59
only show the category if it has items
thewahome Nov 15, 2024
52c0bba
access properties from extension command
thewahome Nov 15, 2024
ffe44e8
show open folder icon when plugin/client selected
thewahome Nov 15, 2024
1aadd1f
reuse the regeneration command
thewahome Nov 15, 2024
7fbaeea
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 15, 2024
b285a33
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 18, 2024
711294c
[partial] delete workspace item
thewahome Nov 18, 2024
ab673e5
reuse item generation
Nov 19, 2024
232f108
support workspace tree provider
thewahome Nov 19, 2024
5096870
don't clean output
thewahome Nov 19, 2024
4ee59e7
add remove client async and remove plugin async functions to the RPC …
thewahome Nov 19, 2024
0a6763f
connect to kiota rpc functions
thewahome Nov 19, 2024
a104372
isolate in folder
thewahome Nov 19, 2024
bca6af0
remove regeneration, change icon, call select
thewahome Nov 19, 2024
693033a
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 20, 2024
cc8b44f
add logging dependency
thewahome Nov 20, 2024
72460cd
refresh view after deleting workspace item
thewahome Nov 20, 2024
8983f71
load works[ace content on refresh
thewahome Nov 20, 2024
96095f0
bump version numbrt to match kiota with changes
thewahome Nov 20, 2024
95f03bc
use string formating
thewahome Nov 20, 2024
ce5afbe
show no clients or plugins available message
thewahome Nov 20, 2024
b10cd3f
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 20, 2024
00a381f
use translated button names
thewahome Nov 20, 2024
737146b
Merge branch 'task/extension/show-plugins-and-clients-in-panel' of ht…
thewahome Nov 20, 2024
cb9f26b
change error message
thewahome Nov 20, 2024
084c1ac
remove unnecessary console log
thewahome Nov 20, 2024
c951ffe
chore: removes duplication in server removal implementation
baywet Nov 21, 2024
ddecb7d
consolidate plugin and client deletion into a single method
thewahome Nov 22, 2024
3217e24
introduce WorkspaceContentService to handle workspace file loading
thewahome Nov 22, 2024
b512399
call wrapper function instead of service
thewahome Nov 22, 2024
d46bdc2
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 22, 2024
762484a
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 22, 2024
23da950
test delete workspace command
thewahome Nov 25, 2024
5c3f71c
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 25, 2024
cff3ebd
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 25, 2024
d4a3d9e
add confirmation message before deleting
thewahome Nov 26, 2024
b1f58e5
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 26, 2024
bdc2f24
fix failing test due to warning message
thewahome Nov 26, 2024
92493e6
refine tests to cater for yes/no dialog
thewahome Nov 27, 2024
57a49f2
Merge branch 'main' into task/extension/show-plugins-and-clients-in-p…
thewahome Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
activate selecting the path from the tree
thewahome committed Nov 15, 2024
commit fd4b56fdcf32b65fb29be219502d7559ea57befa
38 changes: 28 additions & 10 deletions vscode/microsoft-kiota/src/providers/workspaceTreeProvider.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ class WorkspaceTreeItem extends vscode.TreeItem {
public readonly label: string,
public readonly collapsibleState: vscode.TreeItemCollapsibleState,
public readonly type: 'root' | 'category' | 'item',
public readonly category?: string,
public readonly properties?: ClientOrPluginProperties,
public command?: vscode.Command
) {
super(label, collapsibleState);
@@ -61,37 +63,53 @@ export class WorkspaceTreeProvider implements vscode.TreeDataProvider<vscode.Tre

if (element.label === 'Clients') {
return Object.keys(this.workspaceContent.clients).map(clientName =>
new WorkspaceTreeItem(clientName, vscode.TreeItemCollapsibleState.None, 'item')
new WorkspaceTreeItem(clientName, vscode.TreeItemCollapsibleState.None, 'item', 'Clients', this.getProperties(clientName, 'Clients'))
);
}

if (element.label === 'Plugins') {
return Object.keys(this.workspaceContent.plugins).map(pluginName =>
new WorkspaceTreeItem(pluginName, vscode.TreeItemCollapsibleState.None, 'item')
new WorkspaceTreeItem(pluginName, vscode.TreeItemCollapsibleState.None, 'item', 'Plugins', this.getProperties(pluginName, 'Plugins'))
);
}
}
return [];
}

getProperties(name: string, category: string): ClientOrPluginProperties | undefined {
if (category && category === 'Plugins') {
return this.workspaceContent?.plugins[name];
}
return this.workspaceContent?.clients[name];
}

getTreeItem(element: WorkspaceTreeItem): WorkspaceTreeItem {
if (element) {
if (element.type === 'root') {
if (!element) {
return element;
}

switch (element.type) {
case 'root':
element.command = {
command: 'kiota.workspace.openWorkspaceFile',
title: vscode.l10n.t("Open File"),
arguments: [vscode.Uri.file(getWorkspaceJsonPath())]
};
element.contextValue = 'folder';
} else if (element.type === 'item') {
break;

case 'item':
const key = element.label;
const properties = element.properties;
const generationType = element.category;

element.iconPath = new vscode.ThemeIcon('folder');
element.command = {
command: 'kiota.workspace.playItem',
title: vscode.l10n.t("Play Item"),
arguments: [element.label]
command: 'kiota.editPaths',
title: vscode.l10n.t("Select"),
arguments: [key, properties, generationType]
};
element.contextValue = 'item';
}
break;
}
return element;
}