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: 103)
#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!
#8
LA ver1.3

##1 After importing the #1 file from the desktop, the results are shown in the figure below.(I have a large number of code snippets in this format that need to be converted.)
PS.: It would be more convenient if drag-and-drop is supported.
https://i.ibb.co/N6zyW5d/A.png

##2 As shown in the figure below, how can I change the text color and background color of custom fields? I couldn't find the option in the color settings.
When the field is not focused: Background color should be green, and text color should be black.
When the field is focused: Background color should be light blue, and text color should be white.
https://i.ibb.co/6Prmcr6/B.png

##3 Suggestion: As shown in the figure below, add a menu item to the context menu of the code snippet details that allows directly opening the code snippet editing dialog.
https://i.ibb.co/rFxwpK4/C.png
#9
1. Probably the file isn't a Visual Studio or VSCode snippets file. If it is, please post it (attach).

2. In next LA. Also fixed bug "mixed color".

3. In next LA it will be a link.
#10
Quote:1. Probably the file isn't a Visual Studio or VSCode snippets file. If it is, please post it (attach).

I can't confirm if it's a VSCode snippets file file. It might be a file format for ActiPro SyntaxEditor snippets. Is there any way to convert it easily?

https://www.libreautomate.com/forum/atta...p?aid=1312
#11
It is a VS snippet, but LA expects the code language attribute in it to be "csharp" (like in default VS snippets), and does not import if it is "CSharp". Fixed in next LA (soon).
#12
I want to change the font color as shown in the image below:
- When activated: the font color is white. (When the field is activated, displaying the text color as white makes it more noticeable.)
- When not activated: the font color is black.
https://i.ibb.co/thZ5dp8/A.gif

When the fu_Function.snippet file is used in LINQPad, the abbreviation for the code snippet is displayed as "fu" which is exactly what I defined.
However, after importing it into LA, the abbreviation for the code snippet is displayed as "fuSnippet" as shown in the image below.
https://i.ibb.co/H4XWZN0/fu2.png
https://i.ibb.co/4Fq9vqQ/fu.png
Displaying it as "fu" is more appropriate because the comment text "//snippets" is already included.
https://i.ibb.co/721PnxD/fu3.png
#13
1. Will not add this feature. Only background color can be changed.

2. Edit Name it in the Snippets window.
#14
Quote:2. Edit Name it in the Snippets window.
I have imported a large number of code snippets, and manually modifying them is very time-consuming. In the file definition, the abbreviations are as follows:
https://i.ibb.co/dkvp9g7/fu4.png
#15
Or edit the imported snippets file in a text editor. Find-replace "Snippet" in "name" attribute.


Forum Jump:


Users browsing this thread: 8 Guest(s)