Code Snippet missing feature?

SyntaxEditor for Windows Forms Forum

Posted 13 years ago by Jason Whitted - Owner, Etalisoft, LLC
Avatar
Since we have access to a CodeSnippetFolderCollection, it seems that we should be able to use Code Snippets from unrelated CodeSnippetFolders; however, the method SyntaxEditor.IntelliPrompt.CodeSnippets.ShowInsertSnippetPopup only takes a single CodeSnippetFolder object as a parameter.

It would be desirable to have the a ShowInsertSnippetPopup overload like:
public bool ShowInsertSnippetPopup(int offset, string labelText, CodeSnippetFolderCollection folders, CodeSnippetType type)
{
    ...
}

Comments (7)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Actually you should be able to do that pretty easily by creating a CodeSnippetFolder using the name-only constructor. Don't specify a path for the root folder. Then just add each folder in your collection to the root folder's ChildFolders. That way you'll have one root folder with all your child folders in it.


Actipro Software Support

Posted 13 years ago by Jason Whitted - Owner, Etalisoft, LLC
Avatar
Perfect! Didn't even think about that. Thanks a lot.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We've added an overload to IntelliPromptCodeSnippets.ShowInsertSnippetPopup that accepts a CodeSnippetFolderCollection in the next maintenance release.


Actipro Software Support

Posted 13 years ago by tobias weltner
Avatar
The workaround works great!
One suggestion: it would be really cool to be able to use different icons for the folders in the snippet popup.
This way it would be easier to differentiate between let's say user snippets and default snippets...
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Actually we already have that. :) There is an ImageIndex property on both CodeSnippet and CodeSnippetFolder. They go with the IntelliPrompt.CodeSnippets.ImageList property to allow you to add other images for them.


Actipro Software Support

Posted 13 years ago by tobias weltner
Avatar
cool!
Now there's only one problem left:
when I do combine two folder sources as outlined above and both sources contain a subfolder with the same name, I get two folders in the popup menu with the same name. Am I doing something wrong, or is this the way it works right now...?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good idea, we've added a CodeSnippetFolder.Merge method for the next maintenance release that allows you to merge two CodeSnippetFolders together, optionally including duplicate-named items.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.