Home

Snippets not working in autocompletion

I created a snipped through Edit -> Autocompletion -> Create New Code Snippet.

If I do Edit -> Autocompletion -> Insert Snippet the snippet shows up just fine.

When I try and type the name of my snippet I can see in in the autocompletion list and the tooltip says (code snippet - press TAB). I press tab and the text name completes, but my snippet doesn't show up.

Am I doing something wrong or do I have wrong expectations here?

Comments

  • Does your snippet contain code, or just namespaces/references?
  • Code. Here is the file.

    <?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>CsvHelper_CsvReader</Title> <Description>CsvHelper_CsvReader</Description> <Shortcut>CsvHelper_CsvReader</Shortcut> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Imports> <Import> <Namespace>CsvHelper</Namespace> </Import> <Import> <Namespace>CsvHelper.Configuration</Namespace> </Import> <Import> <Namespace>CsvHelper.TypeConversion</Namespace> </Import> </Imports> <Code Language="CSharp"><![CDATA[void Main() { using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream)) using (var reader = new StreamReader(stream)) using (var csv = new CsvReader(reader)) { writer.WriteLine("Id,Name"); writer.WriteLine("1,one"); writer.Flush(); stream.Position = 0; csv.Configuration.RegisterClassMap<TestMap>(); csv.GetRecords<Test>().Dump(); } } public class Test { public int Id { get; set; } public string Name { get; set; } } public sealed class TestMap : CsvClassMap<Test> { public TestMap() { Map( m => m.Id ); Map( m => m.Name ); } } ]]>



  • I see the problem: it doesn't like the underscore in the shortcut. I'll fix in the next build. In the meantime, you can work around this by removing the underscore.
Sign In or Register to comment.