You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Scenario Outline and using a parameter from the Examples table in a step any additional parameters used in that same step do not have Syntax Coloring regardless of the position of the parameters in the step.
The following example shows working highlighting of a parameter in line 1 and the Example parameter highlighted in green and an additional parameter 'Duration' left white.
Here is an example where the white parameter is first. It exhibits the same behavior.
Any steps after the affected steps that don't contain example parameters highlight correctly.
The text was updated successfully, but these errors were encountered:
jrbye
changed the title
Syntax coloring of non-example parameters in scenario outline not working when example parameter used in the line
Syntax coloring of non-example parameters in scenario outline not working when example parameter used in the step
Apr 5, 2019
jrbye
changed the title
Syntax coloring of non-example parameters in scenario outline not working when example parameter used in the step
Syntax coloring of non-example parameters in scenario outline step not working when example parameter used in the same step
Apr 5, 2019
This behavior is by design, but maybe not the best one.
The problem is that in case of an outline step, the location of the outline placeholders (<duration>) and the location of the step parameters matched from the regex might be misaligned. Therefore the current behavior is:
Color outline placeholders only if there are outline placeholders
Color step parameters if there are no placeholders
A tricky example would be the following (this example does not make sense, of course, but it is hard to detect):
Let's consider this step definition
[When(@"this is a '([a-z ]*)' step")]
public void WhenFoo(string param)
{ }
And the following scenario outline
Scenario Outline: Parameter mix
When this is a '<param1>' step # step A
When this is <param2> step # step B
When this is <param3> tricky' step # step C
Examples:
| param1 | param2 | param3 |
| tricky | a 'tricky' | a 'very |
In this example
Step A: the outline placeholders and the step parameters are aligned (like in your example), we could be color <param1> with both italic (placeholder) and brown (parameter)
Step B: the placeholder contains the parameter entirely. Probably in this case we should only color it as placeholder
Step C: The placeholder and the parameter overlaps. I have no idea what coloring would make sense. Maybe color <param3> as placeholder and tricky as step parameter?
It is also a problem to detect the situation, because the regex of the step definition might not even match to the step line with the placeholder. E.g. in my case the regex allows letters and spaces ([a-z ]*) that does not match to <param1> (because of the angle brackets).
I see. Since the outline parameter is surrounded by <> would you be able to do the coloring of all of the parameters based on the placeholder (column name in the Examples table) before substituting the value in there? The column names shouldn't contain any special characters and they should be discernible based on the <>. Then your match you are using for current non-outline parameters would work for the remaining parameter right?
I know that I don't know anything and I am oversimplifying lots of stuff so if this doesn't make any sense please let me know. I just wanted to share that incase it sparked an idea on your side.
Thanks for all of the work on the extension. It is working very well for me so far.
When using Scenario Outline and using a parameter from the Examples table in a step any additional parameters used in that same step do not have Syntax Coloring regardless of the position of the parameters in the step.
The following example shows working highlighting of a parameter in line 1 and the Example parameter highlighted in green and an additional parameter 'Duration' left white.

Here is an example where the white parameter is first. It exhibits the same behavior.

Any steps after the affected steps that don't contain example parameters highlight correctly.
The text was updated successfully, but these errors were encountered: