Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

OT: VisualStudio question

May
12,846
164
I like all types, including struct names, colored in VS. So I made an external tool to put keywords into usertype.dat.

Code:
Command: g:\tc15\tcc.exe
Args: /c echo %@unquote[$(CurText)] >> l:\vs10\common7\ide\usertype.dat
In the IDE, I select some text, say FILE_STANDARD_INFO, and execute the tool. What winds up in the file is:
Code:
v:\> tail /n3 l:\vs10\Common7\IDE\usertype.dat
BROWSEINFO
PIDLIST_ABSOLUTE
"FILE_STANDARD_INFO"

It's quoted! @UNQUOTE[] does work. How could that possibly happen? [I'm not crazy. I've tested this many times.]

Any ideas?

And to make it even stranger, if I quote it myself, changing the args to
Code:
/c echo %@unquote["$(CurText)"] >> l:\vs10\common7\ide\usertype.dat
it works as desired!
 
Well, I see what's happening and it looks like shabby programming. Suppose the current text is "abc" (without the quotes). If there are no quotes in the token containing $(CurText), DevStudio adds quotes around the whole token. So
Code:
%@unquote[$(CurText)]
turns into
Code:
"%@unquote[abc]"
and
Code:
%@unquote[$(CurText) ] (note the space)
turns into
Code:
"%@unquote[abc" ]

If there are matching quotes (containing, not necessarily only, the metavariable) it leaves the token alone.
 

Similar threads

Back
Top