Skip to content

Commit 2649952

Browse files
committed
(GH-140) Show a message in Node Graph preview for zero resources
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?`
1 parent d5c6a8e commit 2649952

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/puppet-languageserver/message_router.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ def receive_request(request)
8383
'fontsize' => '""',
8484
'name' => 'vscode'
8585
}
86-
dot_content = PuppetLanguageServer::PuppetParserHelper.compile_to_pretty_relationship_graph(content).to_dot(options)
86+
node_graph = PuppetLanguageServer::PuppetParserHelper.compile_to_pretty_relationship_graph(content)
87+
if node_graph.vertices.count.zero?
88+
error_content = "There were no resources created in the node graph. Is there an include statement missing?"
89+
else
90+
dot_content = node_graph.to_dot(options)
91+
end
8792
rescue => exception
8893
error_content = "Error while parsing the file. #{exception}"
8994
end

0 commit comments

Comments
 (0)