PLS/Server/Response/RangeFormatting.pm

filter: Statementstmt 54.1% 13 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 50.0% 17 / 34 CC 3 SCAR 17.4
CC
3
Cov
46%
new
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« PLS/Trie.pm ↑ Summary PLS/Server/Request/Workspace/ExecuteCommand.pm »
1 package PLS::Server::Response::RangeFormatting;
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 parent q(PLS::Server::Response);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use PLS::Parser::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 PLS::Server::Response::RangeFormatting
13  
14 =head1 DESCRIPTION
15  
16 This is a message from the server to the client with a document range
17 after having been formatted.
18  
19 =cut
20  
21 sub new
22 {
23 0 ▶ my ($class, $request) = @_;
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
24  
25 0 ▶ if (ref $request->{params}{options} eq 'HASH')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $request->{"params"}{"options"} eq "HASH") 0 0 0
26 {
27 # these options aren't really valid for range formatting
28 0 delete $request->{params}{options}{trimFinalNewlines};
29 0 delete $request->{params}{options}{insertFinalNewline};
30 } ## end if (ref $request->{params...})
31  
32 0 my ($ok, $formatted) = PLS::Parser::Document->format_range(uri => $request->{params}{textDocument}{uri}, range => $request->{params}{range}, formatting_options => $request->{params}{options});
33  
34 0 my %self = (id => $request->{id}, result => undef);
35  
36 0 ▶ if ($ok)
Branch: 1 branch
BranchTrueFalseTotal
if ($ok) { } 0 0 0
37 {
38 0 $self{result} = $formatted;
39 }
40 else
41 {
42 0 delete $self{result};
43 0 $self{error} = $formatted;
44 }
45  
46 0 return bless \%self, $class;
47 } ## end sub new
48  
49 1 1;
« PLS/Trie.pm ↑ Summary PLS/Server/Request/Workspace/ExecuteCommand.pm »