The nextflow manual instructs us to define handlers like…
workflow.onComplete {
println "Pipeline completed at: $workflow.complete"
println "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
}
https://nextflow.io/docs/latest/notifications.html#workflow-handlers
This has worked well but I’d also like to use the language server. Handlers defined in this manner make the language server very sad.
[{
"resource": "/Users/jkern/workspaces/scarlet/main.nf",
"owner": "_generated_diagnostic_collection_name_#5",
"severity": 8,
"message": "Statements cannot be mixed with script declarations -- move statements into a process or workflow",
"source": "nextflow",
"startLineNumber": 1032,
"startColumn": 1,
"endLineNumber": 1050,
"endColumn": 2
}]
If I move this inside the workflow block, the error goes away. Unfortunately, so does the functionality.
I am using this language server…
Identifier - nextflow.nextflow
Version - 1.0.4
Last Updated - 2025-01-21, 17:17:30
What is a good way to define these handlers in a language server compliant way?
-jk