For a user with a modest collection of VA Snippets, the built-in type filtering and auto-sorting of the VA Snippet Editor are sufficient tools to manage the collection. Type filtering divides VA Snippets by access method in the UI of Visual Assist, and auto-sorting within a type makes scrolling efficient. For the occasional VA Snippet that is hard to locate by type filter, the search capability in the VA Snippet Editor is an ample ancillary tool.
But for the user who has a massive collection of VA Snippets, built-in type filtering can fail to divide VA Snippets into manageable subsets. In these instances, hashtags in the descriptions of VA Snippets will tame the collection. You can add multiple hashtags to one VA Snippet, and tell the VA Snippet Editor to display only VA Snippets that include a specific hashtag(s).
If hashtags might help you stay organized, start with a reasonable set of hashtags for your collection. Remember, one VA Snippet can have multiple hashtags. For example, you can specify a language construct, custom type, and author for a single VA Snippet. With your hashtags in hand, scroll through your collection of VA Snippets and add the hashtags to your descriptions, separating your hashtags with commas or spaces.
Once you’ve added your hashtags, tell the VA Snippet Editor to display only entries containing a hashtag by:
- setting Type to “Search”
- entering a hashtag in the search field
- setting scope to “Search descriptions”
In the following example, I search for VA Snippets I’ve tagged as loop constructs. The editor shows only the five I’ve tagged:
Searches for VA Snippets that include any one of several tags requires you enable REs in searches and separate your hashtags with vertical bars—the symbol for “or” in an RE. For example, I can search for VA Snippets I’ve tagged as loop constructs or as switch statements:
Searches for VA Snippets that include multiple tags are a little trickier. The general pattern of an RE that finds VA Snippets with multiple tags is:
(?=.*#tag)(?=.*#tag)(?=.*#tag).+
In the following example, I find VA Snippets tagged as loop constructs AND authored by Jeff:
If you have a large collection of VA Snippets, especially if you distribute the collection to other developers who browse through it, consider setting aside time to add hashtags. You may be more productive in the long run.