blib/lib/PLS/Server/Request/Initialize.pm

filter: Statementstmt 97.9% 47 / 48 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 88.2% 60 / 68 CC 4 SCAR 6.7
CC
4
Cov
91%
service
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« blib/lib/PLS/Server/Response/Formatting.pm ↑ Summary blib/lib/PLS/Parser/Element/Package.pm »
1 package PLS::Server::Request::Initialize;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 13 ▶use parent 'PLS::Server::Request';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use PPI::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 13 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 13 ▶use PLS::Parser::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 13 ▶use PLS::Parser::Index;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 13 ▶use PLS::Server::Response::InitializeResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 13 ▶use PLS::Server::State;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 =head1 NAME
17  
18 PLS::Server::Request::Initialize
19  
20 =head1 DESCRIPTION
21  
22 This is the first request from the client to the server.
23  
24 The client provides information about itself, and the server performs
25 some initialization for itself and returns its capabilities.
26  
27 =cut
28  
29 sub service
30 5 ▶{
Subroutine service: called CC=4 SCAR=14.1
Pod undocumented
31 5 my ($self) = @_;
32  
33 5 my $root_uri = $self->{params}{rootUri};
34 5 my $workspace_folders = $self->{params}{workspaceFolders};
35 5 ▶ $workspace_folders = [] if (ref $workspace_folders ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $workspace_folders ne "ARRAY" 0 5 5
36 5 @{$workspace_folders} = map { $_->{uri} } @{$workspace_folders};
37 0 ▶ push @{$workspace_folders}, $root_uri if (not scalar @{$workspace_folders} and length $root_uri);
Branch: 1 branch
BranchTrueFalseTotal
if not scalar @{$workspace_folders;} and length $root_uri 0 5 5
Condition33%1/3
not scalar @{$workspace_folders;} and length $root_uri
!ll&&!rl&&r
500
MC/DC0%0/2
not scalar @{$workspace_folders;} and length $root_uri
not scalar @{$workspace_folders;} length $root_uri
Truth table33%1/3
not(A) and B
A= not scalar @{$workspace_folders;}B= length $root_uri
ABresult
0X0
100
111
38 5 @{$workspace_folders} = map { $_->file } grep { $_->can('file') } map { URI->new($_) } @{$workspace_folders};
39  
40 # Create and cache index object
41 5 PLS::Parser::Index->new(workspace_folders => $workspace_folders);
42  
43 5 $PLS::Server::State::CLIENT_CAPABILITIES = $self->{params}{capabilities};
44  
45 5 return PLS::Server::Response::InitializeResult->new($self);
46 } ## end sub service
47  
48 13 1;
« blib/lib/PLS/Server/Response/Formatting.pm ↑ Summary blib/lib/PLS/Parser/Element/Package.pm »