473,735 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best ways to source controlling "Code Snippets"

I am interested in learning how to use the VS 2005 code snippets.
However, I wish to know what are the best ways to source control the
code snippets?

Are there any source safe/subversion add-ons for this purpose?

If not, any urls which demonstrates code snippets management?
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.

great thanks
Frank

Mar 23 '07 #1
13 2329
http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

Code snippets are the best thing since shirt pockets.

Robin S.
-----------------------------
<fr*****@gmail. comwrote in message
news:11******** **************@ y80g2000hsf.goo glegroups.com.. .
>I am interested in learning how to use the VS 2005 code snippets.
However, I wish to know what are the best ways to source control the
code snippets?

Are there any source safe/subversion add-ons for this purpose?

If not, any urls which demonstrates code snippets management?
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.

great thanks
Frank

Mar 23 '07 #2
That may be Robin but Confucius said "man with hole in pocket feels cocky
all day."

I'm using an application called Snippy that works fairly well for C#.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:ut******** *************** *******@comcast .com...
http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

Code snippets are the best thing since shirt pockets.

Robin S.
-----------------------------
<fr*****@gmail. comwrote in message
news:11******** **************@ y80g2000hsf.goo glegroups.com.. .
>>I am interested in learning how to use the VS 2005 code snippets.
However, I wish to know what are the best ways to source control the
code snippets?

Are there any source safe/subversion add-ons for this purpose?

If not, any urls which demonstrates code snippets management?
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.

great thanks
Frank


Mar 23 '07 #3
LOL. Thanks, I needed that on a Friday afternoon.

And what's the deal with C# not having nearly as many code snippets as VB?
Did someone at MS fall down on the job?

And while I'm at it, in VB you can type ? and tab and it will bring up the
code snippets. Is there a shortcut for C#?

Thanks,
Robin S.
------------------------------------------
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com wrote in message
news:ey******** ******@TK2MSFTN GP05.phx.gbl...
That may be Robin but Confucius said "man with hole in pocket feels cocky
all day."

I'm using an application called Snippy that works fairly well for C#.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:ut******** *************** *******@comcast .com...
>http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

Code snippets are the best thing since shirt pockets.

Robin S.
-----------------------------
<fr*****@gmail .comwrote in message
news:11******* *************** @y80g2000hsf.go oglegroups.com. ..
>>>I am interested in learning how to use the VS 2005 code snippets.
However, I wish to know what are the best ways to source control the
code snippets?

Are there any source safe/subversion add-ons for this purpose?

If not, any urls which demonstrates code snippets management?
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.

great thanks
Frank



Mar 23 '07 #4
Snippy is a VS2005 add-in and called using Ctrl-K, Ctrl-B

Here's more from "Help on Snippy"...

How to get started:

This code snippet editor will help you write snippets that conform to the
following schema:
http://schemas.microsoft.com/VisualS...05/CodeSnippet.

