Skip to content

Conversation

levimatheri
Copy link
Contributor

@levimatheri levimatheri commented Oct 8, 2025

Description

Use visitor pattern to handle more multi-line input scenarios, including standalone expressions (previously this only worked for VariableDeclarationSyntax).

Example Usage

Recording.2025-10-07.213924.mp4

Checklist

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

github-actions bot commented Oct 8, 2025

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

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

Copy link
Contributor

github-actions bot commented Oct 8, 2025

Dotnet Test Results

    96 files   -     48      96 suites   - 48   42m 16s ⏱️ - 38m 13s
12 426 tests +     3  12 426 ✅ +     4  0 💤 ±0  0 ❌  - 1 
28 597 runs   - 14 244  28 597 ✅  - 14 243  0 💤 ±0  0 ❌  - 1 

Results for commit 991a3f9. ± Comparison against base commit 6bb5d5f.

This pull request removes 1919 and adds 668 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("'''
Hello
World
'''",True)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("'''
Hello
World",False)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("'hello'",True)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("(length(",False)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("42",True)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("[",False)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("filter(map([1,2],
x => x + 1),
y => y % 2 == 0",False)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("filter(map([1,2],",False)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("items([1, 2, 3])",True)
Bicep.Cli.UnitTests.Helpers.Repl.StructuralCompletenessHelperTests ‑ IsStructurallyComplete_CompleteExpressions_ReturnsExpectedResult ("items({",False)
…

♻️ This comment has been updated with latest results.

// don't visit children - we already know it's incomplete
}

public override void VisitVariableDeclarationSyntax(VariableDeclarationSyntax syntax)
Copy link
Member

@anthony-c-martin anthony-c-martin Oct 8, 2025

Choose a reason for hiding this comment

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

One possible complexity with the visitor pattern is that you can get "stuck" inside a piece of deeply nested syntax - e.g. something like:

{
  foo: {
    bar: [
      'abc'
    abc: 'def'
  }
}

Here I accidentally missed a ], and so my expression is not structurally complete. It's not very clear to me that I need to type a ], and so it could feel like I'm "stuck" - e.g. I can't exit the statement whatever I press.

Is that something to consider here, or do you have a mitigation for this already?

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.

2 participants