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

Alignment of ternary operator with multiple lines #149

Open
ronisbr opened this issue Nov 29, 2020 · 4 comments
Open

Alignment of ternary operator with multiple lines #149

ronisbr opened this issue Nov 29, 2020 · 4 comments

Comments

@ronisbr
Copy link
Contributor

ronisbr commented Nov 29, 2020

Hi!

Is it possible to change the default alignment with ternary operator from:

anchor_left = show_icon ? Anchor(icon, :right, 1) :
    Anchor(c,    :left,  0)

to

anchor_left = show_icon ? Anchor(icon, :right, 1) :
                          Anchor(c,    :left,  0)
@non-Jedi
Copy link
Contributor

non-Jedi commented Dec 1, 2020

Sure. You'd have to add an additional pass to julia-indent-line for this. Currently hanging ternary operator is handled by the julia-indent-hanging pass, but julia-paren-indent might provide a reasonable example for creating julia-indent-hanging-ternary. Could probably re-use julia-ternary-regex for this.

@ronisbr
Copy link
Contributor Author

ronisbr commented Dec 1, 2020

Nice! I will try to see if I can do this now that you think this is a good thing to have.

@non-Jedi
Copy link
Contributor

non-Jedi commented Dec 1, 2020

That's just my opinion that this sort of indentation is universally preferable, but maybe others would prefer it how it is currently. Might want to get a couple others to weigh in before investing significant time in this. 🤷 I guess worst case you could make it customizable to revert to current behavior.

@ronisbr
Copy link
Contributor Author

ronisbr commented Dec 1, 2020

Ok! Let's wait then :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants