Hi all,
I’m a huge fan of automatic formatting of code on save and was excited to see that the new language server offers code-formatting as well. The only thing that’s keeping me from using it is how it handles backslashes/line-break-escapes in script blocks. For example, when I take this process declaration:
process BBMERGE {
tag "${sample_id}"
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
maxRetries 2
input:
tuple val(sample_id), path(reads1), path(reads2)
output:
tuple val(sample_id), path("${sample_id}.merged.preclump.fastq.gz")
script:
"""
bbmerge.sh \
in1=`realpath ${reads1}` \
in2=`realpath ${reads2}` \
out=${sample_id}.merged.preclump.fastq.gz \
outu=${sample_id}.unmerged.preclump.fastq.gz \
strict k=93 extend2=80 rem ordered \
ihist=${sample_id}_ihist_merge.txt \
threads=${task.cpus}
"""
}
And save it four times in sequence without making any other changes, the LS will successively add more and more backslashes, resulting in something like this:
process BBMERGE {
tag "${sample_id}"
errorStrategy { task.attempt < 3 ? 'retry' : 'ignore' }
maxRetries 2
input:
tuple val(sample_id), path(reads1), path(reads2)
output:
tuple val(sample_id), path("${sample_id}.merged.preclump.fastq.gz")
script:
"""
bbmerge.sh \\\\\\\\\\\\\\\\
in1=`realpath ${reads1}` \\\\\\\\\\\\\\\\
in2=`realpath ${reads2}` \\\\\\\\\\\\\\\\
out=${sample_id}.merged.preclump.fastq.gz \\\\\\\\\\\\\\\\
outu=${sample_id}.unmerged.preclump.fastq.gz \\\\\\\\\\\\\\\\
strict k=93 extend2=80 rem ordered \\\\\\\\\\\\\\\\
ihist=${sample_id}_ihist_merge.txt \\\\\\\\\\\\\\\\
threads=${task.cpus}
"""
}
Is this a formatting I can turn off with a particular setting in my user settings JSON? Or is there some other way I should be formatting long commands to help the LS format correctly? And more generally, is there now or might there eventually be a way to turn on or off particular lints or formatting rules in the language server, akin to what you can do for Python’s Ruff?
Thanks for your great work and keep it up!
–Nick