Displaying code snippet folders

SyntaxEditor for WPF Forum

Posted 12 years ago by Stephen Curle
Version: 12.1.0562
Avatar

I notice you've introduced code snippets in the latest version. Does this have the ability to display code snippet folders in a pop-up menu similar to the WinForms version. This could be displayed using code such as the following -

syntaxEditor.IntelliPrompt.CodeSnippets.ShowInsertSnippetPopup(mEditor.Caret.Offset, "Insert snippet:", SnipFolder, CodeSnippetTypes.Expansion)

If not do you have plans to introduce this feature and when ?

Comments (6)

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

Hi Stephen,

The insert snippet popup isn't in 2012.1 but it is a completed feature that will be in 2012.2.  We are still finishing up other enhancements for that version, so it may be a month or two yet.


Actipro Software Support

Posted 12 years ago by Stephen Curle
Avatar

I note this has been added in 2012.2 now but I can't get it to work properly. Although it shows snippet folders, it doesn't show snippet files, backspace doesn't seem to work, and I can't remove it by pressing the escape key. I'm using the following code to launch the snippet popup which is called when the # key is pressed (I've also registered a CodeSnippetProvider).

mEditor.ActiveView.IntelliPrompt.RequestInsertSnippetSession()

Is there anything else I'm missing ?

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

Hi Stephen,

When I try it in the SDI Editor sample it's working fine.  I wonder if perhaps you doing it from a key handler is keeping focus in the editor vs. allowing it to go to the popup properly.  Make sure your root code snippet folder actually contains snippets in it too, or else you won't see any at the root level.

You could try to "dispatch" the RequestInsertSnippetSession call with Send priority.  Maybe see if that helps.


Actipro Software Support

Posted 11 years ago by Stephen Curle
Avatar

I've produced a sample application which demonstrates the problem I'm having. The code snippets popup is launched by clicking a button. Folders are shown but not snippet files. Can I pass this to you too look at ? How do I do this ?

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

Hi Stephen,

One more thing to try before sending anything.  The method you call is going to only include code snippets that have the Expansion enumeration item indicated in their SnippetTypes property.  So make sure your snippets have the SnippetTypes specified and htat Expansion is present.  See if that is the problem.


Actipro Software Support

Posted 11 years ago by Stephen Curle
Avatar

Adding the Expansion enumeration has done the trick. Thanks.

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

Add Comment

Please log in to a validated account to post comments.