line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PLS::Server::Request::Workspace::Configuration; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
136
|
use strict; |
|
9
|
|
|
|
|
69
|
|
|
9
|
|
|
|
|
3364
|
|
4
|
9
|
|
|
9
|
|
94
|
use warnings; |
|
9
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
433
|
|
5
|
|
|
|
|
|
|
|
6
|
9
|
|
|
9
|
|
54
|
use parent 'PLS::Server::Request'; |
|
9
|
|
|
|
|
80
|
|
|
9
|
|
|
|
|
373
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
1461
|
use List::Util; |
|
9
|
|
|
|
|
69
|
|
|
9
|
|
|
|
|
2148
|
|
9
|
9
|
|
|
9
|
|
120
|
use Scalar::Util; |
|
9
|
|
|
|
|
65
|
|
|
9
|
|
|
|
|
735
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
62
|
use PLS::Parser::Document; |
|
9
|
|
|
|
|
74
|
|
|
9
|
|
|
|
|
460
|
|
12
|
9
|
|
|
9
|
|
64
|
use PLS::Parser::Index; |
|
9
|
|
|
|
|
74
|
|
|
9
|
|
|
|
|
417
|
|
13
|
9
|
|
|
9
|
|
46
|
use PLS::Parser::PackageSymbols; |
|
9
|
|
|
|
|
65
|
|
|
9
|
|
|
|
|
415
|
|
14
|
9
|
|
|
9
|
|
149
|
use PLS::Parser::Pod; |
|
9
|
|
|
|
|
75
|
|
|
9
|
|
|
|
|
491
|
|
15
|
9
|
|
|
9
|
|
3782
|
use PLS::Server::Cache; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
358
|
|
16
|
9
|
|
|
9
|
|
55
|
use PLS::Server::Request::TextDocument::PublishDiagnostics; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
715
|
|
17
|
9
|
|
|
9
|
|
70
|
use PLS::Server::State; |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
6212
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
PLS::Server::Request::Workspace::Configuration |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This is a message from the server to the client requesting that it send |
26
|
|
|
|
|
|
|
the values of some configuration items. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
PLS requests all configuration starting with C<pls.>. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This class also handles the response from the client which stores the configuration |
31
|
|
|
|
|
|
|
in memory. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new |
36
|
|
|
|
|
|
|
{ |
37
|
5
|
|
|
5
|
0
|
24
|
my ($class) = @_; |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
263
|
return bless { |
40
|
|
|
|
|
|
|
id => undef, # assigned by the server |
41
|
|
|
|
|
|
|
method => 'workspace/configuration', |
42
|
|
|
|
|
|
|
params => { |
43
|
|
|
|
|
|
|
items => [{section => 'perl'}, {section => 'pls'}] |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
}, $class; |
46
|
|
|
|
|
|
|
} ## end sub new |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub handle_response |
49
|
|
|
|
|
|
|
{ |
50
|
4
|
|
|
4
|
0
|
29
|
my ($self, $response, $server) = @_; |
51
|
|
|
|
|
|
|
|
52
|
4
|
50
|
33
|
|
|
111
|
return if (Scalar::Util::reftype($response) ne 'HASH' or ref $response->{result} ne 'ARRAY'); |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
23
|
my $config = {}; |
55
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
10
|
foreach my $result (@{$response->{result}}) |
|
4
|
|
|
|
|
69
|
|
57
|
|
|
|
|
|
|
{ |
58
|
4
|
50
|
|
|
|
24
|
next if (ref $result ne 'HASH'); |
59
|
4
|
50
|
33
|
|
|
105
|
next if (exists $result->{pls} and not length $result->{pls}); |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
31
|
foreach my $key (keys %{$result}) |
|
4
|
|
|
|
|
39
|
|
62
|
|
|
|
|
|
|
{ |
63
|
28
|
50
|
|
|
|
121
|
$config->{$key} = $result->{$key} unless (length $config->{$key}); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} ## end foreach my $result (@{$response...}) |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
26
|
convert_config($config); |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
61
|
my $index = PLS::Parser::Index->new(); |
70
|
4
|
|
|
|
|
32
|
my @inc; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# Replace $ROOT_PATH with actual workspace paths in inc |
73
|
4
|
50
|
33
|
|
|
2219
|
if (exists $config->{inc} and ref $config->{inc} eq 'ARRAY') |
74
|
|
|
|
|
|
|
{ |
75
|
4
|
|
|
|
|
39
|
foreach my $inc (@{$config->{inc}}) |
|
4
|
|
|
|
|
27
|
|
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
|
|
0
|
foreach my $folder (@{$index->workspace_folders}) |
|
0
|
|
|
|
|
0
|
|
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
|
|
0
|
my $interpolated = $inc =~ s/\$ROOT_PATH/$folder/gr; |
80
|
0
|
|
|
|
|
0
|
push @inc, $interpolated; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} ## end foreach my $inc (@{$config->...}) |
83
|
|
|
|
|
|
|
|
84
|
4
|
|
|
|
|
65
|
$config->{inc} = [List::Util::uniq sort @inc]; |
85
|
|
|
|
|
|
|
} ## end if (exists $config->{inc...}) |
86
|
|
|
|
|
|
|
|
87
|
4
|
50
|
33
|
|
|
84
|
if (exists $config->{syntax}{perl} and length $config->{syntax}{perl}) |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
|
|
0
|
PLS::Parser::Pod->set_perl_exe($config->{syntax}{perl}); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
4
|
0
|
33
|
|
|
108
|
if (exists $config->{syntax}{args} and ref $config->{syntax}{args} eq 'ARRAY' and scalar @{$config->{syntax}{args}}) |
|
0
|
|
50
|
|
|
0
|
|
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
|
|
0
|
PLS::Parser::Pod->set_perl_args($config->{syntax}{args}); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
4
|
|
|
|
|
162
|
$PLS::Server::State::CONFIG = $config; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# @INC may have changed - republish diagnostics |
100
|
4
|
|
|
|
|
19
|
foreach my $uri (@{PLS::Parser::Document->open_files()}) |
|
4
|
|
|
|
|
36
|
|
101
|
|
|
|
|
|
|
{ |
102
|
0
|
|
|
|
|
0
|
$server->send_server_request(PLS::Server::Request::TextDocument::PublishDiagnostics->new(uri => $uri)); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
4
|
|
|
|
|
121
|
PLS::Parser::PackageSymbols::start_package_symbols_process($config); |
106
|
4
|
|
|
|
|
120
|
PLS::Parser::PackageSymbols::start_imported_package_symbols_process($config); |
107
|
|
|
|
|
|
|
|
108
|
4
|
|
|
|
|
181
|
PLS::Server::Cache::warm_up(); |
109
|
|
|
|
|
|
|
|
110
|
4
|
|
|
|
|
54
|
return; |
111
|
|
|
|
|
|
|
} ## end sub handle_response |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub convert_config |
114
|
|
|
|
|
|
|
{ |
115
|
4
|
|
|
4
|
0
|
27
|
my ($config) = @_; |
116
|
|
|
|
|
|
|
|
117
|
4
|
50
|
|
|
|
44
|
if (length $config->{pls}) |
118
|
|
|
|
|
|
|
{ |
119
|
4
|
50
|
|
|
|
51
|
$config->{cmd} = $config->{pls} unless (length $config->{cmd}); |
120
|
4
|
|
|
|
|
21
|
delete $config->{pls}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
4
|
50
|
|
|
|
46
|
if (ref $config->{plsargs} eq 'ARRAY') |
124
|
|
|
|
|
|
|
{ |
125
|
0
|
0
|
|
|
|
0
|
$config->{args} = $config->{plsargs} if (ref $config->{args} ne 'ARRAY'); |
126
|
0
|
|
|
|
|
0
|
delete $config->{plsargs}; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
4
|
50
|
|
|
|
52
|
$config->{perltidy} = {} if (ref $config->{perltidy} ne 'HASH'); |
130
|
|
|
|
|
|
|
|
131
|
4
|
50
|
|
|
|
58
|
if (length $config->{perltidyrc}) |
132
|
|
|
|
|
|
|
{ |
133
|
4
|
50
|
|
|
|
41
|
$config->{perltidy}{perltidyrc} = $config->{perltidyrc} unless (length $config->{perltidy}{perltidyrc}); |
134
|
4
|
|
|
|
|
10
|
delete $config->{perltidyrc}; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
4
|
|
|
|
|
14
|
return; |
138
|
|
|
|
|
|
|
} ## end sub convert_config |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |