Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 How to create a cheat sheet from VA Snippets?

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Hvergelmir Posted - Aug 21 2018 : 10:44:46 AM
Hi,

is there a way to create a cheat sheet from the VA Snippets? Naturally I am mostly interested in those that have a shorthand version, although a list of the others would also be nice for the learning experience.

Thanks and best regards.

Oh and if this doesn't exist, I'd like to propose this as a feature suggestion.
7   L A T E S T    R E P L I E S    (Newest First)
Hvergelmir Posted - Aug 23 2018 : 4:41:32 PM
It'll be open source, so it can be "forked" if ever needed :)
feline Posted - Aug 22 2018 : 08:28:08 AM
If you want, place keyboard focus into the column control, then use Ctrl-A to select all currently visible snippets, and then Ctrl-C to copy all of the snippets in one go to the clipboard.

If you want a specific set of snippets, try setting the "Type" drop down field to "Search...", which will allow you to search for the block of snippets you want.

You are more than welcome to post a script here for converting the XML into something more helpful. Just don't be surprised if someone then asks you to support it is all
Hvergelmir Posted - Aug 22 2018 : 06:14:32 AM
quote:
Originally posted by Jeff

If you are familiar with *nix, paste the copied XML into snippets.txt. Then, use the following shell script to create a cheat sheet. I tested this script in the Unbuntu distro of WSL.

Thanks Jeff. Yeah, I am working on the terminal on a number of Unixes, most notably Linux, all the time. You may want to give the xmlstarlet and xgrep packages/tools a try, though, for this kind of task from the command line.

Anyway, I'll probably rather create a Python script to do the job and post it here. Perhaps it's useful to others as well.

One more question, though, in that case. Can I get the entirety of a set of VA Snippets into XML format easily or is it always a one-by-one task?
Jeff Posted - Aug 21 2018 : 6:56:43 PM
If you are familiar with *nix, paste the copied XML into snippets.txt. Then, use the following shell script to create a cheat sheet. I tested this script in the Unbuntu distro of WSL.

#!/bin/bash
export LC_ALL=C		# include leading characters in sort
cat snippets.txt | \
  sed -e 's/\r//g' | \
  grep -v '^$' | \
  paste -s -d'|' | \
  sed -e 's/<\/VA_Snippet>|<VA_Snippet>/\n/g' -e "s/$(printf '\t')//g" | \
  grep -v '<Shortcut />'  | \
  sed -e 's/.*<Shortcut>\(.*\)<\/Shortcut>.*<Code>\(.*\)<\/Code>.*/\1\t\t\2/' | \
  sort

Send email to [email protected] and mention topic 15305 if you want the commands in a file. They were not easy to paste into our forums editor; they might be wrong.
feline Posted - Aug 21 2018 : 4:19:08 PM
The snippets and their shortcuts are common across all versions of Visual Studio on a single machine. They are just stored once, and loaded by each IDE, so the list you get from the newer IDE's snippet editor will be equally valid in the older IDE's.

If you want to extract some of this information to format up as a document to print out for easy reference, you can multiple select in the column list of snippets in the new snippet editor. Hold down Alt and left mouse click as normal to do this. If you now use Ctrl-C XML format versions of these snippets are then copied to your clipboard, which you can use to easily extract the shortcut and description and format up this information to suit your needs.
Hvergelmir Posted - Aug 21 2018 : 3:13:39 PM
Alright, this is indeed a good start. Yes, I do have several VS versions ranging from VS2005 to VS2017, but was asking for the latter.

Thanks for your swift response.
feline Posted - Aug 21 2018 : 1:58:30 PM
Assuming you are using VS2010 or above you will have the new Snippet Editor. Use the "Type" drop down field to list "All by Shortcut", which will list all of the snippets with a shortcut on your system, showing the shortcut first in bold, to make it easier to pick out.

You can also set this to show you all "Surround With" snippets, which are snippets that are designed to surround a selected piece of code with the new snippet.

You can easily make up a list of the ones that interest you from here. We have tried to make the default shortcuts "obvious", so you will find them as you type. For example "if", "try" and "class".

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000