Skip to content

Commit

Permalink
Remove extraneous comment from method examples
Browse files Browse the repository at this point in the history
  • Loading branch information
castwide committed Feb 1, 2025
1 parent 4f0a674 commit 7d22276
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/solargraph/pin/method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion lib/solargraph/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Solargraph
VERSION = '0.51.1'
VERSION = '0.51.2'
end
12 changes: 12 additions & 0 deletions spec/pin/method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d22276

Please sign in to comment.