Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step coloring fixes #34

Merged
merged 6 commits into from Aug 23, 2018
Merged

Conversation

szaliszali
Copy link
Contributor

Related issue: SpecFlowOSS/SpecFlow#483

Notes:

  • this PR is still legacy code not backed by automated tests, but I think it was worth opening to highlight what's wrong with the current implementation
  • the fix may have some performance impact if there are complicated step definition patterns defined, because the regex must be matched a second time to get the correct positions
  • a more correct solution would be to change StepDefinitionMatchService.GetBestMatch in SpecFlow to return the positions instead of substrings where possible, but that would be way over budget considering that the VS extension is using an outdated version of SpecFlow internally

Fix 1 (original issue):
Before:
image

After:
image

Fix 2 (multiple occurrences of the same <pattern>):
Before:
image

After:
image

- the substring was matched always from the beginning
- instead of substring search
- match text with step definition regex
- iterate all match groups and use their position
@SabotageAndi
Copy link
Contributor

Thanks for the PR.
I hope I will get a version out, before my vacation in September.

@SabotageAndi
Copy link
Contributor

@szaliszali Could you add an entry into the changelog? https://github.com/techtalk/SpecFlow.VisualStudio/blob/master/changelog.txt

@SabotageAndi SabotageAndi merged commit 2187b86 into SpecFlowOSS:master Aug 23, 2018
littlegenius666 pushed a commit to littlegenius666/SpecFlow.VisualStudio that referenced this pull request May 3, 2019
Related issue: SpecFlowOSS/SpecFlow#483

Notes:
- this PR is still legacy code not backed by automated tests, but I think it was worth opening to highlight what's wrong with the current implementation
- the fix may have some performance impact if there are complicated step definition patterns defined, because the regex must be matched a second time to get the correct positions
- a more correct solution would be to change `StepDefinitionMatchService.GetBestMatch` in SpecFlow to return the positions instead of substrings where possible, but that would be way over budget considering that the VS extension is using an outdated version of SpecFlow internally

Fix 1 (original issue):
Before:
![image](https://user-images.githubusercontent.com/1851369/44508858-1a453c00-a6b0-11e8-9ee3-86563d3e3788.png)

After:
![image](https://user-images.githubusercontent.com/1851369/44508835-04d01200-a6b0-11e8-9bb8-cff60966cb0e.png)

Fix 2 (multiple occurrences of the same `<pattern>`):
Before:
![image](https://user-images.githubusercontent.com/1851369/44508813-f5e95f80-a6af-11e8-9ebc-2cf7b6dca77b.png)

After:
![image](https://user-images.githubusercontent.com/1851369/44508821-fa157d00-a6af-11e8-8506-bc712acc488f.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants