SpecFlow.VisualStudio icon indicating copy to clipboard operation
SpecFlow.VisualStudio copied to clipboard

Escaped parenthesis breaks step auto-completion

Open Cylox opened this issue 6 years ago • 1 comments

SpecFlow Version:

  • [X] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Project Format of the SpecFlow project

  • [X] Classic project format using packages.config
  • [ ] Classis project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

  • [X] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [ ] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [ ] VS 2019
  • [X] VS 2017 15.9.12
  • [ ] VS 2015

Are the latest Visual Studio updates installed?

  • [X] Yes
  • [ ] No

.NET Framework:

  • [X] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [ ] .NET Core 2.2
  • [ ] .NET Core 3.0

Repro Project

https://github.com/Cylox/SfAutoCompletionBreak.git

Issue Description

When using a backslash to escape a regex character in the regex parameter of a step binding attribute like [When], the step auto completion feature of the Visual Studio integration fails to insert the step text correctly in the .feature file. Only the text up to the first escape backslash character is inserted. The preview is also incorrect. When correcting the step text manually the step can be executed.

Example:

 [Given(@"I have a step with coordinates like this: \(([\d\.\,]+|{x}),\s?([\d\.\,]+|{y})\)")]

Expectation:

Given I have a step with coordinates like this: ({x}, {y})

Actual:

Given I have a step with coordinates like this: \{x}

Steps to Reproduce

Open the repro project, try to insert the provided step in the feature file.

Cylox avatar May 15 '19 09:05 Cylox

I can confirm this issue. A subcase is a [Given(@"Question? me")] Autocomplete gives: Given Question me The ? is missing completely

TacoVerhagen avatar Jun 30 '20 14:06 TacoVerhagen