Author |
Message |
pvdm
Joined: 11 Mar 2008 Posts: 22 Country: New Zealand |
|
Code snippet comments |
|
We would like to create Visual Studio style comments on all of our stored procedures and I thought that it would be a good idea to use the code snippets to generate the comment structure, but I have 2 problems.
1. I need a line like this for each parameter
<param name="@param1"></param> but I can not get the "(double quote) to work properly so I am now using the single quote
2. After each line the macro inserts a comma.
My code snippet looks like this:
/*
<summary>
</summary>
"<param name='"$ARGS_V$'></param>
<remarks></remarks>
<returns></returns>
*/
But my output looks like this:
/*
<summary>
</summary>
<param name='@param1'></param>, <-- Notice the "," and single quotes around @param1
<param name='@param2'></param>,
<param name='@param3'></param>,
<param name='@param4'></param>
<remarks></remarks>
<returns></returns>
*/
Is there any way to get it to work properly?
|
|
Mon Mar 16, 2009 8:45 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7951
|
|
|
|
Well, it is indeed working properly and generating technically correct results. It is not generating what you want because you are likely unaware of the special use of macro-variables suffixes and prefixes and especially the use of double quotes for enclosing suffixes and prefixes containing spaces.
$ARGS_V$ - by definition generates vertical list of COMMA-SEPARATED arguments. By vertical, I mean end-of-line symbol added after each comma.
Anything specified immediately before a macro-variable name is a prefix that is repeated for every value and output before each element. In your case it is ""<param name='"" note that I'm enclosing the entire prefix in double quotes so you can see the effective value.
Anything specified immediately after a macro-variable name is a suffix that is repeated for every value and output after each element. In your case it is "'></param>"
The result of your snippet is correct, even though it is not exactly what you want.
Please note that there are currently no macro-variables available for procedure arguments which will not output them as a comma-separated list so that there is no way to get around that. On the other hand, you already got as close as possible to what you wanted. I don't think you can make it any better.
|
|
Mon Mar 16, 2009 10:22 pm |
|
 |
pvdm
Joined: 11 Mar 2008 Posts: 22 Country: New Zealand |
|
|
|
Thanks.
I was not implying that the code snippets wasn't working properly, just thought there might be another way maybe some secret undocumented macros to get it to do what I wanted ;)
|
|
Mon Mar 16, 2009 10:35 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7951
|
|
|
|
Sorry, all currently available macros are in the list already. We are planning on developing more macros and making them available in v5.x
|
|
Mon Mar 16, 2009 10:46 pm |
|
 |
|