From 6987e172ba7fb4540be174ad70b2b975cba41b78 Mon Sep 17 00:00:00 2001 From: Anthony Martin Date: Thu, 8 Jul 2021 16:46:14 -0400 Subject: [PATCH] Add list method call on Azure resource references (#3430) * Add list method call on Azure resource references * Address PR feedback * Update baselines * Fix tests --- .../Scenarios/ResourceListFunctionTests.cs | 95 +++++++++++++++++++ .../Completions/azFunctions.json | 17 ---- .../Completions/symbols.json | 17 ---- .../main.diagnostics.bicep | 2 +- .../Completions/symbolsPlusX.json | 17 ---- .../Completions/symbolsPlusX_if.json | 17 ---- .../Completions/arrayPlusSymbols.json | 17 ---- .../boolPropertyValuesPlusSymbols.json | 17 ---- .../cleanupPreferencesPlusSymbols.json | 17 ---- .../cliPropertyAccessIndexesPlusSymbols.json | 17 ---- ...iPropertyAccessIndexesPlusSymbols_for.json | 17 ---- ...opertyAccessIndexesPlusSymbols_for_if.json | 17 ---- ...liPropertyAccessIndexesPlusSymbols_if.json | 17 ---- .../createModeIndexPlusSymbols.json | 17 ---- .../createModeIndexPlusSymbols_for.json | 17 ---- .../createModeIndexPlusSymbols_for_if.json | 17 ---- .../createModeIndexPlusSymbols_if.json | 17 ---- .../Completions/defaultCreateModeIndexes.json | 17 ---- .../defaultCreateModeIndexes_for.json | 17 ---- .../defaultCreateModeIndexes_for_if.json | 17 ---- .../defaultCreateModeIndexes_if.json | 17 ---- .../deploymentScriptKindsPlusSymbols.json | 17 ---- .../deploymentScriptKindsPlusSymbols_for.json | 17 ---- ...ploymentScriptKindsPlusSymbols_for_if.json | 17 ---- .../deploymentScriptKindsPlusSymbols_if.json | 17 ---- ...DiscriminatorPropertyIndexPlusSymbols.json | 17 ---- ...riminatorPropertyIndexPlusSymbols_for.json | 17 ---- ...inatorPropertyIndexPlusSymbols_for_if.json | 17 ---- ...criminatorPropertyIndexPlusSymbols_if.json | 17 ---- .../Completions/objectPlusSymbols.json | 17 ---- ...jectPlusSymbolsWithRequiredProperties.json | 17 ---- .../storageSkuNamePlusSymbols.json | 17 ---- .../Completions/symbols.json | 17 ---- .../Completions/symbolsPlusAccount2.json | 17 ---- .../symbolsPlusAccountRuleState.json | 17 ---- .../Completions/symbolsPlusArrayAndFor.json | 17 ---- .../symbolsPlusArrayWithoutFor.json | 17 ---- .../Completions/symbolsPlusRule.json | 17 ---- .../Completions/objectVarTopLevelIndexes.json | 17 ---- .../Completions/symbols.json | 17 ---- .../Completions/twoIndexPlusSymbols.json | 17 ---- .../Completions/symbolsPlusTypes.json | 17 ---- src/Bicep.Core/Emit/ExpressionConverter.cs | 28 ++++-- .../TypeSystem/Az/AzResourceTypeProvider.cs | 9 ++ src/Bicep.Core/TypeSystem/FunctionResolver.cs | 5 +- 45 files changed, 128 insertions(+), 691 deletions(-) create mode 100644 src/Bicep.Core.IntegrationTests/Scenarios/ResourceListFunctionTests.cs diff --git a/src/Bicep.Core.IntegrationTests/Scenarios/ResourceListFunctionTests.cs b/src/Bicep.Core.IntegrationTests/Scenarios/ResourceListFunctionTests.cs new file mode 100644 index 00000000000..c8fb96c2f20 --- /dev/null +++ b/src/Bicep.Core.IntegrationTests/Scenarios/ResourceListFunctionTests.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using Bicep.Core.Diagnostics; +using Bicep.Core.UnitTests.Assertions; +using Bicep.Core.UnitTests.Utils; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Bicep.Core.IntegrationTests.Scenarios +{ + [TestClass] + public class ResourceListFunctionTests + { + [TestMethod] + public void List_wildcard_function_on_resource_references() + { + var result = CompilationHelper.Compile(@" +resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = { + name: 'testacc' + location: 'West US' + kind: 'StorageV2' + sku: { + name: 'Standard_LRS' + } +} + +output pkStandard string = listKeys(stg.id, stg.apiVersion).keys[0].value +output pkMethod string = stg.listKeys().keys[0].value +output pkMethodVersionOverride string = stg.listKeys('2021-01-01').keys[0].value +output pkMethodPayload string = stg.listKeys(stg.apiVersion, { + key1: 'val1' +}) +"); + + result.Should().NotHaveAnyDiagnostics(); + result.Template.Should().HaveValueAtPath("$.outputs['pkStandard'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethod'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethodVersionOverride'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2021-01-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethodPayload'].value", "[listKeys(resourceId('Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01', createObject('key1', 'val1'))]"); + } + + [TestMethod] + public void List_wildcard_function_on_cross_scope_resource_references() + { + var result = CompilationHelper.Compile(@" +resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' existing = { + scope: resourceGroup('other') + name: 'testacc' +} + +output pkStandard string = listKeys(stg.id, stg.apiVersion).keys[0].value +output pkMethod string = stg.listKeys().keys[0].value +output pkMethodVersionOverride string = stg.listKeys('2021-01-01').keys[0].value +output pkMethodPayload string = stg.listKeys(stg.apiVersion, { + key1: 'val1' +}) +"); + + result.Should().NotHaveAnyDiagnostics(); + result.Template.Should().HaveValueAtPath("$.outputs['pkStandard'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethod'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethodVersionOverride'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2021-01-01').keys[0].value]"); + result.Template.Should().HaveValueAtPath("$.outputs['pkMethodPayload'].value", "[listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'other'), 'Microsoft.Storage/storageAccounts', 'testacc'), '2019-06-01', createObject('key1', 'val1'))]"); + } + + [TestMethod] + public void Only_list_methods_are_permitted() + { + var result = CompilationHelper.Compile(@" +resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' existing = { + name: 'testacc' +} + +var allowed = { + a: stg.list() + b: stg.listA() + c: stg.listTotallyMadeUpMethod() +} + +var disallowed = { + a: stg.lis() + b: stg.lsit() + c: stg.totallyMadeUpMethod() +} +"); + result.Should().HaveDiagnostics(new[] { + ("no-unused-vars", DiagnosticLevel.Warning, "Variable \"allowed\" is declared but never used."), + ("no-unused-vars", DiagnosticLevel.Warning, "Variable \"disallowed\" is declared but never used."), + ("BCP109", DiagnosticLevel.Error, "The type \"Microsoft.Storage/storageAccounts\" does not contain function \"lis\"."), + ("BCP109", DiagnosticLevel.Error, "The type \"Microsoft.Storage/storageAccounts\" does not contain function \"lsit\"."), + ("BCP109", DiagnosticLevel.Error, "The type \"Microsoft.Storage/storageAccounts\" does not contain function \"totallyMadeUpMethod\"."), + }); + } + } +} \ No newline at end of file diff --git a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/azFunctions.json b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/azFunctions.json index cad2a7243ae..e90b8a05f72 100644 --- a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/azFunctions.json +++ b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/azFunctions.json @@ -44,23 +44,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "managementGroup", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/symbols.json b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/symbols.json index da4c3393aee..a241da02f01 100644 --- a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/symbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/Completions/symbols.json @@ -1166,23 +1166,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/main.diagnostics.bicep b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/main.diagnostics.bicep index 01c5284406e..e6aa78186e2 100644 --- a/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/main.diagnostics.bicep +++ b/src/Bicep.Core.Samples/Files/InvalidExpressions_LF/main.diagnostics.bicep @@ -366,7 +366,7 @@ var test1 = listKeys('abcd') // list spelled wrong var test2 = lsitKeys('abcd', '2020-01-01') //@[4:9) [no-unused-vars (Warning)] Variable "test2" is declared but never used. (CodeDescription: bicep core(https://aka.ms/bicep/linter/no-unused-vars)) |test2| -//@[12:20) [BCP082 (Error)] The name "lsitKeys" does not exist in the current context. Did you mean "listKeys"? (CodeDescription: none) |lsitKeys| +//@[12:20) [BCP057 (Error)] The name "lsitKeys" does not exist in the current context. (CodeDescription: none) |lsitKeys| // just 'lis' instead of 'list' var test3 = lis('abcd', '2020-01-01') diff --git a/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX.json b/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX.json index e537f2ed985..0fd7c0e6954 100644 --- a/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX.json +++ b/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX.json @@ -1043,23 +1043,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX_if.json b/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX_if.json index c6984ef0c41..3dff7f7dc32 100644 --- a/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidModules_LF/Completions/symbolsPlusX_if.json @@ -1043,23 +1043,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/arrayPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/arrayPlusSymbols.json index 731066c0c4b..89a78d8f1d4 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/arrayPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/arrayPlusSymbols.json @@ -2622,23 +2622,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/boolPropertyValuesPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/boolPropertyValuesPlusSymbols.json index 7eaee0fda6d..38cf3ef4325 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/boolPropertyValuesPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/boolPropertyValuesPlusSymbols.json @@ -2586,23 +2586,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cleanupPreferencesPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cleanupPreferencesPlusSymbols.json index 4376e6b9a0e..022c61f1914 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cleanupPreferencesPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cleanupPreferencesPlusSymbols.json @@ -2614,23 +2614,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols.json index 18df8e5914d..3c33b81cef0 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols.json @@ -2845,23 +2845,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for.json index 0e85f2a2c26..a5428f219ae 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for.json @@ -2845,23 +2845,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for_if.json index 5b0f23624c6..17e86848a26 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_for_if.json @@ -2845,23 +2845,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_if.json index 43981a1d115..31a7e5ed56d 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/cliPropertyAccessIndexesPlusSymbols_if.json @@ -2845,23 +2845,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols.json index d021d9a2103..877597ff33c 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols.json @@ -2607,23 +2607,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for.json index 62a19160a89..496a15936fc 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for.json @@ -2607,23 +2607,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for_if.json index 51023622a3e..02d2be8d2ed 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_for_if.json @@ -2607,23 +2607,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_if.json index 81f2ddd0720..23f5e37ec0d 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/createModeIndexPlusSymbols_if.json @@ -2607,23 +2607,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes.json index 6c1ef5fc498..c0801346360 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes.json @@ -3093,23 +3093,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for.json index 5e93be39517..a58e5e0d378 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for.json @@ -3093,23 +3093,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for_if.json index 7d0e1e83e30..a3a47b47d42 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_for_if.json @@ -3093,23 +3093,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_if.json index 524a04cddce..1d364d6a9e5 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/defaultCreateModeIndexes_if.json @@ -3093,23 +3093,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols.json index 19abbd157c5..5f621970ea5 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols.json @@ -2600,23 +2600,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for.json index df0e6636d9c..446116edd9b 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for.json @@ -2600,23 +2600,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for_if.json index 09830c43aeb..becb1f210ca 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_for_if.json @@ -2600,23 +2600,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_if.json index e4eb0ccaf00..9308c4c1aaf 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/deploymentScriptKindsPlusSymbols_if.json @@ -2600,23 +2600,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols.json index 270c632807e..09005290ef3 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols.json @@ -2593,23 +2593,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for.json index 1e2b07b31fe..0dfb65b6ba7 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for.json @@ -2593,23 +2593,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for_if.json index 032c0a9745a..f6308ddae44 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_for_if.json @@ -2593,23 +2593,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_if.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_if.json index 0eae66573d3..3007ebb4132 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_if.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/missingDiscriminatorPropertyIndexPlusSymbols_if.json @@ -2593,23 +2593,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbols.json index 2aaf6c75c74..9c05c4e9951 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbols.json @@ -2572,23 +2572,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbolsWithRequiredProperties.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbolsWithRequiredProperties.json index a2d1b4d3c12..c0e38afdfea 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbolsWithRequiredProperties.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/objectPlusSymbolsWithRequiredProperties.json @@ -2572,23 +2572,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/storageSkuNamePlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/storageSkuNamePlusSymbols.json index 88a717ed772..b2517536a4c 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/storageSkuNamePlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/storageSkuNamePlusSymbols.json @@ -2715,23 +2715,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbols.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbols.json index 302283f11de..8644f6e03f2 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbols.json @@ -2589,23 +2589,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccount2.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccount2.json index 5f28f0a1d1e..22048376821 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccount2.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccount2.json @@ -2603,23 +2603,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccountRuleState.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccountRuleState.json index c323d33d50b..e122b96d772 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccountRuleState.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusAccountRuleState.json @@ -2603,23 +2603,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayAndFor.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayAndFor.json index 4710afdf988..0bcb320a300 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayAndFor.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayAndFor.json @@ -2653,23 +2653,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayWithoutFor.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayWithoutFor.json index 30e6d3e2787..10b7a1d633f 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayWithoutFor.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusArrayWithoutFor.json @@ -2617,23 +2617,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusRule.json b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusRule.json index 03341d747b6..0e9b0753757 100644 --- a/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusRule.json +++ b/src/Bicep.Core.Samples/Files/InvalidResources_CRLF/Completions/symbolsPlusRule.json @@ -2603,23 +2603,6 @@ "newText": "letsAccessTheDashes2" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/objectVarTopLevelIndexes.json b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/objectVarTopLevelIndexes.json index feaa799c433..ebc48568042 100644 --- a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/objectVarTopLevelIndexes.json +++ b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/objectVarTopLevelIndexes.json @@ -822,23 +822,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/symbols.json b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/symbols.json index 5292fff17c9..55010d4fd95 100644 --- a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/symbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/symbols.json @@ -858,23 +858,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/twoIndexPlusSymbols.json b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/twoIndexPlusSymbols.json index 8f9e25f68a4..4f7dccb522c 100644 --- a/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/twoIndexPlusSymbols.json +++ b/src/Bicep.Core.Samples/Files/InvalidVariables_LF/Completions/twoIndexPlusSymbols.json @@ -840,23 +840,6 @@ "command": "editor.action.triggerParameterHints" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core.Samples/Files/Variables_LF/Completions/symbolsPlusTypes.json b/src/Bicep.Core.Samples/Files/Variables_LF/Completions/symbolsPlusTypes.json index abbbd5dde60..3ca16e21798 100644 --- a/src/Bicep.Core.Samples/Files/Variables_LF/Completions/symbolsPlusTypes.json +++ b/src/Bicep.Core.Samples/Files/Variables_LF/Completions/symbolsPlusTypes.json @@ -1191,23 +1191,6 @@ "newText": "lessOrEquals" } }, - { - "label": "listKeys", - "kind": "function", - "detail": "listKeys()", - "deprecated": false, - "preselect": false, - "sortText": "3_listKeys", - "insertTextFormat": "snippet", - "insertTextMode": "adjustIndentation", - "textEdit": { - "range": {}, - "newText": "listKeys($0)" - }, - "command": { - "command": "editor.action.triggerParameterHints" - } - }, { "label": "loadFileAsBase64", "kind": "function", diff --git a/src/Bicep.Core/Emit/ExpressionConverter.cs b/src/Bicep.Core/Emit/ExpressionConverter.cs index 4898ed41397..d6ca5d45426 100644 --- a/src/Bicep.Core/Emit/ExpressionConverter.cs +++ b/src/Bicep.Core/Emit/ExpressionConverter.cs @@ -120,13 +120,29 @@ private LanguageExpression ConvertFunction(FunctionCallSyntaxBase functionCall) function.Arguments.Select(a => ConvertExpression(a.Expression))); case InstanceFunctionCallSyntax instanceFunctionCall: - var namespaceSymbol = context.SemanticModel.GetSymbolInfo(instanceFunctionCall.BaseExpression); - Assert(namespaceSymbol is NamespaceSymbol, $"BaseExpression must be a NamespaceSymbol, instead got: '{namespaceSymbol?.Kind}'"); - - return ConvertFunction( - instanceFunctionCall.Name.IdentifierName, - instanceFunctionCall.Arguments.Select(a => ConvertExpression(a.Expression))); + var baseSymbol = context.SemanticModel.GetSymbolInfo(instanceFunctionCall.BaseExpression); + switch (baseSymbol) + { + case NamespaceSymbol namespaceSymbol: + return ConvertFunction( + instanceFunctionCall.Name.IdentifierName, + instanceFunctionCall.Arguments.Select(a => ConvertExpression(a.Expression))); + case ResourceSymbol resourceSymbol when instanceFunctionCall.Name.IdentifierName.StartsWithOrdinalInsensitively("list"): + // Handle list(...) method on resource symbol - e.g. stgAcc.listKeys() + var convertedArgs = instanceFunctionCall.Arguments.SelectArray(a => ConvertExpression(a.Expression)); + var resourceIdExpression = GetFullyQualifiedResourceId(resourceSymbol); + var apiVersionExpression = new JTokenExpression(resourceSymbol.GetResourceTypeReference().ApiVersion); + + var listArgs = convertedArgs.Length switch { + 0 => new LanguageExpression[] { resourceIdExpression, apiVersionExpression, }, + _ => new LanguageExpression[] { resourceIdExpression, }.Concat(convertedArgs), + }; + + return CreateFunction(instanceFunctionCall.Name.IdentifierName, listArgs); + } + + throw new InvalidOperationException($"Unrecognized base expression {baseSymbol?.Kind}"); default: throw new NotImplementedException($"Cannot emit unexpected expression of type {functionCall.GetType().Name}"); } diff --git a/src/Bicep.Core/TypeSystem/Az/AzResourceTypeProvider.cs b/src/Bicep.Core/TypeSystem/Az/AzResourceTypeProvider.cs index 00999e4e0f9..e51c42c1381 100644 --- a/src/Bicep.Core/TypeSystem/Az/AzResourceTypeProvider.cs +++ b/src/Bicep.Core/TypeSystem/Az/AzResourceTypeProvider.cs @@ -7,6 +7,7 @@ using Bicep.Core.Semantics; using System.Collections.Immutable; using Bicep.Core.Emit; +using System.Text.RegularExpressions; namespace Bicep.Core.TypeSystem.Az { @@ -239,6 +240,14 @@ static TypeProperty UpdateFlags(TypeProperty typeProperty, TypePropertyFlags fla private static IEnumerable GetBicepMethods(ResourceTypeReference resourceType) { + yield return new FunctionWildcardOverloadBuilder("list*", new Regex("^list[a-zA-Z]*")) + .WithReturnType(LanguageConstants.Any) + .WithDescription("The syntax for this function varies by name of the list operations. Each implementation returns values for the resource type that supports a list operation. The operation name must start with list. Some common usages are `listKeys`, `listKeyValue`, and `listSecrets`.") + .WithOptionalParameter("apiVersion", LanguageConstants.String, "API version of resource runtime state. Typically, in the format, yyyy-mm-dd.") + .WithOptionalParameter("functionValues", LanguageConstants.Object, "An object that has values for the function. Only provide this object for functions that support receiving an object with parameter values, such as listAccountSas on a storage account. An example of passing function values is shown in this article.") + .WithFlags(FunctionFlags.RequiresInlining) + .Build(); + switch (resourceType.FullyQualifiedType.ToLowerInvariant()) { case "microsoft.keyvault/vaults": diff --git a/src/Bicep.Core/TypeSystem/FunctionResolver.cs b/src/Bicep.Core/TypeSystem/FunctionResolver.cs index fa65cb181e7..3b7b2d1fb38 100644 --- a/src/Bicep.Core/TypeSystem/FunctionResolver.cs +++ b/src/Bicep.Core/TypeSystem/FunctionResolver.cs @@ -73,10 +73,7 @@ public ImmutableDictionary GetKnownFunctions() var wildcardOverloads = FunctionWildcardOverloads.Where(fo => fo.WildcardRegex.IsMatch(name)); // create a new symbol for each unique name that matches the wildcard - var cachedSymbol = wildcardOverloads.Any() ? new FunctionSymbol(name, wildcardOverloads) : null; - FunctionCache[name] = cachedSymbol; - - return cachedSymbol; + return wildcardOverloads.Any() ? new FunctionSymbol(name, wildcardOverloads) : null; } public static IEnumerable GetMatches(