Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Re-Indenting is (completely) broken in lua #66873

Closed
Qonsyuma opened this issue Jan 21, 2019 · 14 comments
Closed

[Bug] Re-Indenting is (completely) broken in lua #66873

Qonsyuma opened this issue Jan 21, 2019 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues verified Verification succeeded
Milestone

Comments

@Qonsyuma
Copy link

Issue Type: Bug

When re-indenting while using Lua everything is put on indent level 0, all existing indents in a file are removed and put on the same level.

In other languages it seems to only work when it's based on brackets/parentheses, but even in XML for example nothing seems to get indented.

Very important is, is that I'm not talking about the formatting code feature, but just the "Reindent Lines" feature, which I have been using a lot.

VS Code version: Code - Insiders 1.31.0-insider (e9bb33f, 2019-01-21T06:19:35.291Z)
OS version: Windows_NT x64 10.0.17763

@vscodebot
Copy link

vscodebot bot commented Jan 21, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the editor-autoindent Editor auto indentation issues label Jan 21, 2019
@Qonsyuma
Copy link
Author

Not a duplicate

@Qonsyuma
Copy link
Author

Qonsyuma commented Feb 6, 2019

Now this bug is present in the normal version of VS Code instead of just insiders, which (honestly said) sucks. Now working on my projects became much harder than it was before.

@TheV360
Copy link
Contributor

TheV360 commented Feb 7, 2019

This is also messed up on my installation. I am using no settings that change auto-indent. All ->s are tabs.

if statement auto-indentation is wrong.

I have a simple if statement.

-> -> -> if thing then|

...then I press enter.

Expected:

-> -> -> if thing then
-> -> -> -> |

Got:

-> -> -> if thing then
-> -> -> |

end statement auto-indentation is really bad.

After that, I want to close off this if statement.
I type en.

-> -> -> if thing then
-> -> -> -> -- a bunch of stuff
-> -> -> -> en|

Good... Means nothing, but so far, so good.
I type the final character, d, and...

Expected:

-> -> -> if thing then
-> -> -> -> -- a bunch of stuff
-> -> -> end|

Got:

-> -> -> if thing then
-> -> -> -> -- a bunch of stuff
end|

@TheV360
Copy link
Contributor

TheV360 commented Feb 8, 2019

I found the source of the bug. In my copy of VS Code, I undid the change done to fix #63407. Then, everything worked perfectly.
Unfortunately, this does reintroduce the bug it supposedly fixed. I don't know RegEx very well, so I can't solve this issue.

@sumneko
Copy link
Contributor

sumneko commented Feb 13, 2019

This bug makes my programming difficult and I hope to fix it as soon as possible.

@alexdima alexdima removed their assignment Feb 13, 2019
@TheV360
Copy link
Contributor

TheV360 commented Feb 13, 2019

If anyone wants a quick hack to fix it, all you have to do is

  1. Open Notepad as admin.
  2. In the Notepad open dialog:
    1. Go to your VS Code installation folder
    2. Go through the resources/app/extensions folders.
    3. Find the lua folder
    4. Open language-configuration.json
  3. Find the increaseIndentPattern line. (Do not edit the decreaseIndentPattern line.)
  4. Erase the ^\\s* at the beginning of the string.
  5. Save and exit Notepad.
  6. If VS Code was open, reload the window.

Now indentation should be better!

@alexdima alexdima assigned alexdima and unassigned rebornix Feb 14, 2019
@alexdima alexdima added this to the February 2019 milestone Feb 14, 2019
@WorldofBay
Copy link
Contributor

i submitted a PR, hope we get our indentation back asap. if you want a quick hack that also solves the comment intendation bug that started this, use @TheV360's instructions with the regex from #68978

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Feb 19, 2019
@alexdima alexdima changed the title [Bug] Re-Indenting is (completely) broken [Bug] Re-Indenting is (completely) broken in lua Feb 19, 2019
@alexdima
Copy link
Member

Thank you @WorldofBay , fixed via #68978

@mjbvz mjbvz added the verified Verification succeeded label Feb 25, 2019
@lxsmnsyc
Copy link

lxsmnsyc commented Mar 4, 2019

Good to see a recent fix to this, however, it is still broken on my side.

I tried to apply the fix on my language-configuration.json, tried both with and without the ^\\s* pattern at the start, but it still doesn't indent correctly.

here's a test code I did, else decrements indent improperly, as well as end in functions in tables:

function test()
    function test()
        if(test) then 
    else
    end

    end
end

local test = {
    test = function ()
end
}

edit:
after a few editing, found that the Lua extension I use (Lua Plus) has a separate language-configuration, and so I tried editing it and the indent works now.

@TimGoll
Copy link

TimGoll commented Mar 6, 2019

Okay, this is marked as closed but I still have the problem. Are there any news regarding this topic?

@lxsmnsyc
Copy link

lxsmnsyc commented Mar 7, 2019

Okay, this is marked as closed but I still have the problem. Are there any news regarding this topic?

It works properly on my side. Do you have any Lua extensions like Lua Plus which highlights syntax?

@WorldofBay
Copy link
Contributor

are you using insider? if not, the fix is not published yet. expected release date is today, however the checklist on #69177 is not fully done yet, so it might also be slightly later.

@TimGoll
Copy link

TimGoll commented Mar 7, 2019

Ahh, I'm not using the insider build. Thanks! :)

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants