Skip to content

Commit

Permalink
For [GH #161] - Add widget_signature_md($widget)
Browse files Browse the repository at this point in the history
- BUG: This code returns sinagures in wrong syntax for actions and entities
  • Loading branch information
hkoba committed Jul 17, 2019
1 parent 5145cd1 commit fe1101e
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions Lite/Inspector.pm
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,30 @@ sub describe_symbol_of_ELEMENT {

my MarkupContent $md = +{};
$md->{kind} = 'markdown';
$md->{value} = <<END;
(widget) <$wname
@{[map {" $_=".$widget->{arg_dict}{$_}->type->[0]."\n"} @{$widget->{arg_order}}]}
/>
END

$md->{value} = $self->widget_signature_md($widget, 1);
$md;
}

sub md_quote_code_as {
(my MY $self, my ($langId, $text)) = @_;
my $pre = q{```}.$langId."\n";
$text =~ s/\n*\z/\n/;
$pre.$text.q{```}."\n";
}

sub widget_signature_md {
(my MY $self, my Widget $widget, my $detail) = @_;
my $wname = "yatt:$widget->{cf_name}";
my $args = join("", map {
my $var = $widget->{arg_dict}{$_};
" ".join("=", $_, q{"}.$var->spec_string.q{"}).($detail ? "\n" : "");
} @{$widget->{arg_order}});
if ($detail) {
$self->md_quote_code_as(yatt => "($widget->{cf_kind}) <$wname$args/>");
} else {
$args;
}
}
sub lookup_widget_from {
(my MY $self, my ($wpath, $fileName, $line)) = @_;

Expand Down

0 comments on commit fe1101e

Please sign in to comment.