Snippet SurroundWith

SyntaxEditor for WPF Forum

Posted 11 years ago by A A
Version: 13.1.0580
Avatar

When i write : SyntaxEditor.ActiveView.IntelliPrompt.RequestSurroundWithSession();
It writes in a pop-uo "Surround with" but it's simply a session of insert.
How can i do for use a SURROUND session snippet ?

Comments (3)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello, it will only show code snippets that have the "SurroundsWith" snippet type specified in the snippet's XML.  You can see this in our SDI Editor demo if you have our C# add-on language loaded and do "Insert Snippet" (via Edit/IntelliPrompt menu).  You'll see "for" and "switch" snippets show.  Then do "Surrounds With" and you'll only see "for" show up.  "switch" didn't show since its XML definition didn't have that flag specified.

The only other thing to be aware of is that if no snippet types are specified in the XML and there is a $selected$ tag present in a snippet, it will auto-set "SurroundsWith".


Actipro Software Support

Posted 11 years ago by A A
Avatar

Your sample SDI Editor doesn't work as Visual Studio. I thought that selecting some code and pressing "SurroundWith-For" the selected code will be surrounded by the for snippet but the editor replace my code and insert the for snippet.

There's a problem in your sample demo or this is the only way to use Surround With?

Thanks

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thanks for reporting this, it is indeed a bug.  The code snippet selection session was marking the resulting template session as being from a shortcut when it shouldn't have been.  The selected text only gets included when the template session is not from a shortcut.

We've fixed this for the upcoming maintenance release.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.