LuaFormatter icon indicating copy to clipboard operation
LuaFormatter copied to clipboard

Feature request: pad_block

Open Josef-Friedrich opened this issue 1 year ago • 0 comments

Some style guidelines require that block statements must begin and end with blank lines. I would apprecitae if this lovely formatter could support this with the help of an option e. g. pad_block.

https://eslint.org/docs/latest/rules/padded-blocks

Function blocks

-- pad_block: true
function outer() 

  local function inner1() 
  
  end

  local function inner2() 
  
  end

end

-- pad_block: false
function outer() 
  local function inner1() 
  
  end

  local function inner2() 
  
  end
end

Control structure blocks

-- pad_block: true
if x == 1 then 

  print(x)

else

  print(1)
  
end

-- pad_block: false
if x == 1 then 
  print(x)
else
  print(1)
end

Busted

-- pad_block: true
require('busted.runner')()

describe('Test module', function()

  describe('Test function', function()

    it('My test', function()

      assert.are.equal(1, 1,)

    end)

  end)

end)

-- pad_block: false
require('busted.runner')()
describe('Test module', function()
  describe('Test function', function()
    it('My test', function()
      assert.are.equal(1, 1,)
    end)
  end)
end)

Josef-Friedrich avatar Jan 05 '23 08:01 Josef-Friedrich