Add Scope method for automatic indentation management#15
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add Scope method for indentation management
Add Scope method for automatic indentation management
Aug 25, 2025
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
…th comprehensive tests Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
Co-authored-by: samtrion <3283596+samtrion@users.noreply.github.com>
9b938df to
dbb65a4
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
==========================================
+ Coverage 80.09% 83.26% +3.17%
==========================================
Files 12 13 +1
Lines 221 233 +12
Branches 70 73 +3
==========================================
+ Hits 177 194 +17
+ Misses 26 23 -3
+ Partials 18 16 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the
Scope()method for theCSharpCodeBuilderclass to automatically manage indentation levels using theusingstatement pattern.Overview
The new
Scope()method returns a disposableScopeHandlerstruct that:usingstatement)Usage
Implementation Details
ScopeHandlerstruct: A public disposable struct implementingIDisposableandIEquatable<ScopeHandler>IncrementIndent()andDecrementIndent()methodsBenefits
usingstatement for resource managementTesting
Added comprehensive test suite covering:
All existing tests continue to pass (279 total tests).
Fixes #14.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.