PLS/Server/Request/Initialize.pm

filter: Statementstmt 97.9% 47 / 48 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 87.1% 61 / 70 CC 5 SCAR 9.2
CC
5
Cov
89%
service
5.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« PLS/Server/Request/Exit.pm ↑ Summary PLS/Server/Response/Formatting.pm »
1 package PLS::Server::Request::Initialize;
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::Request';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 ▶use PPI::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 9 ▶use PLS::Parser::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use PLS::Parser::Index;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use PLS::Server::Response::InitializeResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶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 {
31 5 ▶ my ($self, $server) = @_;
Subroutine service: called CC=5 SCAR=16.5
Pod undocumented
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 5 ▶ 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 { URI->new($_)->file } @{$workspace_folders};
39  
40 # Create and cache index object
41 5 PLS::Parser::Index->new(workspace_folders => $workspace_folders);
42  
43 5 ▶ if (length $self->{params}{processId})
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->{"params"}{"processId"}) 5 0 5
44 {
45 5 $server->monitor_client_process($self->{params}{processId});
46 }
47  
48 5 $PLS::Server::State::CLIENT_CAPABILITIES = $self->{params}{capabilities};
49  
50 5 return PLS::Server::Response::InitializeResult->new($self);
51 } ## end sub service
52  
53 9 1;
« PLS/Server/Request/Exit.pm ↑ Summary PLS/Server/Response/Formatting.pm »