Skip to content

Commit c0c33b3

Browse files
author
Akos Kitta
committed
fix: render inline signature
Signed-off-by: Akos Kitta <[email protected]>
1 parent e759610 commit c0c33b3

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

Diff for: arduino-ide-extension/src/browser/widgets/cloud-sketchbook/cloud-sketchbook-tree-widget.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
121121
protected override renderInlineCommands(node: any): React.ReactNode {
122122
if (CloudSketchbookTree.CloudSketchDirNode.is(node) && node.commands) {
123123
return Array.from(new Set(node.commands)).map((command) =>
124-
this.renderInlineCommand(command.id, node, {
124+
this.renderInlineCommand(command, node, {
125125
username: this.authenticationService.session?.account?.label,
126126
})
127127
);

Diff for: arduino-ide-extension/src/browser/widgets/sketchbook/sketchbook-tree-widget.tsx

+8-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
postConstruct,
66
} from '@theia/core/shared/inversify';
77
import { TreeNode } from '@theia/core/lib/browser/tree/tree';
8-
import { CommandRegistry } from '@theia/core/lib/common/command';
8+
import { Command, CommandRegistry } from '@theia/core/lib/common/command';
99
import {
1010
NodeProps,
1111
TreeProps,
@@ -132,25 +132,22 @@ export class SketchbookTreeWidget extends FileTreeWidget {
132132
protected renderInlineCommands(node: TreeNode): React.ReactNode {
133133
if (SketchbookTree.SketchDirNode.is(node) && node.commands) {
134134
return Array.from(new Set(node.commands)).map((command) =>
135-
this.renderInlineCommand(
136-
Array.isArray(command)
137-
? command
138-
: typeof command === 'string'
139-
? command
140-
: command.id,
141-
node
142-
)
135+
this.renderInlineCommand(command, node)
143136
);
144137
}
145138
return undefined;
146139
}
147140

148141
protected renderInlineCommand(
149-
command: string | [command: string, label: string],
142+
command: Command | string | [command: string, label: string],
150143
node: SketchbookTree.SketchDirNode,
151144
options?: any
152145
): React.ReactNode {
153-
const commandId = Array.isArray(command) ? command[0] : command;
146+
const commandId = Command.is(command)
147+
? command.id
148+
: Array.isArray(command)
149+
? command[0]
150+
: command;
154151
const resolvedCommand = this.commandRegistry.getCommand(commandId);
155152
const icon = resolvedCommand?.iconClass;
156153
const args = { model: this.model, node: node, ...options };

0 commit comments

Comments
 (0)