The following xml is a simple example of what this will produce:
<CodeSnippets
xmlns="http://schemas.microso ft.com//VisualStudio//2005//CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="CShar p">
<![CDATA[MessageBox.Show ("Hello World");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

The following fields are required for a snippet to work inside of Visual
Studio: Title, SnippetTypes, Code, Language.

Title - This is the name of the snippet that will be visible in the
code snippet picker and the code snippet manager.
Shortcut - If you want to invoke your snippet through the keyboard, you
can assign it a shortcut. Pressing the shortcut and hitting "Tab" will
insert your new snippet in the editor.
SnippetTypes - Expansion is for a snippet that inserts text. SurroundsWith
is for snippets that will surround a block of text such as a for loop
Language - This is required to know which type of language the snippet
you are creating will work for. The currently supported lanugages are VB,
C#, J# and XML
Code - The actual code that will be spit into the editor is required
here. In the above example, this is the text that is wrapped in the CDATA
section. You do not need to include the CDATA block
Adding a Literal or Object:
The Literal element is used to identify a replacement for a piece of code
that is entirely contained within the snippet, but will likely be customized
after it is inserted into the code. For example, literal strings, numeric
values, and some variable names should be declared as literals.
The Object element is used to identify an item that is required by the
code snippet but is likely to be defined outside of the snippet itself. For
example, Windows Forms controls, ASP.NET controls, object instances, and
type instances should be declared as objects. Object declarations require
that a type be specified.
Use the Add button on the literals/objects section to add a new literal.
ID and default value are the only required fields.
Now that you have created literals and objects, you need a way to use them
in the code that will be inserted by the code snippet. You reference the
literals and objects you have declared in the Declarations element by
placing $ symbols at the beginning and end of the value in the literal or
object's ID elementTo reference a literal or object in a Code element, place
$ symbols at the beginning and end of the literal or object's ID element
value. For example, if a literal has an ID element that contains the value
MyID, you would reference that literal in the Code text box with $MyID$.

After creating your snippet, you need to save it to a location that Visual
Studio will be able to access it from. In Visual Studio, go to the Tools
menu and choose Code Snippet Manager. Here you can select the language that
the snippets you are creating refer to. From there you will be able to see
the directories where you can place the snippet. Copy one of these
locations and save your snippet there. Visual Stuido wil then automatically
pick up your newly created snippet.

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:pN******** *************** *******@comcast .com...
LOL. Thanks, I needed that on a Friday afternoon.

And what's the deal with C# not having nearly as many code snippets as VB?
Did someone at MS fall down on the job?

And while I'm at it, in VB you can type ? and tab and it will bring up the
code snippets. Is there a shortcut for C#?

Thanks,
Robin S.
------------------------------------------
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com wrote in message
news:ey******** ******@TK2MSFTN GP05.phx.gbl...
>That may be Robin but Confucius said "man with hole in pocket feels cocky
all day."

I'm using an application called Snippy that works fairly well for C#.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:ut******* *************** ********@comcas t.com...
>>http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

Code snippets are the best thing since shirt pockets.

Robin S.
-----------------------------
<fr*****@gmai l.comwrote in message
news:11****** *************** *@y80g2000hsf.g ooglegroups.com ...
I am interested in learning how to use the VS 2005 code snippets.
However, I wish to know what are the best ways to source control the
code snippets?

Are there any source safe/subversion add-ons for this purpose?

If not, any urls which demonstrates code snippets management?
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.

great thanks
Frank



Mar 23 '07 #5
I tried out your link to the code snippet editor, and get a "page cannot be
found". Try out the link I gave; it's probaby the same thing you're talking
about.

http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

The Ctrl-K Ctrl-B thing is what *I* was looking for! Thanks!

Robin S.
-------------
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com wrote in message
news:Oe******** ******@TK2MSFTN GP05.phx.gbl...
Snippy is a VS2005 add-in and called using Ctrl-K, Ctrl-B

Here's more from "Help on Snippy"...

How to get started:

This code snippet editor will help you write snippets that conform to the
following schema:
http://schemas.microsoft.com/VisualS...05/CodeSnippet.

The following xml is a simple example of what this will produce:
<CodeSnippets
xmlns="http://schemas.microso ft.com//VisualStudio//2005//CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="CShar p">
<![CDATA[MessageBox.Show ("Hello World");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

The following fields are required for a snippet to work inside of Visual
Studio: Title, SnippetTypes, Code, Language.

Title - This is the name of the snippet that will be visible in
the code snippet picker and the code snippet manager.
Shortcut - If you want to invoke your snippet through the keyboard,
you can assign it a shortcut. Pressing the shortcut and hitting "Tab"
will insert your new snippet in the editor.
SnippetTypes - Expansion is for a snippet that inserts text.
SurroundsWith is for snippets that will surround a block of text such as
a for loop
Language - This is required to know which type of language the
snippet you are creating will work for. The currently supported
lanugages are VB, C#, J# and XML
Code - The actual code that will be spit into the editor is
required here. In the above example, this is the text that is wrapped in
the CDATA section. You do not need to include the CDATA block
Adding a Literal or Object:
The Literal element is used to identify a replacement for a piece of
code that is entirely contained within the snippet, but will likely be
customized after it is inserted into the code. For example, literal
strings, numeric values, and some variable names should be declared as
literals.
The Object element is used to identify an item that is required by the
code snippet but is likely to be defined outside of the snippet itself.
For example, Windows Forms controls, ASP.NET controls, object instances,
and type instances should be declared as objects. Object declarations
require that a type be specified.
Use the Add button on the literals/objects section to add a new literal.
ID and default value are the only required fields.
Now that you have created literals and objects, you need a way to use
them in the code that will be inserted by the code snippet. You reference
the literals and objects you have declared in the Declarations element by
placing $ symbols at the beginning and end of the value in the literal or
object's ID elementTo reference a literal or object in a Code element,
place $ symbols at the beginning and end of the literal or object's ID
element value. For example, if a literal has an ID element that contains
the value MyID, you would reference that literal in the Code text box
with $MyID$.

After creating your snippet, you need to save it to a location that
Visual Studio will be able to access it from. In Visual Studio, go to
the Tools menu and choose Code Snippet Manager. Here you can select the
language that the snippets you are creating refer to. From there you
will be able to see the directories where you can place the snippet.
Copy one of these locations and save your snippet there. Visual Stuido
wil then automatically pick up your newly created snippet.

--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:pN******** *************** *******@comcast .com...
>LOL. Thanks, I needed that on a Friday afternoon.

And what's the deal with C# not having nearly as many code snippets as
VB? Did someone at MS fall down on the job?

And while I'm at it, in VB you can type ? and tab and it will bring up
the code snippets. Is there a shortcut for C#?

Thanks,
Robin S.
------------------------------------------
"clintonG" <cs*********@RE MOVETHISTEXTmet romilwaukee.com wrote in
message news:ey******** ******@TK2MSFTN GP05.phx.gbl...
>>That may be Robin but Confucius said "man with hole in pocket feels
cocky all day."

I'm using an application called Snippy that works fairly well for C#.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee. com
URL http://clintongallagher.metromilwaukee.com/
"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:ut****** *************** *********@comca st.com...
http://msdn2.microsoft.com/en-us/vbasic/ms789085.aspx

Code snippets are the best thing since shirt pockets.

Robin S.
-----------------------------
<fr*****@gma il.comwrote in message
news:11***** *************** **@y80g2000hsf. googlegroups.co m...
>I am interested in learning how to use the VS 2005 code snippets.
>
>
However, I wish to know what are the best ways to source control the
code snippets?
>
Are there any source safe/subversion add-ons for this purpose?
>
If not, any urls which demonstrates code snippets management?
>
>
I apologize for the cross-posting. This is relative obscure question,
and wish to get as much exposure as possible.
>
great thanks
Frank
>




Mar 23 '07 #6
On Mar 23, 10:43 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
LOL. Thanks, I needed that on a Friday afternoon.

And what's the deal with C# not having nearly as many code snippets as VB?
Did someone at MS fall down on the job?
http://msdn2.microsoft.com/en-us/vstudio/aa718338.aspx

Mar 24 '07 #7

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ l75g2000hse.goo glegroups.com.. .
On Mar 23, 10:43 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
>LOL. Thanks, I needed that on a Friday afternoon.

And what's the deal with C# not having nearly as many code snippets as
VB?
Did someone at MS fall down on the job?

http://msdn2.microsoft.com/en-us/vstudio/aa718338.aspx
Thank you! Awesome!!

Now, is there a way to invoke "Insert Code Snippet" without using the
context menu in the code window? In VB, you can type ? and tab and it
brings them up. Is there any such shortcut in C#?

Robin S.
Mar 24 '07 #8
On Mar 24, 4:35 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
>
Thank you! Awesome!!

Now, is there a way to invoke "Insert Code Snippet" without using the
context menu in the code window? In VB, you can type ? and tab and it
brings them up. Is there any such shortcut in C#?
Ctrl+K+X

More information about Code Snippets:
http://msdn2.microsoft.com/en-us/lib...92(VS.80).aspx

Mar 24 '07 #9
On Mar 24, 11:47 am, "Alexey Smirnov" <alexey.smir... @gmail.com>
wrote:
On Mar 24, 4:35 pm, "RobinS" <Rob...@NoSpam. yah.nonewrote:
Thank you! Awesome!!
Now, is there a way to invoke "Insert Code Snippet" without using the
context menu in the code window? In VB, you can type ? and tab and it
brings them up. Is there any such shortcut in C#?

Ctrl+K+X

More information about Code Snippets:http://msdn2.microsoft.com/en-us/lib...92(VS.80).aspx
Hi,

Sorry to bother.

What is the best way to ensure all the developers on a team have the
same code snippets on their machines?

What is the best way to source control the code snippets?

regards
Frank

Mar 24 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1294
by: Charles Law | last post by:
I have started getting "There is no source code available for the current location" when I run my VB.NET solution. I have no breakpoints set but cannot get rid of this message. The debugger won't let me continue. Does anyone know what is going on? I seem to think that this only started happening after I used the "Disable all breakpoints" menu option. Since then, I have re-enabled breakpoints and removed all breakpoints, but now the...
13
2286
by: Adam | last post by:
My "C:\" is getting full. What's the best way to install "wxWindows" without taking up 115 MB from my "C:\" ? Why do the following: MS Visual Studio, wxWindows, Borland C++, Stingray Objective Studio, ARM SDT, etc. like to install source code to the "C:\" drive?
0
1505
by: wilsonchan1000 | last post by:
There is a note regarding this error in UDB. I eventually found a solution and want to share with all or you. Problem occur with connect to db2 server: SQLCODE : -332 SQL0332N There is no available conversion for the source code page "1114" to
1
5646
by: Randy | last post by:
Hello All, I've got an app which performs a simple query to a web service and stores the returning data in a DataSet. The first time through it works find and as expected. The problem is that the second time I step through and I step on the line myDataAdapter1.Fill(tempds); I get the IDE error... "There is no source code available for the current location". If I run the app (not under the debugger) I get no error messages but this...
6
1612
by: swartzbill2000 | last post by:
Hello, I have some downloaded source code on my machine that the .net framework thinks is "not fully trusted". How can I fix this? I assume I use the 'Microsoft .NET Framework 1.1 Configuration' in some way. Bill
3
12015
by: nan | last post by:
Hi All, I am trying to connect the Database which is installed in AS400 using DB2 Client Version 8 in Windows box. First i created the Catalog, then when i selected the connection type as ODBC, then i am getting
4
6127
by: The Grue - James T. Sprinkle | last post by:
Does anyone know where I can download the source code to accompany PJ Plauger's book "The Standard C Library"? I find a lot of references for the library, but not the actual source code from the book. Any help would be appreciated! The Grue
2
2376
by: Ole Mercano | last post by:
When I create in Designer a new button on my Form it is automatically named e.g. "button1". When I doubleclick on it I am directed to the Form.cs where the following procedure is automatcially generated: private void button1_Click(Object sender, EventArgs e) { } To improve readability I want to rename now "button1" to "but_change_set".
2
3997
by: Deniz Dogan | last post by:
Hello. I am writing a program which has to send a signal (SIGUSR2 F.Y.I.) to a certain process, which I only know the name of, i.e. I need the PID for that process. How can I do this in C or C++? Also, I want to know where I can find the source code for the "pgrep" program. Thanks in advance.
0
1648
by: Bobzilla | last post by:
Ok, so I've looked around and I can't seem to find an answer to my specific question, so here goes... I am using VS 2003 and I have a solution with code and all that I am steping through. When I get to a certain spot I get the "There is no source code available for the current location." error, which I completely expect because it is a dll. My issue is that I have the source code for the dll and I was wondering if there was a way to...
0
8964
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9463
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8202
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4562
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2740
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.