| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PLS::Server::Response::Location; |
|
2
|
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
102
|
use strict; |
|
|
11
|
|
|
|
|
24
|
|
|
|
11
|
|
|
|
|
635
|
|
|
4
|
11
|
|
|
11
|
|
59
|
use warnings; |
|
|
11
|
|
|
|
|
31
|
|
|
|
11
|
|
|
|
|
676
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
82
|
use parent q(PLS::Server::Response); |
|
|
11
|
|
|
|
|
22
|
|
|
|
11
|
|
|
|
|
66
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
1048
|
use PLS::Parser::Document; |
|
|
11
|
|
|
|
|
31
|
|
|
|
11
|
|
|
|
|
4950
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
PLS::Server::Response::Location |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This is a message from the server to the client providing a location. |
|
17
|
|
|
|
|
|
|
This is typically used to provide the location of the definition of a symbol. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
0
|
|
|
0
|
0
|
|
my ($class, $request) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $self = { |
|
26
|
|
|
|
|
|
|
id => $request->{id}, |
|
27
|
0
|
|
|
|
|
|
result => undef |
|
28
|
|
|
|
|
|
|
}; |
|
29
|
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
bless $self, $class; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my ($line, $character) = @{$request->{params}{position}}{qw(line character)}; |
|
|
0
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri}, line => $line); |
|
35
|
0
|
0
|
|
|
|
|
return $self if (ref $document ne 'PLS::Parser::Document'); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $results = $document->go_to_definition($line, $character); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# If there are no results, for a variable, we need to fall back to checking the entire document. |
|
40
|
0
|
0
|
0
|
|
|
|
if (ref $results ne 'ARRAY' or not scalar @{$results}) |
|
|
0
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
{ |
|
42
|
0
|
|
|
|
|
|
my @matches = $document->find_elements_at_location($line, $character); |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
0
|
|
|
if (List::Util::any { $_->variable_name() } @matches) |
|
|
0
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
{ |
|
46
|
0
|
|
|
|
|
|
$document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri}); |
|
47
|
0
|
0
|
|
|
|
|
return $self if (ref $document ne 'PLS::Parser::Document'); |
|
48
|
0
|
|
|
|
|
|
$results = $document->go_to_definition($line, $character); |
|
49
|
|
|
|
|
|
|
} ## end if (List::Util::any { ...}) |
|
50
|
|
|
|
|
|
|
} ## end if (ref $results ne 'ARRAY'...) |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if (ref $results eq 'ARRAY') |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
0
|
|
|
|
|
|
foreach my $result (@{$results}) |
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
{ |
|
56
|
0
|
|
|
|
|
|
delete @{$result}{qw(package signature kind)}; |
|
|
0
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} ## end if (ref $results eq 'ARRAY'...) |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->{result} = $results; |
|
61
|
0
|
|
|
|
|
|
return $self; |
|
62
|
|
|
|
|
|
|
} ## end sub new |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |