Description
When #@
script parameters are commented out (with //
or #
, dependent on the language used), the behavior differs depending on the position of the parameter definitions in the script (due to the support of both old-style and new-style parameters).
Consider the following Groovy scripts (all working as expected):
/*
* Some comment as header
* (This script uses new-style parameter syntax)
*/
#@ String text
#@ String text
/*
* (This script uses a new-style parameter, but at the beginning of the script)
*/
// @String text
/*
* (Old-style parameters will only be parsed at the very beginning of the code)
*/
Now, in the scripts using the new-style (#@
) syntax, if you comment out the script parameter with //
, the first script will stop showing the dialog, while the second script will still prompt for the text
parameter:
/*
* The following parameter declaration will be ignored
* because # is not at the beginning of the line
*/
// #@ String text
// #@ String text
/*
* ^^^ !
* The above parameter matches the old-style syntax, even if both // and # are present
*/
We can probably change this to respect (and ignore) comments if and only if the script is using new-style syntax, by changing how we match the line when parsing old-style parameters here:
The question is if that would break any scripts in the wild that rely on the current behavior. There's definitely some scripts already that rely on commenting script parameters, but it would probably be ok to restore consistent behavior if the commented parameter occurs at the very beginning of the script.
@ctrueden what's your opinion?
NB: the behavior for Python is the same: # #@String text
is ignored, except if in the first line.