File Coverage

blib/lib/PLS/Server/Response/Hover.pm
Criterion Covered Total %
statement 12 22 54.5
branch 0 4 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 32 50.0


line stmt bran cond sub pod time code
1              
2             use strict;
3 9     9   60 use warnings;
  9         30  
  9         270  
4 9     9   61  
  9         85  
  9         398  
5             use parent q(PLS::Server::Response);
6 9     9   75  
  9         18  
  9         147  
7             use PLS::Parser::Document;
8 9     9   686  
  9         35  
  9         3007  
9             =head1 NAME
10              
11             PLS::Server::Response::Hover
12              
13             =head1 DESCRIPTION
14              
15             This is a message from the server to the client with
16             documentation for the location the mouse is currently hovering.
17              
18             =cut
19              
20             {
21             my ($class, $request) = @_;
22              
23 0     0 0   my $self = bless {
24             id => $request->{id},
25             result => undef
26             }, $class;
27 0            
28             my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri});
29             return $self if (ref $document ne 'PLS::Parser::Document');
30 0           my ($ok, $pod) = $document->find_pod($request->{params}{textDocument}{uri}, @{$request->{params}{position}}{qw(line character)});
31 0 0         return $self unless $ok;
32 0            
  0            
33 0 0         $self->{result} = {
34             contents => {kind => 'markdown', value => ${$pod->{markdown}}},
35             range => $pod->{element}->range()
36 0           };
37              
38 0           return $self;
39             } ## end sub new
40 0            
41             1;