line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
9
|
|
|
9
|
|
54
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
224
|
|
4
|
9
|
|
|
9
|
|
60
|
|
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
190
|
|
5
|
|
|
|
|
|
|
use parent 'PLS::Server::Request'; |
6
|
9
|
|
|
9
|
|
28
|
|
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
77
|
|
7
|
|
|
|
|
|
|
use List::Util; |
8
|
9
|
|
|
9
|
|
495
|
use Path::Tiny; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
341
|
|
9
|
9
|
|
|
9
|
|
44
|
|
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
354
|
|
10
|
|
|
|
|
|
|
use PLS::JSON; |
11
|
9
|
|
|
9
|
|
45
|
use PLS::Server::Request::Workspace::Configuration; |
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
401
|
|
12
|
9
|
|
|
9
|
|
46
|
use PLS::Server::Request::Client::RegisterCapability; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
235
|
|
13
|
9
|
|
|
9
|
|
3630
|
use PLS::Server::Request::Progress; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
267
|
|
14
|
9
|
|
|
9
|
|
3127
|
use PLS::Server::Request::Window::WorkDoneProgress::Create; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
234
|
|
15
|
9
|
|
|
9
|
|
3607
|
use PLS::Server::State; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
249
|
|
16
|
9
|
|
|
9
|
|
54
|
|
|
9
|
|
|
|
|
10
|
|
|
9
|
|
|
|
|
5564
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
PLS::Server::Request::Initialized |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This is a request from the client to the server indicating that it received |
24
|
|
|
|
|
|
|
the result of the initialize request from the server. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
The server sends back some initial requests that it needs to complete initialization. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
my ($self, $server) = @_; |
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
5
|
0
|
36
|
# now that we're initialized, put in a request for our configuration items. |
34
|
|
|
|
|
|
|
$server->send_server_request(PLS::Server::Request::Workspace::Configuration->new()); |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
260
|
# request that we receive a notification any time configuration changes |
37
|
|
|
|
|
|
|
my @capabilities = ({id => 'did-change-configuration', method => 'workspace/didChangeConfiguration'}); |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
76
|
# request that we receive a notification every time a file changes, |
40
|
|
|
|
|
|
|
# so that we can reindex it. |
41
|
|
|
|
|
|
|
my $index = PLS::Parser::Index->new(); |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
68
|
if (scalar @{$index->workspace_folders}) |
44
|
|
|
|
|
|
|
{ |
45
|
5
|
50
|
|
|
|
19
|
push @capabilities, |
|
5
|
|
|
|
|
32
|
|
46
|
|
|
|
|
|
|
{ |
47
|
5
|
|
|
|
|
115
|
id => 'did-change-watched-files', |
48
|
|
|
|
|
|
|
method => 'workspace/didChangeWatchedFiles', |
49
|
|
|
|
|
|
|
registerOptions => { |
50
|
|
|
|
|
|
|
watchers => [ |
51
|
|
|
|
|
|
|
{ |
52
|
|
|
|
|
|
|
globPattern => '**/*' |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
] |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
} ## end if (scalar @{$index->workspace_folders...}) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$server->send_server_request(PLS::Server::Request::Client::RegisterCapability->new(\@capabilities)); |
60
|
|
|
|
|
|
|
|
61
|
5
|
|
|
|
|
165
|
# Now is a good time to start indexing files. |
62
|
|
|
|
|
|
|
$self->index_files($index, $server); |
63
|
|
|
|
|
|
|
|
64
|
5
|
|
|
|
|
36
|
return; |
65
|
|
|
|
|
|
|
} ## end sub service |
66
|
5
|
|
|
|
|
164
|
|
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
my ($self, $index, $server) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if ($PLS::Server::State::CLIENT_CAPABILITIES->{window}{workDoneProgress}) |
71
|
5
|
|
|
5
|
0
|
22
|
{ |
72
|
|
|
|
|
|
|
$self->index_files_with_progress($index, $server); |
73
|
5
|
50
|
|
|
|
199
|
} |
74
|
|
|
|
|
|
|
else |
75
|
5
|
|
|
|
|
88
|
{ |
76
|
|
|
|
|
|
|
$self->index_files_without_progress($index); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
return; |
80
|
|
|
|
|
|
|
} ## end sub index_files |
81
|
|
|
|
|
|
|
|
82
|
5
|
|
|
|
|
123
|
{ |
83
|
|
|
|
|
|
|
my (undef, $index) = @_; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$index->index_files()->then(sub { Future->wait_all(@_) })->retain(); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
0
|
0
|
return; |
88
|
|
|
|
|
|
|
} ## end sub index_files_without_progress |
89
|
0
|
|
|
0
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
|
|
0
|
my (undef, $index, $server) = @_; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $work_done_progress_create = PLS::Server::Request::Window::WorkDoneProgress::Create->new(); |
94
|
|
|
|
|
|
|
$server->send_server_request($work_done_progress_create); |
95
|
|
|
|
|
|
|
|
96
|
5
|
|
|
5
|
0
|
15
|
$server->send_server_request( |
97
|
|
|
|
|
|
|
PLS::Server::Request::Progress->new( |
98
|
5
|
|
|
|
|
98
|
token => $work_done_progress_create->{params}{token}, |
99
|
5
|
|
|
|
|
35
|
kind => 'begin', |
100
|
|
|
|
|
|
|
title => 'Indexing', |
101
|
|
|
|
|
|
|
cancellable => PLS::JSON::false, |
102
|
|
|
|
|
|
|
percentage => 0 |
103
|
|
|
|
|
|
|
) |
104
|
5
|
|
|
|
|
41
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$index->index_files()->then( |
107
|
|
|
|
|
|
|
sub { |
108
|
|
|
|
|
|
|
my @futures = @_; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $done = 0; |
111
|
|
|
|
|
|
|
my $total = scalar @futures; |
112
|
|
|
|
|
|
|
|
113
|
5
|
|
|
5
|
|
672
|
foreach my $future (@futures) |
114
|
|
|
|
|
|
|
{ |
115
|
5
|
|
|
|
|
81
|
$future->then( |
116
|
5
|
|
|
|
|
35
|
sub { |
117
|
|
|
|
|
|
|
my ($file) = @_; |
118
|
5
|
|
|
|
|
63
|
|
119
|
|
|
|
|
|
|
my $workspace_folder = List::Util::first { path($_)->subsumes($file) } @{$index->workspace_folders}; |
120
|
|
|
|
|
|
|
$file = path($file)->relative($workspace_folder); |
121
|
|
|
|
|
|
|
$done++; |
122
|
4
|
|
|
|
|
558
|
$server->send_server_request( |
123
|
|
|
|
|
|
|
PLS::Server::Request::Progress->new( |
124
|
4
|
|
|
|
|
119
|
token => $work_done_progress_create->{params}{token}, |
|
4
|
|
|
|
|
125
|
|
|
4
|
|
|
|
|
26
|
|
125
|
4
|
|
|
|
|
2436
|
kind => 'report', |
126
|
4
|
|
|
|
|
1219
|
message => "Indexed $file ($done/$total)", |
127
|
|
|
|
|
|
|
percentage => int($done * 100 / $total) |
128
|
|
|
|
|
|
|
) |
129
|
|
|
|
|
|
|
); |
130
|
4
|
|
|
|
|
68
|
} |
131
|
|
|
|
|
|
|
)->retain(); |
132
|
|
|
|
|
|
|
} ## end foreach my $future (@futures...) |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
return Future->wait_all(@futures)->then( |
135
|
|
|
|
|
|
|
sub { |
136
|
5
|
|
|
|
|
122
|
$server->send_server_request( |
137
|
|
|
|
|
|
|
PLS::Server::Request::Progress->new( |
138
|
|
|
|
|
|
|
token => $work_done_progress_create->{params}{token}, |
139
|
|
|
|
|
|
|
kind => 'end', |
140
|
|
|
|
|
|
|
message => 'Finished indexing all files' |
141
|
|
|
|
|
|
|
) |
142
|
|
|
|
|
|
|
); |
143
|
|
|
|
|
|
|
|
144
|
4
|
|
|
|
|
728
|
} |
145
|
|
|
|
|
|
|
); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
)->retain(); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
return; |
150
|
5
|
|
|
|
|
665
|
} ## end sub index_files_with_progress |
151
|
|
|
|
|
|
|
|
152
|
5
|
|
|
|
|
183
|
1; |