Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix comment indentation in ASTNode#to_s #11851

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

FnControlOption
Copy link
Contributor

require "compiler/crystal/syntax"

code = <<-CRYSTAL
class Foo
  # doc
  def bar
  end
end
CRYSTAL

parser = Crystal::Parser.new(code)
parser.wants_doc = true

ast = parser.parse

puts String.build { |io| ast.to_s(io, emit_doc: true) }

Old output:

class Foo
    # doc
def bar
  end
end

New output:

class Foo
  # doc
  def bar
  end
end

@FnControlOption FnControlOption changed the title Fix indentation of ASTNode#to_s(emit_doc: true) Fix indentation of docs generated by ASTNode#to_s Feb 23, 2022
Copy link
Member

@beta-ziliani beta-ziliani left a comment

Choose a reason for hiding this comment

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

🚀

@beta-ziliani beta-ziliani added this to the 1.4.0 milestone Feb 25, 2022
@straight-shoota straight-shoota changed the title Fix indentation of docs generated by ASTNode#to_s Fix comment indentation in ASTNode#to_s Feb 28, 2022
@straight-shoota straight-shoota merged commit aed262b into crystal-lang:master Feb 28, 2022
@FnControlOption FnControlOption deleted the emit_doc branch May 19, 2023 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants