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

Embedded regex language provider support does not seem to escape regex constructs correctly #1949

Closed
webczat opened this issue Sep 17, 2020 · 3 comments · Fixed by #1950
Closed

Comments

@webczat
Copy link

webczat commented Sep 17, 2020

Hi, currently using c# extension version 1.23.2 and testing embedded language providers, mainly regex.
If I type that somewhere in code Regex.Match("test", ""); and try to trigger suggestions in the empty quotes of second argument, I see that the regex provider is triggered. Then, if I try to select some backslash suggestion like \s, what I get after pressing enter is just "\s". However, because the string is non verbatim, it should be escaped as "\s"`.

In addition, if I do the same but trigger completion after first typing two backslashes and then select something like \A, I get "\\\A" instead of just "\A".

I believe it does work in vs proper, so reporting it here.

CC: @333fred

@333fred
Copy link
Contributor

333fred commented Sep 17, 2020

We likely need to resolve the edit for this eagerly as well, like we do for doc comment tags.

@333fred
Copy link
Contributor

333fred commented Sep 17, 2020

@JoeRobich can you move this to omnisharp-roslyn?

@JoeRobich JoeRobich transferred this issue from dotnet/vscode-csharp Sep 17, 2020
@JoeRobich
Copy link
Member

can you move this to omnisharp-roslyn?

@333fred TIL that I can =)

333fred added a commit to 333fred/omnisharp-roslyn that referenced this issue Sep 18, 2020
Depending on whether the context is a verbatim string or not, the regex provider will escape the text, so we need to realize it ahead of time. Fixes OmniSharp#1949.
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 a pull request may close this issue.

3 participants