Skip to content

Commit

Permalink
(GH-140) Show a message in Node Graph preview for zero resources
Browse files Browse the repository at this point in the history
Previously if a node graph preview has no resources it just shows a blank
window which is very confusing.  This commit now shows a message in the window
saying;
`There were no resources created in the node graph. Is there an include statement
missing?`
  • Loading branch information
glennsarti committed Sep 20, 2017
1 parent d5c6a8e commit 2649952
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/puppet-languageserver/message_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def receive_request(request)
'fontsize' => '""',
'name' => 'vscode'
}
dot_content = PuppetLanguageServer::PuppetParserHelper.compile_to_pretty_relationship_graph(content).to_dot(options)
node_graph = PuppetLanguageServer::PuppetParserHelper.compile_to_pretty_relationship_graph(content)
if node_graph.vertices.count.zero?
error_content = "There were no resources created in the node graph. Is there an include statement missing?"
else
dot_content = node_graph.to_dot(options)
end
rescue => exception
error_content = "Error while parsing the file. #{exception}"
end
Expand Down

0 comments on commit 2649952

Please sign in to comment.