line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PLS::Server::Response::SignatureHelp; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
45
|
use strict; |
|
9
|
|
|
|
|
74
|
|
|
9
|
|
|
|
|
340
|
|
4
|
9
|
|
|
9
|
|
55
|
use warnings; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
309
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
112
|
use parent q(PLS::Server::Response); |
|
9
|
|
|
|
|
72
|
|
|
9
|
|
|
|
|
46
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
631
|
use Scalar::Util qw(blessed); |
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
1580
|
|
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
|
111
|
use PLS::Parser::Document; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
2885
|
|
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
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
0
|
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)}; |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri}, line => $line); |
34
|
0
|
0
|
|
|
|
|
return $self if (ref $document ne 'PLS::Parser::Document'); |
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}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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
|
0
|
0
|
|
|
|
if ( blessed($sub_call) |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
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
|
0
|
|
|
|
|
$self->{result} = {signatures => \@signatures, activeParameter => $active_parameter} if (scalar @signatures); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return $self; |
53
|
|
|
|
|
|
|
} ## end sub new |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |