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

Indentation help with blank line #489

Open
mkleehammer opened this issue Feb 11, 2024 · 0 comments
Open

Indentation help with blank line #489

mkleehammer opened this issue Feb 11, 2024 · 0 comments

Comments

@mkleehammer
Copy link

I have some Python functions that accept SQL statements, so I have some templates that insert a triple quoted string. For example, the result I'm trying to achive is:

cnxn.execute(
    """
    |     # <-- caret here
    """)

I have a template with key "execute" and it usually works, but not always:

# -*- mode: snippet -*-
# name: execute
# key: execute
# expand-env: ((yas-indent-lines 'auto) (yas-also-indent-empty-lines t))
# --
execute(
    """
    $0
    """)

With this, entering "cnxn.execute" at column 0 results in:

cnxn.execute(
    """   
        |
        """)

Within a function they are lined up however.

I've tried combinations of indentation markers, fixed, auto, nil, etc. and cannot find a
combination that works at column 0 and at other columns. Each either ends up like this or
reversed where the closing quotes are indented before the opening.

the behavior I'm looking for is almost fixed with a marker:

  • The line with "execute" is already indented correctly so it shouldn't change.
  • The opening quotes should be lined up according to mode. They could be much further back if
    "execute" is at the end of a long line.
  • The empty line with $0 and the closing quote need to be lined with the closing, disregarding
    the mode. Basically like fixed, but fixed from the first indented line.

Am I missing a combination or a feature?

Thanks.

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

1 participant