crystal icon indicating copy to clipboard operation
crystal copied to clipboard

Unwanted line break added by the formatter

Open hutou opened this issue 1 year ago • 0 comments

I encounter a strange behavior from the formatter: When a comment is added to the end of an instruction line, a line feed is systematically added before the def instruction that immediately follows. As far as I've been able to check, this only applies to the def statement.

Here's an example

  1. before formatting
class Test
  getter var # it is a getter

  # :nodoc:
  # method bam is ...
  def bam(@var : String)
  end
end
  1. after formatting
class Test
  getter var # it is a getter

  # :nodoc:
  # method bam is ...

  def bam(@var : String)
  end
end  

Of course, this has one annoying consequence: it becomes impossible to document the method or apply a :nodoc:

hutou avatar Feb 05 '24 17:02 hutou