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
feat: Add more granular control over call parentheses #330
feat: Add more granular control over call parentheses #330
Conversation
For the sake of symmetry, it'd be nice to allow for the converse option ( And personally I'd flip it to have |
@JohnnyMorganz let me know what ypu think about clasons suggestions |
Ok, I think adding an option for strings is sensible as well for the sake of consistency, it isn't really adding anything major either Technically these are opt-outs from the default (Always), so I think |
Adds new option call_parentheses with possible values Always, NoString, NoTable, None (Default: Always) When call_parentheses is set to Always stylua applies call parentheses all the time. ```lua xyz({ a = 1, b = 2 }) abc('Hello') When set to NoString it omits parentheses on function call with single table argument. ```lua xyz({a = 1, b = 2 }) abc 'Hello' ``` ``` Similarly when set to NoTable it omits parentheses on function call with single table argument. ```lua xyz { a = 1, b = 2 } abc('Hello') ``` And when it's None stylua omits parentheses on function call with single table or string argument. This is same as `no_call_parentheses = true` ```lua xyz { a = 1, b = 2 } abc 'Hello' ```
I've added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me, the only thing I'm not sure of is whether to go with NoString
/NoTable
or TableOnly
/StringOnly
Let me add one more to that confusion . How about |
I agree, that sounds better. Lets go with |
Thank you! |
@JohnnyMorganz what do you think about a new release? With this change, we could consider enforcing StyLua on Neovim's codebase :) |
I'm just waiting on a new full-moon release upstream, hopefully by the end of the week. Once that's out, I'll cut a new stylua release |
Adds new option call_parentheses with possible values Always, NoTable,
None (Default: Always)
When call_parentheses is set to Always stylua applies call parentheses
all the time.
When set to NoTable it omits parentheses on function call with
single table argument.
And when it's None stylua omits parentheses on function call with
single table or string argument. This is same as
no_call_parentheses = true
closes #329