snakemake / snakefmt

The uncompromising Snakemake code formatter
MIT License
147 stars 28 forks source link

Prevent newline for shell triple-quote #201

Open alpha-beta-soup opened 1 year ago

alpha-beta-soup commented 1 year ago
  rule archive:
+     input:
-     input: FOOTPRINT
?     ^^^^^^
+         FOOTPRINT,
?     ^^^          +
-     output: ARCHIVE
?            --------
+     output:
+         ARCHIVE,
-     shell: '''
?           ----
+     shell:
+         """
          mkdir -p $(dirname {output})
          zip -r {output} './data'
-     '''
+     """

That is,

shell: '''
    some-command {output} {input}
'''

Is formatted to:

shell:
    """
    some-command {output} {input}
"""

However the newline loses the syntax highlighting in VS Code, at least with my current settings:

Before: Screenshot from 2023-09-18 11-40-28

After: Screenshot from 2023-09-18 11-40-47

I'd be interested in either learning how to disable that change, or perhaps just knowing what I could tweak in VS Code to continue to see {output} etc with string-format syntax-highlighting, as this is really quite useful for more complex rules.

mbhall88 commented 12 months ago

You can't disable this change from snakefmt. I suspect your issue may have something to do with VS Code? But I can't help you there as I don't use VS Code sorry. I'll leave this open and hopefully someone else who uses it can shed some light....