View Issue Details

IDProjectCategoryView StatusLast Update
0002561NoesisGUIVSCodepublic2023-05-10 11:54
Reporterjsantos Assigned Tomaherne  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.0 
Target Version3.2.1Fixed in Version3.2.1 
Summary0002561: Support for snippets
DescriptionThe standard support for snippets in VsCode is not good enough because it polutes the suggestions of properties.

We need to find a way to suggest snippets only when we are outside a node.
TagsNo tags attached.
PlatformAny

Activities

jsantos

jsantos

2023-04-11 14:19

manager   ~0008413

Last edited: 2023-04-11 14:20

Attaching the snippets (still work in progress) I have been playing with these days.
xaml.json (7,457 bytes)   
{
    "File Template for XAML": {
        "prefix": "root",
        "isFileTemplate": true,
        "body": [
            "<Grid xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">",
            "  $0",
            "</Grid>"
        ]
    },
    "Button for XAML": {
        "prefix": "button",
        "body": "<Button Width=\"120\" Height=\"50\" Content=\"${1:Button}\" Margin=\"5\" />"
    },
    "CheckBox for XAML": {
        "prefix": "check",
        "body": "<CheckBox Width=\"120\" Height=\"50\" Content=\"${1:CheckBox}\" IsChecked=\"${2:True}\" Margin=\"5\" />"
    },
    "RadioButton for XAML": {
        "prefix": "radio",
        "body": "<RadioButton Width=\"120\" Height=\"50\" Content=\"${1:RadioButton}\" IsChecked=\"${2:True}\" Margin=\"5\" />"
    },
    "Label for XAML": {
        "prefix": "label",
        "body": "<Label Content=\"${1:Label}\" FontSize=\"30\" Margin=\"5\" Foreground=\"OrangeRed\" />"
    },
    "TextBlock for XAML": {
        "prefix": "text",
        "body": "<TextBlock Text=\"${1:TextBlock}\" FontSize=\"30\" Margin=\"5\" Foreground=\"OrangeRed\" />"
    },
    "TextBox for XAML": {
        "prefix": "textbox",
        "body": "<TextBox Height=\"40\" Text=\"${1:TextBox}\" Margin=\"5\" />"
    },
    "ListBox for XAML": {
        "prefix": "list",
        "body": "<ListBox ItemsSource=\"$1\" SelectedIndex=\"0\" Margin=\"5\" />"
    },
    "ListBox>ListBoxItem for XAML": {
        "prefix": "list>li",
        "body": [
            "<ListBox SelectedIndex=\"0\" Margin=\"5\">",
            "   <ListBoxItem Content=\"${1:item1}\" />$2",
            "</ListBox>",
        ]
    },
    "ComboBox for XAML": {
        "prefix": "combo",
        "body": "<ComboBox Height=\"40\" ItemsSource=\"$1\" SelectedIndex=\"0\" Margin=\"5\" />"
    },
    "ComboBox>ComboBoxItem for XAML": {
        "prefix": "combo>ci",
        "body": [
            "<ComboBox Height=\"40\" SelectedIndex=\"0\" Margin=\"5\">",
            "  <ComboBoxItem Content=\"${1:item1}\" />$2",
            "</ComboBox>",
        ]
    },
    "Border for XAML": {
        "prefix": "border",
        "body": "<Border BorderBrush=\"${1:Black}\" BorderThickness=\"1\" Height=\"100\" Width=\"100\" />"
    },
    "Rectangle for XAML": {
        "prefix": "rect",
        "body": [
            "<Rectangle Width=\"300\" Height=\"200\" Margin=\"5\" Fill=\"Red\" />",
        ],
    },
    "Rectangle>Fill for XAML": {
        "prefix": "rect>fill",
        "body": [
            "<Rectangle Width=\"300\" Height=\"200\" Margin=\"5\" >",
            "  <Rectangle.Fill>",
            "     $0",
            "  </Rectangle.Fill>",
            "</Rectangle>",
        ],
    },
    "Ellipse for XAML": {
        "prefix": "ellipse",
        "body": [
            "<Ellipse Width=\"300\" Height=\"300\" Margin=\"5\" Fill=\"Red\" />",
        ],
    },
    "Ellipse>Fill for XAML": {
        "prefix": "ellipse>fill",
        "body": [
            "<Ellipse Width=\"300\" Height=\"300\" Margin=\"5\" >",
            "  <Ellipse.Fill>",
            "     $0",
            "  </Ellipse.Fill>",
            "</Ellipse>",
        ],
    },
    "Path for XAML": {
        "prefix": "path",
        "body": [
            "<Path Stroke=\"Black\" Fill=\"Gray\" Data=\"M 10,100 C 10,300 300,-200 300,100\" />",
        ],
    },
    "StackPanel for XAML": {
        "prefix": "stack",
        "body": [
            "<StackPanel>",
            "${TM_SELECTED_TEXT:  <Ellipse Width=\"50\" Height=\"50\" Margin=\"5\" Fill=\"YellowGreen\" />}",
            "</StackPanel>",
        ]
    },
    "StackPanel>Button*3 for XAML": {
        "prefix": "stack>button*3",
        "body": [
            "<StackPanel>",
            "  <Button Content=\"Button1\" Margin=\"5,5,5,0\" />",
            "  <Button Content=\"Button2\" Margin=\"5,5,5,0\" />",
            "  <Button Content=\"Button3\" Margin=\"5,5,5,0\" />$1",
            "</StackPanel>",
        ]
    },
    "Horizontal StackPanel for XAML": {
        "prefix": "stackh",
        "body": [
            "<StackPanel Orientation=\"Horizontal\">",
            "${TM_SELECTED_TEXT:  <Ellipse Width=\"50\" Height=\"50\" Margin=\"5\" Fill=\"YellowGreen\" />}",
            "</StackPanel>",
        ]
    },
    "Horizontal StackPanel>Button*3 for XAML": {
        "prefix": "stackh>button*3",
        "body": [
            "<StackPanel Orientation=\"Horizontal\">",
            "  <Button Content=\"Button1\" Margin=\"5,5,0,5\" />",
            "  <Button Content=\"Button2\" Margin=\"5,5,0,5\" />",
            "  <Button Content=\"Button3\" Margin=\"5,5,0,5\" />$1",
            "</StackPanel>",
        ]
    },
    "Grid for XAML": {
        "prefix": "grid",
        "body": [
            "<Grid>",
            "  $1",
            "</Grid>",
        ]
    },
    "Grid>Rectangle*4 for XAML": {
        "prefix": "grid>rect*4",
        "body": [
            "<Grid Width=\"400\" Height=\"400\" >",
            "  <Grid.ColumnDefinitions>",
            "    <ColumnDefinition Width=\"100\" />",
            "    <ColumnDefinition Width=\"*\" />",
            "  </Grid.ColumnDefinitions>",
            "  <Grid.RowDefinitions>",
            "    <RowDefinition Height=\"50\" />",
            "    <RowDefinition Height=\"*\" />",
            "    <RowDefinition Height=\"50\" />",
            "  </Grid.RowDefinitions>",
            "  <Rectangle Grid.Row=\"0\" Grid.Column=\"0\" Grid.ColumnSpan=\"2\" Fill=\"YellowGreen\" />",
            "  <Rectangle Grid.Row=\"1\" Grid.Column=\"0\" Fill=\"Gray\" />",
            "  <Rectangle Grid.Row=\"1\" Grid.Column=\"1\" Fill=\"Silver\" />",
            "  <Rectangle Grid.Row=\"2\" Grid.Column=\"0\" Grid.ColumnSpan=\"2\" Fill=\"Orange\" />",
            "</Grid>"
        ],
    },
    "WrapPanel for XAML": {
        "prefix": "wrap",
        "body": [
            "<WrapPanel>",
            "  $1",
            "</WrapPanel>",
        ]
    },
    "DockPanel for XAML": {
        "prefix": "dock",
        "body": [
            "<DockPanel>",
            "  $1",
            "</DockPanel>",
        ]
    },
    "Canvas for XAML": {
        "prefix": "canvas",
        "body": [
            "<Canvas>",
            "  $1",
            "</Canvas>"
        ],
    },
    "Canvas>Rectangle*3 for XAML": {
        "prefix": "canvas>rect*3",
        "body": [
            "<Canvas>",
            "  <Rectangle Canvas.Left=\"200\" Canvas.Top=\"100\" Width=\"300\" Height=\"300\" Fill=\"YellowGreen\" />",
            "  <Rectangle Canvas.Left=\"230\" Canvas.Top=\"130\" Width=\"200\" Height=\"200\" Fill=\"Gold\" />",
            "  <Rectangle Canvas.Left=\"250\" Canvas.Top=\"150\" Width=\"100\" Height=\"100\" Fill=\"Orange\" />",
            "</Canvas>"
        ],
    },
    "Linear Gradient for XAML": {
        "prefix": "linear",
        "body": [
            "<LinearGradientBrush StartPoint=\"0,0\" EndPoint=\"1,0\">",
            "  <GradientStop Color=\"Gold\" Offset=\"0\" />",
            "  <GradientStop Color=\"DarkOrange\" Offset=\"1\" />",
            "</LinearGradientBrush>"
        ],
    },
    // BUG with GradientOrigin="0.5,0"
    "Radial Gradient for XAML": {
        "prefix": "radial",
        "body": [
            "<RadialGradientBrush>",
            "  <GradientStop Color=\"Gold\" Offset=\"0\"/>",
            "  <GradientStop Color=\"DarkOrange\" Offset=\"1\"/>",
            "</RadialGradientBrush>"
        ],
    },
}
xaml.json (7,457 bytes)   

Issue History

Date Modified Username Field Change
2023-04-11 14:19 jsantos New Issue
2023-04-11 14:19 jsantos Assigned To => maherne
2023-04-11 14:19 jsantos Status new => assigned
2023-04-11 14:19 jsantos Target Version => 3.2.1
2023-04-11 14:19 jsantos Note Added: 0008413
2023-04-11 14:19 jsantos File Added: xaml.json
2023-04-11 14:20 jsantos Note Edited: 0008413
2023-05-10 00:14 jsantos Target Version 3.2.1 => 3.2.2
2023-05-10 11:17 maherne Status assigned => resolved
2023-05-10 11:17 maherne Resolution open => fixed
2023-05-10 11:17 maherne Fixed in Version => 3.2.1
2023-05-10 11:54 jsantos Target Version 3.2.2 => 3.2.1