PLS/Server/Request/Workspace/DidChangeWatchedFiles.pm

filter: Statementstmt 58.1% 25 / 43 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 49.2% 33 / 67 CC 9 SCAR 38.7
CC
9
Cov
44%
service
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 48.1
« PLS/Server/Request/Workspace/Configuration.pm ↑ Summary PLS/Parser/Pod/Package.pm »
1 package PLS::Server::Request::Workspace::DidChangeWatchedFiles;
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 'PLS::Server::Request';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Coro;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use List::Util qw(any uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use PLS::Parser::Document;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use PLS::Server::Request::Diagnostics::PublishDiagnostics;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 NAME
16  
17 PLS::Server::Request::Workspace::DidChangeWatchedFiles
18  
19 =head1 DESCRIPTION
20  
21 This is a notification from the client to the server indicating
22 that one or more files that the server watched have changed.
23  
24 The server queues up these files to be re-indexed.
25  
26 =cut
27  
28 sub service
29 {
30 0 ▶ my ($self, $server) = @_;
Subroutine service: not called CC=9 SCAR=45.0
Pod undocumented
31  
32 0 ▶ return unless (ref $self->{params}{changes} eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{"params"}{"changes"} eq "ARRAY" 0 0 0
33  
34 0 my $index = PLS::Parser::Document->get_index();
35  
36 0 my @changed_files;
37 my $any_deletes;
38  
39 0 foreach my $change (@{$self->{params}{changes}})
40 {
41 0 my $file = URI->new($change->{uri});
42  
43 0 ▶ next unless (ref $file eq 'URI::file');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $file eq "URI::file" 0 0 0
44  
45 0 ▶ if ($change->{type} == 3)
Branch: 1 branch
BranchTrueFalseTotal
if ($change->{"type"} == 3) 0 0 0
46 {
47 0 $any_deletes = 1;
48 0 next;
49 }
50  
51 0 ▶ next unless $index->is_perl_file($file->file);
Branch: 1 branch
BranchTrueFalseTotal
unless $index->is_perl_file($file->file) 0 0 0
52 0 ▶ next if $index->is_ignored($file->file);
Branch: 1 branch
BranchTrueFalseTotal
if $index->is_ignored($file->file) 0 0 0
53  
54 0 push @changed_files, $file->file;
55 } ## end foreach my $change (@{$self...})
56  
57 0 ▶ $index->cleanup_old_files() if $any_deletes;
Branch: 1 branch
BranchTrueFalseTotal
if $any_deletes 0 0 0
58  
59 0 @changed_files = uniq @changed_files;
60 0 ▶ $index->index_files(@changed_files) if (scalar @changed_files);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @changed_files 0 0 0
61  
62 0 return;
63 } ## end sub service
64  
65 1 1;
« PLS/Server/Request/Workspace/Configuration.pm ↑ Summary PLS/Parser/Pod/Package.pm »