| 1 | package PLS::Server::Response::Hover; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use parent q(PLS::Server::Response); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use PLS::Parser::Document; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | ▶ | my ($class, $request) = @_; | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 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 | my ($ok, $pod) = $document->find_pod(@{$request->{params}{position}}{qw(line character)}); | |||||||||
| 32 | 0 | ▶ | return $self unless $ok; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | $self->{result} = { | ||||||||||
| 35 | 0 | contents => {kind => 'markdown', value => ${$pod->{markdown}}}, | |||||||||
| 36 | range => { | ||||||||||
| 37 | start => { | ||||||||||
| 38 | line => $pod->line_number, | ||||||||||
| 39 | character => $pod->column_number, | ||||||||||
| 40 | }, | ||||||||||
| 41 | end => { | ||||||||||
| 42 | line => $pod->line_number, | ||||||||||
| 43 | character => $pod->column_number + length $pod->{element}->content, | ||||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | 0 | }; | |||||||||
| 47 | |||||||||||
| 48 | 0 | return $self; | |||||||||
| 49 | } ## end sub new | ||||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||