Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes obsolete patterns in the tree layout code by introducing C# 12 collection expressions, refactoring to the new Store.Pick API for context lookups, and modernizing the test suite with a shared TreeCustomization fixture.
- Refactor
MapPickersand test code to use C# 12 collection expressions instead of.ToList()/.ToArray() - Update
TreeLayoutPluginandTreeLayoutEngineto useIContext.Store.Pick(...)instead of direct manager APIs - Modernize tests: remove
LayoutEngineWrapper, adoptTreeCustomization, and apply new syntax across all layout‐engine tests
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Whim/Store/MapSector/MapPickers.cs | Switched to C# 12 collection expression for monitor handles |
| src/Whim.TreeLayout/TreeLayoutPlugin.cs | Rewrote constructor, replaced _context field and added SuppressMessage; use Store.Pick |
| src/Whim.TreeLayout/TreeLayoutEngine.cs | Replaced direct manager calls with Store.Pick and collection expressions |
| src/Whim.TreeLayout/TreeLayoutCommands.cs | Updated command callbacks to use Store.Pick |
| src/Whim.TreeLayout.Tests/Utils/TreeCustomization.cs | Introduced shared test customization for tree layout tests |
| src/Whim.TreeLayout.Tests/Utils/LayoutEngineWrapper.cs | Removed obsolete test helper |
| src/Whim.TreeLayout.Tests/TreeLayoutPluginTests.cs | Migrated to TreeCustomization and new collection syntax |
| src/Whim.TreeLayout.Tests/TreeLayoutCommandsTests.cs | Adapted to fixture and store-picker pattern |
| src/Whim.TreeLayout.Tests/Tree/TreeHelpersTests.cs | Replaced .ToArray() with [.. ] collection expression |
| src/Whim.TreeLayout.Tests/LayoutEngine/SwapWindowInDirectionTests.cs | Updated to use TreeCustomization and new syntax |
| src/Whim.TreeLayout.Tests/LayoutEngine/RemoveTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/PropertiesTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/PerformCustomActionTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/MoveWindowToPointTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/MoveWindowEdgesInDirectionTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/MinimizeWindowTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/GetFirstWindowTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/FocusWindowInDirectionTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/DoLayoutTests.cs | Ditto |
| src/Whim.TreeLayout.Tests/LayoutEngine/BaseTests.cs | Removed obsolete base test |
| src/Whim.TreeLayout.Tests/LayoutEngine/AddWindowTests.cs | Ditto |
| src/Whim.TestUtils/Whim.TestUtils.csproj | Added InternalsVisibleTo for TreeLayout tests |
| src/Whim.TestUtils/StoreTestUtils.cs | Improved AddWorkspaceToManager to avoid duplicate order entries |
Comments suppressed due to low confidence (2)
src/Whim/Store/MapSector/MapPickers.cs:211
- The initializer using
[ .. monitorIndices.Select(...), ]produces an array (HMONITOR[]), not aList<HMONITOR>. Either change the variable type toHMONITOR[]or wrap the collection expression innew List<HMONITOR>(...).
List<HMONITOR> monitorHandles =
src/Whim.TreeLayout/TreeLayoutPlugin.cs:26
- Using
[]here creates an array literal, not aDictionary<,>. Replace withnew Dictionary<LayoutEngineIdentity, Direction>()to initialize the dictionary properly.
private readonly Dictionary<LayoutEngineIdentity, Direction> _addNodeDirections = [];
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1148 +/- ##
==========================================
+ Coverage 81.06% 81.11% +0.05%
==========================================
Files 286 286
Lines 13148 13177 +29
Branches 1535 1535
==========================================
+ Hits 10658 10689 +31
Misses 2288 2288
+ Partials 202 200 -2 ☔ View full report in Codecov by Sentry. |
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.
No description provided.