| Author |
Topic  |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Aug 18 2011 : 11:40:37 PM
|
In VA build 1856 and above we have added experimental support for user and global VA Snippet files. To use this, you will need to create the following registry key:
HKCU \ Software \ Whole Tomato \ Visual Assist X \ VANet8 \ SharedSnippetsDir = "e:\global_snippets"
Set this string value to the directory where the global VA snippets have been placed. This can be a mapped network drive, or even the path to a network share.
Replace "VANet8" with "VANet10" for Visual Studio 2010 Replace "VANet8" with "VANet9" for Visual Studio 2008 Replace "VANet8" with "VANet" for Visual Studio 2003 Replace "VANet8" with "VA6" for Visual C++ 6
Note you need to close all IDE's before editing this registry key, to avoid Visual Assist X overwriting your change when it quits.
Currently, in build 1856, these global VA Snippets are NOT shown in the VA Snippet editor. They are simply merged in with your standard VA Snippets, and are presented as normal when editing.
Global snippets with shortcuts take priority over local snippets with matching shortcuts. So if you have a global shortcut with the snippet "if" it will appear first in the listbox, before the local snippet with the shortcut "if".
For refactoring commands and suggestions for types, the local snippets are used, not the global snippets.
The easiest way of setting up the global snippets is to first backup the .TPL file for the languages you want, which are in the directory:
%APPDATA%\VisualAssist\Autotext\
Then use VA's Snippet editor to create the list of global snippets you want, remembering to delete any snippets you do not want in the global list. The modified .TPL files can then be copied to the directory you have set in the "SharedSnippetsDir" registry key, and simply restore your backups to get your original local snippets back again.
If there are no global snippets for a given language, then VA will just use the local snippets only, so there is no need to set up global snippets for all languages.
If this is something you are using, how would you see it working?
One suggestion is to show both the local and global snippets in the VA snippet editor tree, perhaps with the global snippets shown under a new top level node, and the local snippets shown under a separate top level node.
This way snippets can simply be moved, via drag and drop, between the local and global lists, the same way that snippets are currently re-ordered in the snippet editor.
One concern here is that this lets everyone edit the global snippets. If the global snippets are read from a network share, then the share permissions could be set to make the directory read only for most users.
What about the Refactoring snippets? Is there a need to read these from the global snippet file? |
zen is the art of being at one with the two'ness |
Edited by - feline on Aug 25 2011 10:14:53 AM |
|
|
fspafford
Senior Member
  
USA
41 Posts |
Posted - Sep 23 2011 : 6:32:34 PM
|
I am glad this feature is being developed. As far as refactoring snippets, I would like at least the "Refactor Document Method" to be global. Having a new top level node for global snippets seems like a good idea. As for securing the global snippets file, we can just put it under source control, like other project files. One other feature I would like to see is a quick way to find and edit a snippet.
I hope this feature will be officially supported soon.
|
Regards,
Frank |
 |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Sep 26 2011 : 7:32:54 PM
|
Thank you for the feedback. Global Document Method certainly makes a lot of sense.
We are considering a search feature in the VA Snippets dialog:
case=606
if we go with a separate global note then this would make more sense, and become a little more important. Are you aware you can type the shortcut name, with focus in the tree, to jump to the next item below you with that name? Not quite the same, but it helps. |
zen is the art of being at one with the two'ness |
 |
|
|
fspafford
Senior Member
  
USA
41 Posts |
Posted - Jun 27 2012 : 11:03:46 AM
|
| When will this feature (user and global snippet files) be officially supported? |
Regards,
Frank |
 |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Jun 28 2012 : 10:18:24 PM
|
Have you tried using this yet? If so, is it working well for you?
We had quite a few requests for this feature before it was developed, but since then, silence, so it would be useful to hear how well this is working for you. |
zen is the art of being at one with the two'ness |
 |
|
|
fspafford
Senior Member
  
USA
41 Posts |
Posted - Jul 12 2012 : 09:40:47 AM
|
| My VA support has expired. I was waiting until this feature is "permanent" before trying to upgrade VA for our development group (and of course, there are other reasons to upgrade) and test the feature. |
 |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Jul 16 2012 : 4:34:04 PM
|
This feature is now present, and working, we have just not given it a nice GUI. This was widely requested, but since producing and documenting it, you are the only person who has shown any interest in it, so the GUI is not currently a high priority.
If anything happens to break this, or cause problems with it, I will put that down as a regression and look for it to be fixed as quickly as possible, so you should be safe in starting to use this, if you have access to a build of VA that supports this feature. |
zen is the art of being at one with the two'ness |
 |
|
|
Kaylx
Junior Member
 
United Kingdom
19 Posts |
Posted - Aug 17 2012 : 05:17:16 AM
|
I can't seem to get this working...
I was trying to use a mapped network drive (G:\Developers\private\VASnippets), then tried my local drive (C:\VASnippets).
I also tried: HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet10\SharedSnippetsDir (Default) REG_SZ <dir_path> and HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet10\SharedSnippetsDir REG_SZ <dir_path>
Do you have an example registry file?
My cpp.tpl file looks ok...
FYI: VA_X.dll file version 10.7.1912.0 built 2012.08.08 DevEnv.exe version 10.0.40219.1 Premium |
 |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Aug 20 2012 : 8:22:31 PM
|
This is working as expected for me. I have uploaded a .reg and a sample cpp.tpl file here:
http://www.wholetomato.com/colin/forumimages/topic10293_shared_snippets.zip
the registry file sets the path "C:\vasnippets" for VS2010, and the "vasnippets" directory was placed in my C drive root. I have tested this under winXP SP3 32bit, and it works correctly.
When I type "sep1", "sep2", "sep3" or "sep4" the separate VA snippets are suggested and inserted correctly. They are not showing up in the VA Snippet editor dialog, but this is expected.
Can you try these files please and see what result you get? If this does not work for you, which OS are you using, and is it 32bit or 64bit? |
zen is the art of being at one with the two'ness |
 |
|
|
Jijik
New Member

2 Posts |
Posted - Feb 22 2013 : 07:01:09 AM
|
There is no SharedSnippetsDir key in my
HKCU \ Software \ Whole Tomato \ Visual Assist X \ VANet10 \
Is ti somwhere else or renamed?
Thank you |
 |
|
|
Jijik
New Member

2 Posts |
Posted - Feb 22 2013 : 07:03:39 AM
|
quote: Originally posted by Jijik
There is no SharedSnippetsDir key in my
HKCU \ Software \ Whole Tomato \ Visual Assist X \ VANet10 \
Is ti somwhere else or renamed?
Thank you
oh I have to create it. I am so sorry. |
 |
|
|
feline
Moderator
    
United Kingdom
12802 Posts |
Posted - Feb 23 2013 : 11:49:11 AM
|
| Hopefully this is now working for you. If you have any problems or questions just ask. |
zen is the art of being at one with the two'ness |
 |
|
| |
Topic  |
|