From 8501f5ed4b08f483c6ab9b43875d63b69414adc9 Mon Sep 17 00:00:00 2001 From: Andy Waite Date: Tue, 24 Sep 2024 16:44:03 -0400 Subject: [PATCH] Avoid 'puts' in addons example (#2616) Using `puts` can break the LSP client/server connection. --- jekyll/add-ons.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jekyll/add-ons.markdown b/jekyll/add-ons.markdown index 73d1959be..2d86a216b 100644 --- a/jekyll/add-ons.markdown +++ b/jekyll/add-ons.markdown @@ -106,7 +106,7 @@ class MyListener # Define the handler method for the `on_class_node_enter` event def on_class_node_enter(node) - puts "Hello, #{node.constant_path.slice}!" + $stderr.puts "Hello, #{node.constant_path.slice}!" end end @@ -118,7 +118,6 @@ dispatcher.dispatch(parse_result.value) # Prints # => Hello, Foo! - ``` In this example, the listener is registered to the dispatcher to listen for the `:on_class_node_enter` event. When a class node is encountered during the parsing of the code, a greeting message is outputted with the class name.