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 9     9   62 use strict;
  9         17  
  9         331  
4 9     9   45 use warnings;
  9         138  
  9         277  
5              
6 9     9   166 use parent 'PLS::Server::Request';
  9         144  
  9         116  
7              
8 9     9   543 use PLS::Parser::Document;
  9         39  
  9         415  
9 9     9   46 use PLS::Parser::PackageSymbols;
  9         105  
  9         326  
10 9     9   115 use PLS::Server::Request::TextDocument::PublishDiagnostics;
  9         26  
  9         2041  
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 10 my ($self, $server) = @_;
26              
27 2         14 my $text_document = $self->{params}{textDocument};
28 2         5 PLS::Parser::Document->open_file(%{$text_document});
  2         53  
29              
30 2         68 $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         72 my $text = PLS::Parser::Document->text_from_uri($text_document->{uri});
34 2         42 my $imports = PLS::Parser::Document->get_imports($text);
35 2         7 PLS::Parser::PackageSymbols::get_imported_package_symbols($PLS::Server::State::CONFIG, @{$imports})->retain();
  2         42  
36              
37 2         1536 return;
38             } ## end sub service
39              
40             1;