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

Explore ways to make string interpolation nicer #39

Closed
blaggacao opened this issue Feb 6, 2022 · 3 comments
Closed

Explore ways to make string interpolation nicer #39

blaggacao opened this issue Feb 6, 2022 · 3 comments
Labels
component | style Modifications to the formatting rules status | it is a good thing We agree it is good to implement this type | feature request New feature or request

Comments

@blaggacao
Copy link
Contributor

{
    text = ''
      #!${
      if libraries == [ ]
      then "${python}/bin/python"
      else "${python.withPackages (ps libraries)}/bin/python"
    }
    '';
}

the entire ${ ... } block is missing an indent.

@kamadorueda kamadorueda changed the title Style-Regression: fmt of "${...}" Explorer ways to make string interpolation nicer Feb 6, 2022
@kamadorueda kamadorueda added type | feature request New feature or request component | style Modifications to the formatting rules labels Feb 6, 2022
@kamadorueda kamadorueda changed the title Explorer ways to make string interpolation nicer Explore ways to make string interpolation nicer Feb 6, 2022
@kamadorueda
Copy link
Owner

I suppose something like this would be better:

  • indent as many times as required so that the content is after the opening curly brace
  • align the curly braces
{
    text = ''
      #! ${
            if libraries == [ ]
            then "${python}/bin/python"
            else "${python.withPackages (ps libraries)}/bin/python"
          }
    '';
}

@kamadorueda
Copy link
Owner

Ok so one change so far, is that now string-interpolations (and basically everything) receives feedback from the user. So if the user places it single-line, it's kept single line, otherwise it is expanded to multiline

We are just missing the indentation part proposed in my previous comment

@kamadorueda kamadorueda pinned this issue Feb 10, 2022
@kamadorueda kamadorueda added the status | it is a good thing We agree it is good to implement this label Feb 12, 2022
@kamadorueda
Copy link
Owner

@blaggacao thank you for the report, it now contains the missing indent: #126

@kamadorueda kamadorueda unpinned this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component | style Modifications to the formatting rules status | it is a good thing We agree it is good to implement this type | feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants