File Coverage

blib/lib/PLS/Server/Request/TextDocument/DidOpen.pm
Criterion Covered Total %
statement 28 28 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 35 36 97.2


line stmt bran cond sub pod time code
1             package PLS::Server::Request::TextDocument::DidOpen;
2              
3 11     11   259 use strict;
  11         176  
  11         984  
4 11     11   98 use warnings;
  11         274  
  11         1122  
5              
6 11     11   1040 use parent 'PLS::Server::Request';
  11         585  
  11         274  
7              
8 11     11   1032 use PLS::Parser::Document;
  11         223  
  11         1092  
9 11     11   219 use PLS::Parser::PackageSymbols;
  11         584  
  11         1262  
10 11     11   253 use PLS::Server::Request::TextDocument::PublishDiagnostics;
  11         146  
  11         3867  
11              
12             =head1 NAME
13              
14             PLS::Server::Request::TextDocument::DidOpen
15              
16             =head1 DESCRIPTION
17              
18             This is a notification from the client to the server that
19             a text document was opened.
20              
21             =cut
22              
23             sub service
24             {
25 2     2 0 29 my ($self, $server) = @_;
26              
27 2         49 my $text_document = $self->{params}{textDocument};
28 2         6 PLS::Parser::Document->open_file(%{$text_document});
  2         126  
29              
30 2         152 $server->send_server_request(PLS::Server::Request::TextDocument::PublishDiagnostics->new(uri => $text_document->{uri}));
31              
32             # Warm up the cache for imported package symbols
33 2         172 my $text = PLS::Parser::Document->text_from_uri($text_document->{uri});
34 2         83 my $imports = PLS::Parser::Document->get_imports($text);
35 2         10 PLS::Parser::PackageSymbols::get_imported_package_symbols($PLS::Server::State::CONFIG, @{$imports})->retain();
  2         78  
36              
37 2         2449 return;
38             } ## end sub service
39              
40             1;