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