| 1 | package PLS::Server::Response::DocumentSymbol; | ||||||||||||||||||||||||||||
| 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 'PLS::Server::Response'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use IO::Async::Loop; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 9 | ▶ | use PLS::Parser::Document; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use PLS::Parser::DocumentSymbols; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | PLS::Server::Response::DocumentSymbol | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | This is a message from the server to the client with a list | ||||||||||||||||||||||||||||
| 20 | of symbols in the current document. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | sub new | ||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my ($class, $request) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | my $self = bless {id => $request->{id}, result => undef}, $class; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | my $uri = $request->{params}{textDocument}{uri}; | |||||||||||||||||||||||||||
| 31 | 0 | my $version = PLS::Parser::Document::uri_version($uri); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | return PLS::Parser::DocumentSymbols->get_all_document_symbols_async($uri)->then( | ||||||||||||||||||||||||||||
| 34 | sub { | ||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my ($symbols) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | my $current_version = PLS::Parser::Document::uri_version($uri); | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | return Future->done($self) unless (length $current_version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return Future->done($self) if (length $version and $current_version > $version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $version and $current_version > $version
MC/DC0%0/2
length $version and $current_version > $version
length $version
$current_version > $version
Truth table0%0/3
A and B
A= length $versionB= $current_version > $version
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | $self->{result} = $symbols; | |||||||||||||||||||||||||||
| 42 | 0 | return Future->done($self); | |||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||
| 44 | sub { | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | return Future->done($self); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 0 | ); | |||||||||||||||||||||||||||
| 48 | } ## end sub new | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 9 | 1; | |||||||||||||||||||||||||||