File Coverage

blib/lib/PLS/Server/Response/Location.pm
Criterion Covered Total %
statement 12 25 48.0
branch 0 4 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 35 45.7


line stmt bran cond sub pod time code
1              
2             use strict;
3 9     9   54 use warnings;
  9         10  
  9         232  
4 9     9   36  
  9         18  
  9         198  
5             use parent q(PLS::Server::Response);
6 9     9   36  
  9         105  
  9         52  
7             use PLS::Parser::Document;
8 9     9   462  
  9         17  
  9         1568  
9             =head1 NAME
10              
11             PLS::Server::Response::Location
12              
13             =head1 DESCRIPTION
14              
15             This is a message from the server to the client providing a location.
16             This is typically used to provide the location of the definition of a symbol.
17              
18             =cut
19              
20             {
21             my ($class, $request) = @_;
22              
23 0     0 0   my $self = {
24             id => $request->{id},
25             result => undef
26             };
27 0            
28             bless $self, $class;
29              
30 0           my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri});
31             return $self if (ref $document ne 'PLS::Parser::Document');
32 0            
33 0 0         my $results = $document->go_to_definition(@{$request->{params}{position}}{qw(line character)});
34              
35 0           if (ref $results eq 'ARRAY')
  0            
36             {
37 0 0         foreach my $result (@$results)
38             {
39 0           delete @{$result}{qw(package signature kind)};
40             }
41 0           } ## end if (ref $results eq 'ARRAY'...)
  0            
42              
43             $self->{result} = $results;
44             return $self;
45 0           } ## end sub new
46 0            
47             1;