Modernize and clean up the code base a bit#2004
Merged
patriksvensson merged 1 commit intospectreconsole:mainfrom Jan 11, 2026
Merged
Modernize and clean up the code base a bit#2004patriksvensson merged 1 commit intospectreconsole:mainfrom
patriksvensson merged 1 commit intospectreconsole:mainfrom
Conversation
Contributor
patriksvensson
commented
Jan 11, 2026
- Move extension methods closer to implementations
- Fix namespaces
- Make structs read-only where applicable
- Use ArgumentNullException.ThrowIfNull
- Use collection expressions
* Move extension methods closer to implementations * Fix namespaces * Make structs read-only where applicable * Use ArgumentNullException.ThrowIfNull * Use collection expressions
There was a problem hiding this comment.
Pull request overview
This pull request modernizes the Spectre.Console codebase by consolidating extension methods, updating null checks, using collection expressions, and making appropriate structs readonly. The changes improve code organization and leverage modern C# features.
Changes:
- Moved extension methods from separate files in
Extensions/folder to be co-located with their target types - Replaced manual null checks with
ArgumentNullException.ThrowIfNull - Updated collection initializations to use collection expression syntax (
[]) - Made several structs readonly (
Size,Measurement,Region,Padding,FileSize,DisplayNameOptions) - Fixed namespace for
IRenderableand internal classes
Reviewed changes
Copilot reviewed 195 out of 200 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Spectre.Console/Widgets/TreeNode.cs | Added TreeNodeExtensions inline, used collection expression |
| src/Spectre.Console/Widgets/Tree.cs | Added TreeExtensions inline, used collection expression |
| src/Spectre.Console/Widgets/TextPath.cs | Added TextPathExtensions inline, used collection expressions |
| src/Spectre.Console/Widgets/Table/*.cs | Modernized null checks and collection expressions |
| src/Spectre.Console/Widgets/Rule.cs | Added RuleExtensions inline, improved formatting |
| src/Spectre.Console/Widgets/Paragraph.cs | Updated null checks and collection expressions |
| src/Spectre.Console/Widgets/Panel.cs | Added PanelExtensions inline |
| src/Spectre.Console/Widgets/Charts/*.cs | Added chart extensions inline, used collection expressions |
| src/Spectre.Console/Live/**/*.cs | Consolidated live display extensions |
| src/Spectre.Console/Prompts/*.cs | Updated null checks and collection expressions |
| src/Spectre.Console/*.cs | Made structs readonly, moved extensions inline |
| src/Spectre.Console/Internal/*.cs | Fixed namespaces and collection expressions |
| src/Spectre.Console/Rendering/*.cs | Updated IRenderable namespace and implementations |
| src/Spectre.Console/Extensions/*.cs | Deleted extension files (moved inline) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.