Skip to content

Commit

Permalink
fix: render inline signature
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
Akos Kitta committed Mar 9, 2023
1 parent e759610 commit c0c33b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
protected override renderInlineCommands(node: any): React.ReactNode {
if (CloudSketchbookTree.CloudSketchDirNode.is(node) && node.commands) {
return Array.from(new Set(node.commands)).map((command) =>
this.renderInlineCommand(command.id, node, {
this.renderInlineCommand(command, node, {
username: this.authenticationService.session?.account?.label,
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
postConstruct,
} from '@theia/core/shared/inversify';
import { TreeNode } from '@theia/core/lib/browser/tree/tree';
import { CommandRegistry } from '@theia/core/lib/common/command';
import { Command, CommandRegistry } from '@theia/core/lib/common/command';
import {
NodeProps,
TreeProps,
Expand Down Expand Up @@ -132,25 +132,22 @@ export class SketchbookTreeWidget extends FileTreeWidget {
protected renderInlineCommands(node: TreeNode): React.ReactNode {
if (SketchbookTree.SketchDirNode.is(node) && node.commands) {
return Array.from(new Set(node.commands)).map((command) =>
this.renderInlineCommand(
Array.isArray(command)
? command
: typeof command === 'string'
? command
: command.id,
node
)
this.renderInlineCommand(command, node)
);
}
return undefined;
}

protected renderInlineCommand(
command: string | [command: string, label: string],
command: Command | string | [command: string, label: string],
node: SketchbookTree.SketchDirNode,
options?: any
): React.ReactNode {
const commandId = Array.isArray(command) ? command[0] : command;
const commandId = Command.is(command)
? command.id
: Array.isArray(command)
? command[0]
: command;
const resolvedCommand = this.commandRegistry.getCommand(commandId);
const icon = resolvedCommand?.iconClass;
const args = { model: this.model, node: node, ...options };
Expand Down

0 comments on commit c0c33b3

Please sign in to comment.