tbastos / vim-lua

Improved Lua 5.3 syntax and indentation support for Vim
120 stars 17 forks source link

Issue when indenting anonymous functions #8

Closed kikito closed 7 years ago

kikito commented 7 years ago

Hi there,

I have trouble with the indenting proposed by this plugin. The code I am trying to write is the following:

describe("something", function()
  it("does something", function()
  end)
end)

I have a parenthesis-insertion plugin, so when write it( I get it(|) (with the cursor between the parenthesis). It seems that this confuses the indentation plugin.

From this position:

describe("something", function()
  it("does something", function() |)
end)

When I press enter it gets missaligned - it seems it is trying to align the parents instead of the it:

describe("something", function()
  it("does something", function()
    |)
end)

Also, the weirdest part is if I try to write end on that position. Then the line gets completely missaligned (I don't even press enter).

describe("something", function()
  it("does something", function()

end|)
end)

How can I solve this behavior?

tbastos commented 7 years ago

It happens when the anonymous function is empty... for whatever reason I'd never noticed this bug before. I pushed a fix to master, could you please test it? Thanks for reporting!