From c7e2c0304b80c9b3d35fec84d78ef41ddb016b9c Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Tue, 10 Aug 2021 21:32:33 +0200 Subject: [PATCH 1/4] Added route server snippet --- .../res-route-server/main.bicep | 6 ++++++ .../Snippets/Templates/res-route-server.bicep | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep create mode 100644 src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep 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..84a997fc4d5 --- /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/Snippets/Templates/res-route-server.bicep b/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep new file mode 100644 index 00000000000..bd0b298949f --- /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' + } + } +} From ee12695f2bd014016af302356ae4732de42c44c2 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Tue, 10 Aug 2021 21:38:11 +0200 Subject: [PATCH 2/4] Updated resource identifier --- .../Completions/SnippetTemplates/res-route-server/main.bicep | 2 +- src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 index 84a997fc4d5..564e0675b23 100644 --- a/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.bicep @@ -1,5 +1,5 @@ // $1 = 'name' -// $2 = 'ipConfiguration' +// $2 = ipConfiguration // $3 = 'name' // $4 = 'subnet.id' diff --git a/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep b/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep index bd0b298949f..af4d24faf2b 100644 --- a/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep +++ b/src/Bicep.LangServer/Snippets/Templates/res-route-server.bicep @@ -7,7 +7,7 @@ resource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = { } } -resource /*${2:'ipConfiguration'}*/ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = { +resource /*${2:ipConfiguration}*/ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02-01' = { name: /*${3:'name'}*/'name' parent: virtualHub properties: { From 2ba310156833d9d708068b537efc3e951b0eaa92 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Tue, 10 Aug 2021 22:00:29 +0200 Subject: [PATCH 3/4] Set Baseline --- .../Files/Completions/declarations.json | 29 +++++++++++++++++++ .../res-route-server/main.combined.bicep | 24 +++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep diff --git a/src/Bicep.Core.Samples/Files/Completions/declarations.json b/src/Bicep.Core.Samples/Files/Completions/declarations.json index 22ce1892f65..2c85f19f50d 100644 --- a/src/Bicep.Core.Samples/Files/Completions/declarations.json +++ b/src/Bicep.Core.Samples/Files/Completions/declarations.json @@ -2013,6 +2013,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.combined.bicep b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep new file mode 100644 index 00000000000..575277e83c7 --- /dev/null +++ b/src/Bicep.LangServer.IntegrationTests/Completions/SnippetTemplates/res-route-server/main.combined.bicep @@ -0,0 +1,24 @@ +// $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 + From 2a30710902cc20394af1434590efd6469f93b870 Mon Sep 17 00:00:00 2001 From: StefanIvemo Date: Tue, 10 Aug 2021 22:17:10 +0200 Subject: [PATCH 4/4] removed blank line --- .../res-route-server/main.combined.bicep | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 index 575277e83c7..a443d590190 100644 --- 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 @@ -1,8 +1,8 @@ -// $1 = 'name' -// $2 = ipConfiguration -// $3 = 'name' -// $4 = 'subnet.id' - +// $1 = 'name' +// $2 = ipConfiguration +// $3 = 'name' +// $4 = 'subnet.id' + resource virtualHub 'Microsoft.Network/virtualHubs@2021-02-01' = { name: 'name' location: resourceGroup().location @@ -20,5 +20,4 @@ resource ipConfiguration 'Microsoft.Network/virtualHubs/ipConfigurations@2021-02 } } } -// Insert snippet here - +// Insert snippet here