Skip to content

[Writer] Preserve an empty line between declarations and members#146

Merged
soutaro merged 2 commits intoruby:masterfrom
pocke:empty-line-writer
Dec 30, 2019
Merged

[Writer] Preserve an empty line between declarations and members#146
soutaro merged 2 commits intoruby:masterfrom
pocke:empty-line-writer

Conversation

@pocke
Copy link
Member

@pocke pocke commented Dec 29, 2019

By this change, the writer will preserve an empty line between declarations and members.

I also added a smoke test for Ruby::Signature::Writer.
It only checks the writer generates the same meaning signature.

Format examples

no changes

class A
  def foo: () -> void
  def bar: () -> void
end
class B
end

also no changes

class A
  def foo: () -> void

  def bar: () -> void
end

class B
end

But it removes too many empty lines. the following code will be formatted to the same as the previous example.

class A
  def foo: () -> void


  def bar: () -> void
end


class B
end

@pocke pocke force-pushed the empty-line-writer branch from e37e399 to d29d023 Compare December 29, 2019 13:45
@pocke pocke changed the title [Writer] Preserve an empty line between declarations and members [WIP] [Writer] Preserve an empty line between declarations and members Dec 29, 2019
@pocke pocke force-pushed the empty-line-writer branch from d29d023 to 1e694ca Compare December 29, 2019 13:57
@pocke pocke changed the title [WIP] [Writer] Preserve an empty line between declarations and members [Writer] Preserve an empty line between declarations and members Dec 29, 2019

end

def test_smoke
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@soutaro soutaro merged commit a9f1d0d into ruby:master Dec 30, 2019
@soutaro
Copy link
Member

soutaro commented Dec 30, 2019

@pocke Thanks!

@pocke pocke deleted the empty-line-writer branch December 30, 2019 10:20
tk0miya added a commit to tk0miya/rbs that referenced this pull request Sep 16, 2024
ruby#146 adds preservation empty lines
between declarations feature to the classes.

This also introduces the same feature to the modules.  Now our writer
inserts a line to between all declarations.  It's a bit difficult to
read.  Therefore, this increase the readability of the generated RBS
files.
tk0miya added a commit to tk0miya/rbs that referenced this pull request Sep 16, 2024
ruby#146 added preservation empty lines
between declarations feature to the classes.

This also introduces the same feature to the modules.  Now our writer
inserts a line to between all declarations.  It's a bit difficult to
read.  Therefore, this increase the readability of the generated RBS
files.
tk0miya added a commit to tk0miya/rbs that referenced this pull request Sep 16, 2024
ruby#146 added preservation empty lines
between declarations feature to the classes.

This also introduces the same feature to the modules.  Before this
change, our writer inserts a line to between all declarations.  It's
a bit difficult to read.  Therefore, this increases the readability
of the generated RBS files.
tk0miya added a commit to tk0miya/rbs that referenced this pull request Sep 16, 2024
ruby#146 added preservation empty lines
between declarations feature to the classes.

This also introduces the same feature to the modules.  Before this
change, our writer inserts a line to between all declarations.  It's
a bit difficult to read.  Therefore, this increases the readability
of the generated RBS files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants