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

VS 2022 Editable placeholders/literals in Code Snippets cannot be completed when placed inside a C# string literal #57733

Open
vsfeedback opened this issue Nov 12, 2021 · 1 comment
Labels
Area-IDE Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work] [regression] [worked-in:16.11.5]
When defining a Code Snippet that contains at least one editable snippet literal positioned inside a C# string literal, and the user interaction through tabbing/editing finishes with the text input caret placed inside the C# string literal, ending/confirming the snippet via Enter key is not possible. The reason seems to be that the editor will prefer splitting the C# string literal into the next line (separated with " + ") instead of finalizing the snippet editing process.

Example Snippet "" Element Content:
<! [CDATA[string s = "$myLiteral$";]] >

Invoking the snippet, typing some text and confirming with the Enter key ends up with this:
! [SnippetEnterProblem.png] (https://aka.ms/dc/image?name=B9611d77298b14f46907fdfed3e193ff0637722442634760452_SnippetEnterProblem.png&tid=9611d77298b14f46907fdfed3e193ff0637722442634760452)

Notes:

  • Confirming the snippet works if a text range is selected in the editor, which is what happens by default after tabbing to a snippet literal, so you have to at least type some text to override the snippet literal's default value if one is specified, or press the arrow keys to force the text selection to be collapsed to a singular caret position inside the string literal again.
  • This may also affect other languages (VB, F#), though I have not tested this.

Original Comments

Feedback Bot on 11/11/2021, 10:09 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 12, 2021
@jinujoseph jinujoseph added Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 18, 2021
@jinujoseph jinujoseph added this to the Backlog milestone Nov 18, 2021
@SirViver
Copy link

SirViver commented Dec 16, 2021

Note: you can sort-of work around this issue by confirming the snippet completion with Ctrl+Enter or Shift+Enter. Neither behavior is ideal, but better than VS "helpfully" auto-splitting the string placeholder/label.

(I'm the original VS feedback author)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Developer Community The issue was originally reported on https://developercommunity.visualstudio.com help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
None yet
Development

No branches or pull requests

3 participants