Skip to content

Commit fc52de4

Browse files
kenibrewerclaude
andcommitted
feat: improve Nextflow language support
Add triple-double, triple-single, and single quote support to the Nextflow language definition. This fixes miscounting of comment-like content inside process script blocks (e.g. """...""" heredocs). Also adds nextflow.config as a recognized filename and removes the unused "nextflow" extension (Nextflow files use .nf). Rewrites the test file as a DSL2 pipeline exercising all quote and comment variants. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 505d648 commit fc52de4

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

languages.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,9 @@
12061206
"Nextflow": {
12071207
"line_comment": ["//"],
12081208
"multi_line_comments": [["/*", "*/"]],
1209-
"quotes": [["\\\"", "\\\""]],
1210-
"extensions": ["nextflow", "nf"]
1209+
"quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"], ["\\\"", "\\\""], ["'", "'"]],
1210+
"extensions": ["nf"],
1211+
"filenames": ["nextflow.config"]
12111212
},
12121213
"Nim": {
12131214
"line_comment": ["#"],

tests/data/nextflow.nf

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
1-
/* 18 lines 10 code 5 comments 3 blanks */
1+
// 42 lines 28 code 5 comments 9 blanks
22

33
/*
4-
Nextflow - hello
5-
*/
4+
* Multi-line block comment
5+
*/
66

7-
// comment
8-
cheers = Channel.from 'Bonjour', 'Ciao', 'Hello', 'Hola'
7+
// Single line comment
8+
nextflow.enable.dsl = 2
9+
10+
params.greeting = 'Hello'
11+
params.name = "World"
912

1013
process sayHello {
11-
echo true
12-
input:
13-
val x from cheers
14-
script:
14+
input:
15+
val greeting
16+
val name
17+
18+
output:
19+
stdout
20+
21+
script:
1522
"""
16-
echo '$x world!'
23+
echo '${greeting}, ${name}!'
24+
echo "// this is not a comment"
25+
echo '/* also not a comment */'
1726
"""
1827
}
28+
29+
process farewell {
30+
output:
31+
stdout
32+
33+
script:
34+
'''
35+
echo 'Goodbye!'
36+
'''
37+
}
38+
39+
workflow {
40+
sayHello(params.greeting, params.name) | view
41+
farewell() | view
42+
}

0 commit comments

Comments
 (0)