From c613f8c9b00bca431453febcea1b3cfe5f2a7957 Mon Sep 17 00:00:00 2001 From: Stefan Ivemo Date: Tue, 31 Aug 2021 20:04:34 +0200 Subject: [PATCH] [Snippet] Added Route Server snippet (#3976) * Added route server snippet --- .../Files/Completions/declarations.json | 29 +++++++++++++++++++ .../res-route-server/main.bicep | 6 ++++ .../res-route-server/main.combined.bicep | 23 +++++++++++++++ .../Snippets/Templates/res-route-server.bicep | 18 ++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep create mode 100644 src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep diff --git a/src/Bicep.Core.Samples/Files/Completions/declarations.json b/src/Bicep.Core.Samples/Files/Completions/declarations.json index 86607c356f5..a14cddb5a75 100644 --- a/src/Bicep.Core.Samples/Files/Completions/declarations.json +++ b/src/Bicep.Core.Samples/Files/Completions/declarations.json @@ -2100,6 +2100,35 @@ ] } }, + { + "label": "res-route-server", + "kind": "snippet", + "detail": "Route Server", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n sku: 'Standard'\n }\n}\n\nresource ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = {\n name: 'name'\n parent: virtualHub\n properties: {\n subnet: {\n id: 'subnet.id'\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-route-server", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = {\n name: ${1:'name'}\n location: resourceGroup().location\n properties: {\n sku: 'Standard'\n }\n}\n\nresource ${2:ipConfiguration} 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = {\n name: ${3:'name'}\n parent: virtualHub\n properties: {\n subnet: {\n id: ${4:'subnet.id'}\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-route-server" + } + } + ] + } + }, { "label": "res-route-table", "kind": "snippet", diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep new file mode 100644 index 00000000000..564e0675b23 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep @@ -0,0 +1,6 @@ +// $1 = 'name' +// $2 = ipConfiguration +// $3 = 'name' +// $4 = 'subnet.id' + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep new file mode 100644 index 00000000000..a443d590190 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep @@ -0,0 +1,23 @@ +// $1 = 'name' +// $2 = ipConfiguration +// $3 = 'name' +// $4 = 'subnet.id' + +resource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = { + name: 'name' + location: resourceGroup().location + properties: { + sku: 'Standard' + } +} + +resource ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = { + name: 'name' + parent: virtualHub + properties: { + subnet: { + id: 'subnet.id' + } + } +} +// Insert snippet here diff --git a/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep b/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep new file mode 100644 index 00000000000..af4d24faf2b --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep @@ -0,0 +1,18 @@ +// Route Server +resource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = { + name: /*${1:'name'}*/'name' + location: resourceGroup().location + properties: { + sku: 'Standard' + } +} + +resource /*${2:ipConfiguration}*/ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = { + name: /*${3:'name'}*/'name' + parent: virtualHub + properties: { + subnet: { + id: /*${4:'subnet.id'}*/'subnet.id' + } + } +}