Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
about snippet
#1
I'm accustomed to the following workflow: using the Tab key to navigate between multiple parameters and using the Enter key to move to the end position. Below is a snippet of code from LINQPad and its usage effect

1.In the LA code snippet definition window, it supports dragging and dropping LINQPad code snippet files and converts them into LA code snippets

https://i.ibb.co/F0CbyNP/lp7.gif
https://i.ibb.co/74rYJ1Z/sps.gif

2. Enable editing of built-in default code snippets. Currently, they cannot be edited, but sometimes I need to make modifications to the code.

3. In the pop-up list of code snippets, right-clicking should display a menu item: Edit, similar to the functionality in QM. Clicking on it should directly open the editing window for that item.
 
Code:
Copy      Help
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Function</Title>
            <Shortcut>fu</Shortcut>
            <Description>Creates a function</Description>
            <Author></Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal Editable="True">
                    <ID>functionname</ID>
                    <ToolTip>Enter the function's name</ToolTip>
                    <Function></Function>
                    <Default>functionname</Default>
                </Literal>
                <Literal Editable="True">
                    <ID>parameter1</ID>
                    <ToolTip>Enter parameter1's name 3</ToolTip>
                    <Function></Function>
                    <Default>parameter1</Default>
                </Literal>
                <Literal Editable="True">
                    <ID>parameter2</ID>
                    <ToolTip>Enter parameter2's name</ToolTip>
                    <Function></Function>
                    <Default>parameter2</Default>
                </Literal>
            </Declarations>
            <Code Language="CSharp">
                <![CDATA[void $functionname$ (string $parameter1$, int $parameter2$) {
    $selected$$end$
}]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>



Attached Files
.zip   fu_Function.zip (Size: 608 bytes / Downloads: 20)
#2
2. You can clone a default snippet and edit the clone. The clone can have the same name. The intellisense list will contain both, but the clone will be the first. To clone: Right-click the default snippet; select Copy; paste somewhere.

Bug: cannot hide default snippets (can uncheck but it does not work). Will be fixed in next LA.
#3
4.Support for adding assembly references, just like in the picture below.
https://i.ibb.co/C98Qrzd/a.png
#4
4. Probably will not add this feature. Rarely used. This Visual Studio snippet feature was more useful in the past, with the old .NET framework, when needed to add references to .NET framework assemblies (now don't need).

Instead you can use the Print field to remind that this snippet requires some /*/ options /*/ or other code.
#5
#4
Yes, that's the idea. It would be more convenient if it automatically checks(/*/ options /*/) and adds references.
#6
4. In next LA snippets can add /*/ anything /*/, not only r. For example c, nuget.
#7
thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)