layout command: return success on noop when layout already matches#1954
Open
glassbe wants to merge 1 commit intonikitabobko:mainfrom
Open
layout command: return success on noop when layout already matches#1954glassbe wants to merge 1 commit intonikitabobko:mainfrom
glassbe wants to merge 1 commit intonikitabobko:mainfrom
Conversation
When `layout` is called with the same layout that is already set (e.g., running `layout h_tiles` when the container is already h_tiles), the command returns false (exit code 1) even though the desired state is already achieved. This makes scripting and programmatic use harder since callers must special-case exit code 1 as a non-error. Change `return false` to `return true` so that noops are treated as successful operations, consistent with how the `tiling` case on line 41 already handles this. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Discussion: #1956
Summary
layoutcommand returnsfalse(exit code 1) when the layout is already set to the requested value, even though the desired state is already achieved.return falsetoreturn trueon the noop path (line 15 ofLayoutCommand.swift), consistent with how thetilingcase already returnstruefor noops (line 41).Test plan
LayoutCommandTest.swiftwith 2 tests:testChangeLayout— verifies layout actually changes and returns exit code 0testNoopReturnsTrueWhenLayoutAlreadyMatches— verifies the noop case returns exit code 0./run-tests.shpasses (108 tests, 0 SwiftFormat changes)🤖 Generated with Claude Code