blib/lib/PLS/Server/Response/SignatureHelp.pm

filter: Statementstmt 50.0% 16 / 32 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 36.2% 21 / 58 CC 7 SCAR 35.0
CC
7
Cov
34%
new
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 33.1
« blib/lib/PLS/Server/Response/WorkspaceSymbols.pm ↑ Summary blib/lib/PLS/Parser/Index.pm »
1 package PLS::Server::Response::SignatureHelp;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 13 ▶use parent q(PLS::Server::Response);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 13 ▶use PLS::Parser::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 PLS::Server::Response::SignatureHelp
15  
16 =head1 DESCRIPTION
17  
18 This is a message from the server to the client with information about the
19 parameters of the current function.
20  
21 =cut
22  
23 sub new
24 0 ▶{
Subroutine new: not called CC=7 SCAR=40.3
Pod undocumented
25 0 my ($class, $request) = @_;
26  
27 my $self = bless {
28 id => $request->{id},
29 0 result => undef
30 }, $class;
31  
32 0 my ($line, $character) = @{$request->{params}{position}}{qw(line character)};
33 0 my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri}, line => $line);
34 0 ▶ return $self if (ref $document ne 'PLS::Parser::Document');
Branch: 1 branch
BranchTrueFalseTotal
if ref $document ne "PLS::Parser::Document" 0 0 0
35  
36 0 my $list = $document->find_current_list($line, $character);
37 0 my ($results, $sub_call) = $document->go_to_definition_of_closest_subroutine($list, $line, $character);
38 0 my @signatures = map { $_->{signature} } @{$results};
39 0 my $active_parameter = $document->get_list_index($list, $request->{params}{position}{line}, $request->{params}{position}{character});
40  
41 # If this is a method call, then we should skip the first parameter.
42 0 ▶ if ( blessed($sub_call)
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling) and $sub_call->previous_sibling->type eq "PPI::Token::Operator" and $sub_call->previous_sibling->name eq "->") 0 0 0
Condition0%0/9
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling) and $sub_call->previous_sibling->type eq "PPI::Token::Operator" and $sub_call->previous_sibling->name eq "->"
!ll&&!rl&&r
000
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling) and $sub_call->previous_sibling->type eq "PPI::Token::Operator"
!ll&&!rl&&r
000
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling)
!ll&&!rl&&r
000
MC/DC0%0/4
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling) and $sub_call->previous_sibling->type eq "PPI::Token::Operator" and $sub_call->previous_sibling->name eq "->"
builtin::blessed($sub_call) builtin::blessed($sub_call->previous_sibling) $sub_call->previous_sibling->type eq "PPI::Token::Operator" $sub_call->previous_sibling->name eq "->"
Truth table0%0/5
A and B and C and D
A= builtin::blessed($sub_call)B= builtin::blessed($sub_call->previous_sibling)C= $sub_call->previous_sibling->type eq "PPI::Token::Operator"D= $sub_call->previous_sibling->name eq "->"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
43 and blessed($sub_call->previous_sibling)
44 and $sub_call->previous_sibling->type eq 'PPI::Token::Operator'
45 and $sub_call->previous_sibling->name eq '->')
46 {
47 0 $active_parameter++;
48 } ## end if (blessed($sub_call)...)
49  
50 0 ▶ $self->{result} = {signatures => \@signatures, activeParameter => $active_parameter} if (scalar @signatures);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @signatures 0 0 0
51  
52 0 return $self;
53 } ## end sub new
54  
55 13 1;
« blib/lib/PLS/Server/Response/WorkspaceSymbols.pm ↑ Summary blib/lib/PLS/Parser/Index.pm »