Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be smart about newlines before/after extractions #15194

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

StephenWeatherford
Copy link
Contributor

@StephenWeatherford StephenWeatherford commented Oct 2, 2024

The new behavior is essentially that we try to match the newly-inserted declaration (whether it has blank lines before/after) with the existing declaration that it's being inserted after. For example:

var v1 = 1
var v2 = 2

var expression = v1 + v2   // << EXTRACT THIS
``
=>
```bicep
var v1 = 1
var v2 = 2
var newVariable = v1 + v2  // << NEW DECLARATION

var expression = newVariable
``
Since v2 had a newline after it but none before it, we do the same with newVariable.  If there were a blank line between v1 and v2, we'd insert a blank line before newVariable.
 ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/15194)

Copy link
Contributor

github-actions bot commented Oct 2, 2024

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

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

@StephenWeatherford StephenWeatherford force-pushed the sw/241001-sw/refactor1.spacing branch from 4d2ebf3 to 6a33a52 Compare October 2, 2024 22:03
@StephenWeatherford StephenWeatherford force-pushed the sw/241001-sw/refactor1.spacing branch from 6a33a52 to 9c96f2b Compare October 2, 2024 22:04
Copy link
Contributor

github-actions bot commented Oct 2, 2024

Dotnet Test Results

    72 files   -     24      72 suites   - 24   28m 23s ⏱️ - 18m 17s
11 310 tests +    16  11 310 ✅ +    16  0 💤 ±0  0 ❌ ±0 
26 397 runs   - 11 186  26 397 ✅  - 11 186  0 💤 ±0  0 ❌ ±0 

Results for commit 643f340. ± Comparison against base commit da3c2ce.

♻️ This comment has been updated with latest results.

@StephenWeatherford StephenWeatherford force-pushed the sw/241001-sw/refactor1.spacing branch from 75457d4 to 643f340 Compare October 3, 2024 22:46
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:

@StephenWeatherford StephenWeatherford merged commit a2909fa into main Oct 4, 2024
47 checks passed
@StephenWeatherford StephenWeatherford deleted the sw/241001-sw/refactor1.spacing branch October 4, 2024 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants