Skip to content

Conversation

@anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Oct 23, 2025

Adds an optional $ prefix to the current multiline opening syntax ''', which enables interpolation using standard ${...} Bicep interpolation. To permit a ${...} literal value without escaping requirements, you can specify the number of $ characters required for interpolation by repeating the $ prefix.

Basic example:

var s = $'''
this is ${interpolated}'''

With multiple $ characters:

var s = $$'''
this is $${interpolated}
this is not ${interpolated}'''

This is currently experimental, and requires enabling experimental feature multilineStringInterpolation.

Closes #3389

@anthony-c-martin anthony-c-martin changed the title [POC] Multi-line interpolation [POC] Multi-line string interpolation Oct 23, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Test this change out locally with the following install scripts (Action run 18892424573)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 18892424573
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 18892424573"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 18892424573
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 18892424573"

@github-actions
Copy link
Contributor

github-actions bot commented Oct 23, 2025

Dotnet Test Results

    96 files   -     48      96 suites   - 48   40m 7s ⏱️ - 29m 33s
12 525 tests +    78  12 525 ✅ +    78  0 💤 ±0  0 ❌ ±0 
28 795 runs   - 14 118  28 795 ✅  - 14 118  0 💤 ±0  0 ❌ ±0 

Results for commit 78ac4ed. ± Comparison against base commit 7c51895.

This pull request removes 1942 and adds 748 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	$��\u000cZ�?Z��ϒ�?�����\u0004A\u0010\u0004�\u0012�.gz\u001e\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
	1
	2
	\$'")
	prop1: true
…
Bicep.Cli.IntegrationTests.BuildCommandTests ‑ Build_Valid_SingleFile_WithTemplateSpecReference_ShouldSucceed_MultilineStrings_LF
Bicep.Cli.IntegrationTests.BuildCommandTests ‑ Build_Valid_SingleFile_WithTemplateSpecReference_ToStdOut_ShouldSucceed_MultilineStrings_LF
Bicep.Cli.IntegrationTests.FormatCommandTests ‑ Format_SampleBicepFile_MatchesFormattedSample_MultilineStrings_LF
Bicep.Cli.IntegrationTests.PublishCommandTests ‑ MultilineStrings_LF, with docUri, publishing source
Bicep.Cli.IntegrationTests.PublishCommandTests ‑ MultilineStrings_LF, without docUri, not publishing source
Bicep.Cli.IntegrationTests.PublishCommandTests ‑ Publish_ValidArmTemplateFile_AllValidDataSets_ShouldSucceed_MultilineStrings_LF
Bicep.Cli.IntegrationTests.RestoreCommandTests ‑ Restore_ShouldSucceed ("MultilineStrings_LF, not publishing source",Bicep.Core.Samples.DataSet,False)
Bicep.Cli.IntegrationTests.RestoreCommandTests ‑ Restore_ShouldSucceed ("MultilineStrings_LF, publishing source",Bicep.Core.Samples.DataSet,True)
Bicep.Cli.IntegrationTests.RestoreCommandTests ‑ Restore_ShouldSucceedWithAnonymousClient ("MultilineStrings_LF, not publishing source",Bicep.Core.Samples.DataSet,False)
Bicep.Cli.IntegrationTests.RestoreCommandTests ‑ Restore_ShouldSucceedWithAnonymousClient ("MultilineStrings_LF, publishing source",Bicep.Core.Samples.DataSet,True)
…

♻️ This comment has been updated with latest results.

@anthony-c-martin anthony-c-martin changed the title [POC] Multi-line string interpolation Multi-line string interpolation Oct 24, 2025
@anthony-c-martin anthony-c-martin force-pushed the ant/multi_interp branch 3 times, most recently from fe10c03 to 3ddcdc5 Compare October 28, 2025 01:43
@anthony-c-martin anthony-c-martin changed the title Multi-line string interpolation [Experimental] Support multi-line string interpolation Oct 28, 2025
@anthony-c-martin anthony-c-martin force-pushed the ant/multi_interp branch 3 times, most recently from 9cd5099 to 347fd05 Compare October 28, 2025 12:19
Copy link
Contributor

@shenglol shenglol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@anthony-c-martin anthony-c-martin merged commit 6252abb into main Oct 28, 2025
42 checks passed
@anthony-c-martin anthony-c-martin deleted the ant/multi_interp branch October 28, 2025 23:43
@benc-uk
Copy link

benc-uk commented Nov 1, 2025

Amazing to see this, great job
I can see from the size of the PR this wasn't trivial

anthony-c-martin added a commit that referenced this pull request Dec 12, 2025
Remove the experimental feature flag for multi-line interpolated
strings.

Description of the feature:
> Adds an optional `$` prefix to the current multiline opening syntax
`'''`, which enables interpolation using standard `${...}` Bicep
interpolation. To permit a `${...}` literal value > without escaping
requirements, you can specify the number of `$` characters required for
interpolation by repeating the `$` prefix.
> 
> Basic example:
> ```bicep
> var s = $'''
> this is ${interpolated}'''
> ```
> 
> With multiple `$` characters:
> ```bicep
> var s = $$'''
> this is $${interpolated}
> this is not ${interpolated}'''
> ```

Original PR: #18324
Closes #3389
@mumian
Copy link
Contributor

mumian commented Jan 30, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow interpolation in Multiline strings

6 participants