| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
198
|
|
|
4
|
9
|
|
|
9
|
|
36
|
|
|
|
9
|
|
|
|
|
9
|
|
|
|
9
|
|
|
|
|
187
|
|
|
5
|
|
|
|
|
|
|
use parent 'PLS::Server::Request'; |
|
6
|
9
|
|
|
9
|
|
36
|
|
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
52
|
|
|
7
|
|
|
|
|
|
|
use List::Util; |
|
8
|
9
|
|
|
9
|
|
398
|
use Path::Tiny; |
|
|
9
|
|
|
|
|
25
|
|
|
|
9
|
|
|
|
|
514
|
|
|
9
|
9
|
|
|
9
|
|
45
|
|
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
323
|
|
|
10
|
|
|
|
|
|
|
use PLS::JSON; |
|
11
|
9
|
|
|
9
|
|
45
|
use PLS::Server::Request::Workspace::Configuration; |
|
|
9
|
|
|
|
|
66
|
|
|
|
9
|
|
|
|
|
383
|
|
|
12
|
9
|
|
|
9
|
|
44
|
use PLS::Server::Request::Client::RegisterCapability; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
343
|
|
|
13
|
9
|
|
|
9
|
|
2949
|
use PLS::Server::Request::Progress; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
216
|
|
|
14
|
9
|
|
|
9
|
|
3180
|
use PLS::Server::Request::Window::WorkDoneProgress::Create; |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
222
|
|
|
15
|
9
|
|
|
9
|
|
2819
|
use PLS::Server::State; |
|
|
9
|
|
|
|
|
26
|
|
|
|
9
|
|
|
|
|
216
|
|
|
16
|
9
|
|
|
9
|
|
45
|
|
|
|
9
|
|
|
|
|
10
|
|
|
|
9
|
|
|
|
|
5218
|
|
|
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
|
35
|
# 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
|
|
|
|
|
174
|
# request that we receive a notification any time configuration changes |
|
37
|
|
|
|
|
|
|
my @capabilities = ({id => 'did-change-configuration', method => 'workspace/didChangeConfiguration'}); |
|
38
|
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
68
|
# 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
|
|
|
|
|
73
|
if (scalar @{$index->workspace_folders}) |
|
44
|
|
|
|
|
|
|
{ |
|
45
|
5
|
50
|
|
|
|
16
|
push @capabilities, |
|
|
5
|
|
|
|
|
25
|
|
|
46
|
|
|
|
|
|
|
{ |
|
47
|
5
|
|
|
|
|
38
|
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
|
|
|
|
|
116
|
# Now is a good time to start indexing files. |
|
62
|
|
|
|
|
|
|
$self->index_files($index, $server); |
|
63
|
|
|
|
|
|
|
|
|
64
|
5
|
|
|
|
|
32
|
return; |
|
65
|
|
|
|
|
|
|
} ## end sub service |
|
66
|
5
|
|
|
|
|
113
|
|
|
67
|
|
|
|
|
|
|
{ |
|
68
|
|
|
|
|
|
|
my ($self, $index, $server) = @_; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
if ($PLS::Server::State::CLIENT_CAPABILITIES->{window}{workDoneProgress}) |
|
71
|
5
|
|
|
5
|
0
|
14
|
{ |
|
72
|
|
|
|
|
|
|
$self->index_files_with_progress($index, $server); |
|
73
|
5
|
50
|
|
|
|
110
|
} |
|
74
|
|
|
|
|
|
|
else |
|
75
|
5
|
|
|
|
|
73
|
{ |
|
76
|
|
|
|
|
|
|
$self->index_files_without_progress($index); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
return; |
|
80
|
|
|
|
|
|
|
} ## end sub index_files |
|
81
|
|
|
|
|
|
|
|
|
82
|
5
|
|
|
|
|
161
|
{ |
|
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
|
|
|
|
|
84
|
token => $work_done_progress_create->{params}{token}, |
|
99
|
5
|
|
|
|
|
28
|
kind => 'begin', |
|
100
|
|
|
|
|
|
|
title => 'Indexing', |
|
101
|
|
|
|
|
|
|
cancellable => PLS::JSON::false, |
|
102
|
|
|
|
|
|
|
percentage => 0 |
|
103
|
|
|
|
|
|
|
) |
|
104
|
5
|
|
|
|
|
34
|
); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$index->index_files()->then( |
|
107
|
|
|
|
|
|
|
sub { |
|
108
|
|
|
|
|
|
|
my @futures = @_; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $done = 0; |
|
111
|
|
|
|
|
|
|
my $total = scalar @futures; |
|
112
|
|
|
|
|
|
|
|
|
113
|
4
|
|
|
4
|
|
561
|
foreach my $future (@futures) |
|
114
|
|
|
|
|
|
|
{ |
|
115
|
4
|
|
|
|
|
21
|
$future->then( |
|
116
|
4
|
|
|
|
|
55
|
sub { |
|
117
|
|
|
|
|
|
|
my ($file) = @_; |
|
118
|
4
|
|
|
|
|
43
|
|
|
119
|
|
|
|
|
|
|
my $workspace_folder = List::Util::first { path($_)->subsumes($file) } @{$index->workspace_folders}; |
|
120
|
|
|
|
|
|
|
$file = path($file)->relative($workspace_folder); |
|
121
|
|
|
|
|
|
|
$done++; |
|
122
|
4
|
|
|
|
|
531
|
$server->send_server_request( |
|
123
|
|
|
|
|
|
|
PLS::Server::Request::Progress->new( |
|
124
|
4
|
|
|
|
|
71
|
token => $work_done_progress_create->{params}{token}, |
|
|
4
|
|
|
|
|
141
|
|
|
|
4
|
|
|
|
|
42
|
|
|
125
|
4
|
|
|
|
|
1869
|
kind => 'report', |
|
126
|
4
|
|
|
|
|
934
|
message => "Indexed $file ($done/$total)", |
|
127
|
|
|
|
|
|
|
percentage => int($done * 100 / $total) |
|
128
|
|
|
|
|
|
|
) |
|
129
|
|
|
|
|
|
|
); |
|
130
|
4
|
|
|
|
|
52
|
} |
|
131
|
|
|
|
|
|
|
)->retain(); |
|
132
|
|
|
|
|
|
|
} ## end foreach my $future (@futures...) |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
return Future->wait_all(@futures)->then( |
|
135
|
|
|
|
|
|
|
sub { |
|
136
|
4
|
|
|
|
|
103
|
$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
|
|
|
|
|
612
|
} |
|
145
|
|
|
|
|
|
|
); |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
)->retain(); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
return; |
|
150
|
4
|
|
|
|
|
503
|
} ## end sub index_files_with_progress |
|
151
|
|
|
|
|
|
|
|
|
152
|
5
|
|
|
|
|
161
|
1; |