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

local var; var = ... looks better in the same line (suggestion) #570

Open
Aspecky opened this issue Sep 6, 2022 · 3 comments
Open

local var; var = ... looks better in the same line (suggestion) #570

Aspecky opened this issue Sep 6, 2022 · 3 comments
Labels
enhancement New feature or request requires option This feature request would require option configuration rfc/in discussion This issue is currently in discussion, comments are welcome!

Comments

@Aspecky
Copy link

Aspecky commented Sep 6, 2022

Sometimes we use a local variable inside an anonymous function like so:

local connection
connection = ...(function()
    connection:Disconnect()
end)

And doing this makes it look better imo:

local connection; connection = ...(function()
    connection:Disconnect()
end)

Is there a chance we could have this as a configuration flag?

@JohnnyMorganz
Copy link
Owner

This is an interesting suggestion.

For simplicity and consistency, I am somewhat hesitant about adding something like this in, but I will give it a think

@JohnnyMorganz JohnnyMorganz added enhancement New feature or request rfc/in discussion This issue is currently in discussion, comments are welcome! labels Oct 10, 2022
@haolian9
Copy link

A similar case is

local foo do
    local bar = "bar"
    foo = bar
end

which I wished stylua puts the do in the same line of local foo.

@Aspecky
Copy link
Author

Aspecky commented Apr 19, 2023

This is an interesting suggestion.

For simplicity and consistency, I am somewhat hesitant about adding something like this in, but I will give it a think

Hi, i'd like to bump this because ever since the suggestion I've been wishing this was an addition. Could this be added as a configuration option so it's not intrusive for those who don't want it?

@JohnnyMorganz JohnnyMorganz added the requires option This feature request would require option configuration label Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request requires option This feature request would require option configuration rfc/in discussion This issue is currently in discussion, comments are welcome!
Projects
None yet
Development

No branches or pull requests

3 participants