-
Notifications
You must be signed in to change notification settings - Fork 63
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
Moving code onto one line with comment breaks code #23
Comments
This is an interesting problem. I'm going to need to create some sort of buffer for any comments within expressions, and then push them towards the end of the line where its "safe" to place them. Is this a common occurrence in your codebase? I'm currently busy with some other work at the moment but I can take a look at this soon - from first glance, it does look like I'll need to think some more about how to solve this. |
I only found a couple instances of this, so I'm in no big trouble at the moment 👍 |
Depending on your solution, this probably won't be a separate issue, but I'll mention it just in case Before running StyLua: print"text" --a comment After running StyLua: print("text" --a comment) |
Thanks, I think that's a separate case handled differently inside the codebase (with the same problem) so I'll also need to check that out. Sorry, I've been bombarded with work recently so I'll see when I can make time to fix this bug |
a0f6bdd is a partial fix for this, mainly the situations where there are comments present inside of function arguments, and comments trailing commas in punctuated sequences. Function calls will now remain expanded if there is a comment present inside of them, to keep the comments as close as possible to original code. Currently, in other cases where comments are in weird locations, I'm buffering them to the end of the line. This does mean that they may move from where people originally wanted them to be, and if that is a problem, please do let me know! I still need to figure out a way to handle comments within expression properly (the example you gave above with the summation of the numbers). I think I need to do something similar as with function call arguments, where I just leave them wrapped onto multiple lines - but currently StyLua doesn't support multiline expressions anyways. This will probably have to wait until a change to support #25 is added |
Before running StyLua:
After running StyLua:
The text was updated successfully, but these errors were encountered: