snippets not recognizing XML attributes

I am creating several C# code snippets, and I have been trying to take advantage of the ability to set a 'Kind' property on the code within the snippet XML, which, based on my understanding, should constrain the use of the snippet to particular contexts (such as whether or not it can be inserted inside a method body, whether it is a standalone method itself, etc.). For example,

<Code Language="CSharp" Kind="method decl">

<![CDATA[

// code goes here...

]]>

</Code>

In the above snippet XML, the 'Kind' property is indicating that the code inside the <![CDATA[]]> tag is a method, and should therefore be inserted at the class level. However, once I have imported my custom snippet into the code snippet manager, I am able to add this snippet anwhere in my code (which I do not want). I only want the user to be able to add this snippet at the class level where it makes sense, not to be able to add this method inside another method or some other place where it does not belong. Does this make sense Does C# not properly recognize this property for some reason I have tried using the other 'Kind' values to test if these work, but these are not working as I originally expected either. Thanks in advance for any help.



Answer this question

snippets not recognizing XML attributes

  • msdnjw

    The kind attribute was added to allow us to filter snippets from the UI based on where they could be inserted. During the product cycle, code support for the kind attribute was actually cut. The property is available should a third party language implementing code snippets wish to filter them out for a given context.

    Thanks,
    Sean Laberee



  • DigiVix

    Thanks Sean. This answers my question.
  • snippets not recognizing XML attributes