Skip to content

Conversation

idbrii
Copy link
Contributor

@idbrii idbrii commented Jan 15, 2022

Fix anonymous function argument causes following line to be incorrectly
indented.

Previously, it would give indentation like this:

data = self.kitchen
	:digestCheese(function()
		return 1
	end)
	self:Func() -- wrong indentation

data = self.kitchen
	:eatCheese({fn = function()
		return 10
	end})
		:digestCheese() -- wrong indentation

Now, it's like this:

data = self.kitchen
	:digestCheese(function()
		return 1
	end)
self:Func()

data = self.kitchen
	:eatCheese({fn = function()
		return 10
	end})
	:digestCheese()

Add vader.vim tests:

  • indented chained functions:
    • worked before and still works
  • indented chained anonymous function arguments:
    • broken before and now works
  • indented non first argument anonymous function:
    • broken before and now works

Fix anonymous function argument causes following line to be incorrectly
indented.

Add tests:

indented chained functions:
    worked before and still works
indented chained anonymous function arguments:
    broken before and now works
@idbrii idbrii marked this pull request as draft March 9, 2022 16:29
@idbrii
Copy link
Contributor Author

idbrii commented Mar 9, 2022

Convert to draft: This causes incorrect indentation after an anonymous function in some cases.

if level then
   local room = self:find(function(r)
      return r.name == level
   end)
if room then -- here
   print(room)
end
end

local p = self.input:getActiveControls(function(value)
   local name_remap = {
   }
   return name_remap[value] or value
end)
   print(p) -- here

@idbrii idbrii marked this pull request as ready for review March 9, 2022 17:45
@idbrii idbrii force-pushed the fix-anon-indent branch from 0a0d152 to 3374c48 Compare March 9, 2022 19:53
@idbrii idbrii marked this pull request as draft March 9, 2022 22:34
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.

1 participant