Snippet behavior in C# Express
I am new to C# Express and can't seem to get the snippets to work in files that are part of a project. If I open a .cs file by itself, that is, not as part of a project, then the snippets work fine. However, if I open the same file as part of a project, then the snippets won't work.
Let's say I want to code a "for" loop. In the stand-alone .cs file, I can type "for" then TAB and I get the skeleton of the for loop structure. Inside a project, when I type "for" I get a list showing lots of stuff that starts with "for" and if I click on "for" or type it and hit TAB, nothing happens except that the list closes. THere is even a tool tip that is displayed telling me the item selected in the list is a snippet for the "for" loop, but still no code is added to my file.
Anybody else encountered this or have an idea on how to get it working?
[850 byte] By [
LTR] at [2008-2-23]
It takes two tabs to get the snippet inside C#. Its already been posted as a documentation bug in the product feedback center.
[ http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=15a8e5ce-16cd-48cc-9382-a5676d14636c ]
If you have a file in context of a project it takes 2 tabs to generate the snippet. So type for and press tab key 2 times and have you snip generated.
Although you might want to file a bug, to indicate different functionality in the context of a project and without the context of a project.
Regards,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com
LTR -
The reason you see the difference in behavior for how to insert a snippet with and without a project is because the first tab (or any other completion key such as enter) is used to complete the item in the completion list which comes up when you have a project. The second tab is used to expand the snippet. When you do not have a project, we are simply using the tab to expand the snippet. This behavior is by design since we wanted to have a consistent model for completing items with IntelliSense. The first action will commit the selection and dismiss the list, and the second action (tab here) will expand the snippet.
Thanks,
Karen Liu
Visual C#