Skip to content

Outdent line after an anon func argument - #21

Draft
idbrii wants to merge 2 commits into
tbastos:masterfrom
idbrii:fix-anon-indent
Draft

Outdent line after an anon func argument#21
idbrii wants to merge 2 commits into
tbastos:masterfrom
idbrii:fix-anon-indent

Conversation

@idbrii

@idbriiidbrii commented Jan 15, 2022

Copy link
Copy Markdown
Contributor

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

Previously, it would give indentation like this:

data=self.kitchen
:digestCheese(function()
return1end)
self:Func() -- wrong indentationdata=self.kitchen
:eatCheese({fn=function()
return10end})
:digestCheese() -- wrong indentation

Now, it's like this:

data=self.kitchen
:digestCheese(function()
return1end)
self:Func()
data=self.kitchen
:eatCheese({fn=function()
return10end})
: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

idbrii commented Mar 9, 2022

Copy link
Copy Markdown
ContributorAuthor

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 marked this pull request as draft March 9, 2022 22:34
Sign up for freeto 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

@idbrii