Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expanding multi-line snippet adds extra line at the bottom

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.

like image 484
rory.ap Avatar asked Apr 10 '14 14:04

rory.ap


People also ask

How do I create a multiline snippet in VSCode?

press ctrl + shift + P and type "Create snippet" on the command palette and press ENTER. snippet name, type snippet shortcut and then type snippet description. You are now good to go.

How do you make a VS code snippet?

To create or edit your own snippets, select User Snippets under File > Preferences (Code > Preferences on macOS), and then select the language (by language identifier) for which the snippets should appear, or the New Global Snippets file option if they should appear for all languages.

How do you use a snippet?

You can also insert a snippet when logging an activity or leaving a comment on a record using the HubSpot mobile app for Android. There are two ways to add a snippet: Type the # symbol into the text editor. Start typing the snippet shortcut, then select the snippet from the dropdown menu.


1 Answers

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>
like image 56
Horitsu Avatar answered Nov 09 '22 23:11

Horitsu