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             package PLS::Server::Response::Hover;
2              
3 9     9   125 use strict;
  9         73  
  9         339  
4 9     9   125 use warnings;
  9         66  
  9         361  
5              
6 9     9   149 use parent q(PLS::Server::Response);
  9         34  
  9         99  
7              
8 9     9   884 use PLS::Parser::Document;
  9         87  
  9         2581  
9              
10             =head1 NAME
11              
12             PLS::Server::Response::Hover
13              
14             =head1 DESCRIPTION
15              
16             This is a message from the server to the client with
17             documentation for the location the mouse is currently hovering.
18              
19             =cut
20              
21             sub new
22             {
23 0     0 0   my ($class, $request) = @_;
24              
25             my $self = bless {
26             id => $request->{id},
27 0           result => undef
28             }, $class;
29              
30 0           my $document = PLS::Parser::Document->new(uri => $request->{params}{textDocument}{uri});
31 0 0         return $self if (ref $document ne 'PLS::Parser::Document');
32 0           my ($ok, $pod) = $document->find_pod($request->{params}{textDocument}{uri}, @{$request->{params}{position}}{qw(line character)});
  0            
33 0 0         return $self unless $ok;
34              
35             $self->{result} = {
36 0           contents => {kind => 'markdown', value => ${$pod->{markdown}}},
37             range => $pod->{element}->range()
38 0           };
39              
40 0           return $self;
41             } ## end sub new
42              
43             1;