From 7d222769d20d05ad565cdc3e99f74be8a35adae9 Mon Sep 17 00:00:00 2001 From: Fred Snyder Date: Sat, 1 Feb 2025 08:14:09 -0500 Subject: [PATCH] Remove extraneous comment from method examples --- CHANGELOG.md | 5 +++++ lib/solargraph/pin/method.rb | 2 +- lib/solargraph/version.rb | 2 +- spec/pin/method_spec.rb | 12 ++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce22e2a..c78203e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.51.2 - February 1, 2025 +- Fix exception from parser when anonymous block forwarding is used (#740) +- Parameterized Object types +- Remove extraneous comment from method examples + ## 0.51.1 - January 23, 2025 - Format example code - Block infers yieldself from chain diff --git a/lib/solargraph/pin/method.rb b/lib/solargraph/pin/method.rb index 76a06506..0050b2a5 100644 --- a/lib/solargraph/pin/method.rb +++ b/lib/solargraph/pin/method.rb @@ -337,7 +337,7 @@ def concat_example_tags return if example_tags.empty? @documentation += "\n\nExamples:\n\n```ruby\n" @documentation += example_tags.map do |tag| - (tag.name ? "# #{tag.name}\n" : '') + + (tag.name && !tag.name.empty? ? "# #{tag.name}\n" : '') + "#{tag.text}\n" end .join("\n") diff --git a/lib/solargraph/version.rb b/lib/solargraph/version.rb index 4d540a40..fc26cfdf 100755 --- a/lib/solargraph/version.rb +++ b/lib/solargraph/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Solargraph - VERSION = '0.51.1' + VERSION = '0.51.2' end diff --git a/spec/pin/method_spec.rb b/spec/pin/method_spec.rb index 3851ff1d..346f0275 100644 --- a/spec/pin/method_spec.rb +++ b/spec/pin/method_spec.rb @@ -284,6 +284,18 @@ def bar?; end ) ) expect(pin.documentation).to include('foo') + expect(pin.documentation).not_to include('#') + end + + it 'includes @example names' do + pin = Solargraph::Pin::Method.new( + name: 'foo', + comments: %( +@example Call foo + foo + ) + ) + expect(pin.documentation).to include('# Call foo') end context 'as attribute' do