line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
9
|
|
|
9
|
|
153
|
use warnings; |
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
272
|
|
4
|
9
|
|
|
9
|
|
44
|
|
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
207
|
|
5
|
|
|
|
|
|
|
use parent q(PLS::Server::Response); |
6
|
9
|
|
|
9
|
|
40
|
|
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
50
|
|
7
|
|
|
|
|
|
|
use Scalar::Util qw(blessed); |
8
|
9
|
|
|
9
|
|
545
|
|
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
1570
|
|
9
|
|
|
|
|
|
|
use PLS::Parser::Document; |
10
|
9
|
|
|
9
|
|
54
|
|
|
9
|
|
|
|
|
74
|
|
|
9
|
|
|
|
|
3180
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
PLS::Server::Response::SignatureHelp |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This is a message from the server to the client with information about the |
18
|
|
|
|
|
|
|
parameters of the current function. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
my ($class, $request) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
0
|
|
my $self = bless { |
26
|
|
|
|
|
|
|
id => $request->{id}, |
27
|
|
|
|
|
|
|
result => undef |
28
|
|
|
|
|
|
|
}, $class; |
29
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my ($line, $character) = @{$request->{params}{position}}{qw(line character)}; |
31
|
|
|
|
|
|
|
my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri}, line => $line); |
32
|
0
|
|
|
|
|
|
return $self if (ref $document ne 'PLS::Parser::Document'); |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
my $list = $document->find_current_list($line, $character); |
35
|
|
|
|
|
|
|
my ($results, $sub_call) = $document->go_to_definition_of_closest_subroutine($list, $line, $character); |
36
|
0
|
|
|
|
|
|
my @signatures = map { $_->{signature} } @{$results}; |
37
|
0
|
|
|
|
|
|
my $active_parameter = $document->get_list_index($list, $request->{params}{position}{line}, $request->{params}{position}{character}); |
38
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
# If this is a method call, then we should skip the first parameter. |
40
|
|
|
|
|
|
|
if ( blessed($sub_call) |
41
|
|
|
|
|
|
|
and blessed($sub_call->previous_sibling) |
42
|
0
|
0
|
0
|
|
|
|
and $sub_call->previous_sibling->type eq 'PPI::Token::Operator' |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
43
|
|
|
|
|
|
|
and $sub_call->previous_sibling->name eq '->') |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
$active_parameter++; |
46
|
|
|
|
|
|
|
} ## end if (blessed($sub_call)...) |
47
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->{result} = {signatures => \@signatures, activeParameter => $active_parameter} if (scalar @signatures); |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
return $self; |
51
|
|
|
|
|
|
|
} ## end sub new |
52
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |