nextflow-io / language-server

The Nextflow language server
Apache License 2.0
9 stars 0 forks source link

Variable was declared but not used #48

Closed VasLem closed 3 weeks ago

VasLem commented 3 weeks ago

Minor issue is that defining shell variables within the shell part of the process and then using them within the command string is not supported. The server complains about variable being declared but not used. Example:

process example {    
    shell:
    njobs = Math.ceil((task.cpus as int) / 4) as int
    '''
    echo "Number of jobs to be used: !{njobs}"
    '''
}
bentsherman commented 3 weeks ago

I think we will deprecate the shell block at some point in the future, because it was designed to remove confusion between nextflow and bash variables, but this is largely addressed with syntax highlighting and the language server. For this reason I did not try to parse the variables in the shell string, which would be complicated

VasLem commented 3 weeks ago

Until you push the latest change regarding the problem with the duplication or removal of backslashes to the formal vscode repo, the only possible way to be able to use the server is to replace all the "script" with "shell", that's why I faced that issue.

bentsherman commented 3 weeks ago

Do you have auto-format on save enabled? You can disable that in the vscode settings so that the formatting doesn't get in the way.