PLS/Server/Method/ServerMethod.pm

filter: Statementstmt 67.8% 19 / 28 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 56.8% 25 / 44 CC 5 SCAR 26.5
CC
5
Cov
53%
get_request
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 14.2
« PLS/Server/Method/Workspace.pm ↑ Summary PLS/Server/Request/CancelRequest.pm »
1 package PLS::Server::Method::ServerMethod;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use PLS::Server::State;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use PLS::Server::Request::Initialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use PLS::Server::Request::Initialized;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use PLS::Server::Request::CancelRequest;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 PLS::Server::Method::ServerMethod
14  
15 =head1 DESCRIPTION
16  
17 This module redirects requests that the server must handle to the appropriate
18 subclass of L<PLS::Server::Request>.
19  
20 It will also return the appropriate error if the client is attempting to make a
21 request before the server has been initialized (L<PLS::Server::Response::ServerNotInitialized>).
22  
23 Requests currently implemented:
24  
25 =over
26  
27 =item initialize - L<https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize>
28  
29 L<PLS::Server::Request::Initialize>
30  
31 =item initialized - L<https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialized>
32  
33 L<PLS::Server::Request::Initialized>
34  
35 =item $/cancelRequest - L<https://microsoft.github.io/language-server-protocol/specifications/specification-current/#cancelRequest>
36  
37 L<PLS::Server::Request::CancelRequest>
38  
39 =back
40  
41 =cut
42  
43 sub get_request
44 {
45 0 ▶ my ($request) = @_;
Subroutine get_request: not called CC=5 SCAR=34.0
Pod undocumented
46  
47 0 my $method = $request->{method};
48  
49 0 ▶ if ($method eq 'initialize')
Branch: 2 branches
BranchTrueFalseTotal
if ($method eq 'initialize') { } 0 0 0
elsif ($method eq 'initialized') { } 0 0 0
50 {
51 0 return PLS::Server::Request::Initialize->new($request);
52 }
53 elsif ($method eq 'initialized')
54 {
55 0 return PLS::Server::Request::Initialized->new($request);
56 }
57  
58 0 ▶ return PLS::Server::Response::ServerNotInitialized->new($request) unless $PLS::Server::State::INITIALIZED;
Branch: 1 branch
BranchTrueFalseTotal
unless $PLS::Server::State::INITIALIZED 0 0 0
59  
60 0 ▶ if ($method eq '$/cancelRequest')
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq "\$/cancelRequest") 0 0 0
61 {
62 0 return PLS::Server::Request::CancelRequest->new($request);
63 }
64  
65 0 return;
66 } ## end sub get_request
67  
68 1 1;
« PLS/Server/Method/Workspace.pm ↑ Summary PLS/Server/Request/CancelRequest.pm »