| 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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
not scalar @{$workspace_folders;} and length $root_uri
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
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||