From 4c47538f86c8a14f13ddf9680fa948f2eb03cda5 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Thu, 5 Aug 2021 10:09:38 +0200 Subject: [PATCH 1/5] ExpressRoute Gateway snippet --- .../res-expressroute-gateway/main.bicep | 7 ++++++ .../main.combined.bicep | 24 +++++++++++++++++++ .../Templates/res-expressroute-gateway.bicep | 16 +++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.bicep create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep create mode 100644 src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.bicep new file mode 100644 index 00000000000..dfad39c7a71 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.bicep @@ -0,0 +1,7 @@ +// $1 = expressRouteGateways +// $2 = 'name' +// $3 = 'virtualHub.id' +// $4 = 1 +// $5 = 2 + +// Insert snippet here diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep new file mode 100644 index 00000000000..50a5a8367e8 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep @@ -0,0 +1,24 @@ +// $1 = expressRouteGateways +// $2 = 'name' +// $3 = 'virtualHub.id' +// $4 = 1 +// $5 = 2 + +resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { + name: 'name' + location: resourceGroup().location + properties: { + virtualHub: { + id: 'virtualHub.id' + } + autoScaleConfiguration: { + bounds: { + min: 1 + max: 2 + } + } + } +} + +// Insert snippet here + diff --git a/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep b/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep new file mode 100644 index 00000000000..609d1755ba8 --- /dev/null +++ b/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep @@ -0,0 +1,16 @@ +// ExpressRoute Gateway +resource /*${1:expressRouteGateways}*/ expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { + name: /*${2:'name'}*/ 'name' + location: resourceGroup().location + properties: { + virtualHub: { + id: /*${3:'virtualHub.id'}*/'virtualHub.id' + } + autoScaleConfiguration: { + bounds: { + min: /*${4|1,2,3,4,5,6,7,8|}*/1 + max: /*${5|1,2,3,4,5,6,7,8|}*/2 + } + } + } +} From cacb3cd2f0ef9406e88a86f6bb11568ae8bb8e77 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Fri, 6 Aug 2021 21:49:57 +0200 Subject: [PATCH 2/5] removed blankspaece --- .../Snippets/Templates/res-expressroute-gateway.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep b/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep index 609d1755ba8..91c8c41d0e5 100644 --- a/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep +++ b/src/Bicep.LangServer/Snippets/Templates/res-expressroute-gateway.bicep @@ -1,6 +1,6 @@ // ExpressRoute Gateway -resource /*${1:expressRouteGateways}*/ expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { - name: /*${2:'name'}*/ 'name' +resource /*${1:expressRouteGateways}*/expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { + name: /*${2:'name'}*/'name' location: resourceGroup().location properties: { virtualHub: { From 997511a57a3a49f33264131406fcb302c0ba3d9c Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Fri, 6 Aug 2021 21:51:37 +0200 Subject: [PATCH 3/5] removed blank line --- .../res-expressroute-gateway/main.combined.bicep | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep index 50a5a8367e8..7f684dd7e7e 100644 --- a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep @@ -19,6 +19,5 @@ resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01 } } } - // Insert snippet here From e0767a055d30591e9f7269483cab7250b5bb1253 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Fri, 6 Aug 2021 21:55:04 +0200 Subject: [PATCH 4/5] SetBaseline --- .../Files/Completions/declarations.json | 29 ++++++++++++++++++ .../main.combined.bicep | 30 +++++++++---------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/src/Bicep.Core.Samples/Files/Completions/declarations.json b/src/Bicep.Core.Samples/Files/Completions/declarations.json index 22ce1892f65..d6c151122f8 100644 --- a/src/Bicep.Core.Samples/Files/Completions/declarations.json +++ b/src/Bicep.Core.Samples/Files/Completions/declarations.json @@ -1172,6 +1172,35 @@ ] } }, + { + "label": "res-expressroute-gateway", + "kind": "snippet", + "detail": "ExpressRoute Gateway", + "documentation": { + "kind": "markdown", + "value": "```bicep\nresource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = {\n name: 'name'\n location: resourceGroup().location\n properties: {\n virtualHub: {\n id: 'virtualHub.id'\n }\n autoScaleConfiguration: {\n bounds: {\n min: 1\n max: 1\n }\n }\n }\n}\n\n```" + }, + "deprecated": false, + "preselect": false, + "sortText": "2_res-expressroute-gateway", + "insertTextFormat": "snippet", + "insertTextMode": "adjustIndentation", + "textEdit": { + "range": {}, + "newText": "resource ${1:expressRouteGateways} 'Microsoft.Network/expressRouteGateways@2021-02-01' = {\n name: ${2:'name'}\n location: resourceGroup().location\n properties: {\n virtualHub: {\n id: ${3:'virtualHub.id'}\n }\n autoScaleConfiguration: {\n bounds: {\n min: ${4|1,2,3,4,5,6,7,8|}\n max: ${5|1,2,3,4,5,6,7,8|}\n }\n }\n }\n}\n" + }, + "command": { + "command": "bicep.Telemetry", + "arguments": [ + { + "EventName": "TopLevelDeclarationSnippetInsertion", + "Properties": { + "name": "res-expressroute-gateway" + } + } + ] + } + }, { "label": "res-firewall", "kind": "snippet", diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep index 7f684dd7e7e..da5b45b78f2 100644 --- a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep @@ -4,20 +4,20 @@ // $4 = 1 // $5 = 2 -resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { - name: 'name' - location: resourceGroup().location - properties: { - virtualHub: { - id: 'virtualHub.id' - } - autoScaleConfiguration: { - bounds: { - min: 1 - max: 2 - } - } - } -} +resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { + name: 'name' + location: resourceGroup().location + properties: { + virtualHub: { + id: 'virtualHub.id' + } + autoScaleConfiguration: { + bounds: { + min: 1 + max: 2 + } + } + } +} // Insert snippet here From 9ba8c884e1e66e18eecd18440a95adb0a9ccf673 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Fri, 6 Aug 2021 22:11:55 +0200 Subject: [PATCH 5/5] removed blank line --- .../res-expressroute-gateway/main.combined.bicep | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep index da5b45b78f2..09286659a3d 100644 --- a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-expressroute-gateway/main.combined.bicep @@ -1,9 +1,9 @@ -// $1 = expressRouteGateways -// $2 = 'name' -// $3 = 'virtualHub.id' -// $4 = 1 -// $5 = 2 - +// $1 = expressRouteGateways +// $2 = 'name' +// $3 = 'virtualHub.id' +// $4 = 1 +// $5 = 2 + resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01' = { name: 'name' location: resourceGroup().location @@ -19,5 +19,4 @@ resource expressRouteGateways 'Microsoft.Network/expressRouteGateways@2021-02-01 } } } -// Insert snippet here - +// Insert snippet here