| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
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 "->"
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling) and $sub_call->previous_sibling->type eq "PPI::Token::Operator"
builtin::blessed($sub_call) and builtin::blessed($sub_call->previous_sibling)
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 "->"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } ## end sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||