File Coverage

blib/lib/PLS/Server/Response/Hover.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 4 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 31 51.6


line stmt bran cond sub pod time code
1             package PLS::Server::Response::Hover;
2              
3 11     11   233 use strict;
  11         172  
  11         1032  
4 11     11   146 use warnings;
  11         168  
  11         904  
5              
6 11     11   250 use parent q(PLS::Server::Response);
  11         152  
  11         900  
7              
8 11     11   1836 use PLS::Parser::Document;
  11         175  
  11         6222  
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}, line => $request->{params}{position}{line});
31 0 0         return $self if (ref $document ne 'PLS::Parser::Document');
32 0           my ($ok, $pod) = $document->find_pod($request->{params}{textDocument}{uri}, 1, $request->{params}{position}{character});
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;