Expanding multi-line snippet adds extra line at the bottom
Asked Answered
I

1

14

Is there any way to prevent the addition of an extra line below a multi-line snippet in VB.NET?

enter image description here

(hit tab key to expand snippet...)

enter image description here

I've double checked that the snippet itself does not have an extra line at the end. Also, this seems to be VB-specific.

Infrequent answered 10/4, 2014 at 14:16 Comment(3)
social.msdn.microsoft.com/Forums/vstudio/en-US/…Embonpoint
That's the default behavior I think.Arv
@PradeepKumar -- Why do you think that? Any why would that be preferable behavior?Infrequent
H
1

Just close the ]] after the end of your snipped. The ¿end¿ part sets the caret at this position after inserting the snipped.

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets 
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>tryt</Title>
      <Author>[USERNAME]</Author>
      <Description>
      </Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>tryt</Shortcut>
    </Header>
    <Snippet>
      <Code Language="vb" Delimiter="¿"><![CDATA[Try

            ¿end¿

        Catch ex As Exception
            Throw New Exception(ex) 'or do some other stuff
        End Try]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
Hook answered 8/5, 2018 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.