Improve Swift indentation support#391
Closed
ainame wants to merge 1 commit into
Closed
Conversation
Collaborator
|
As the docstring says, |
Author
|
I see. I read the docstring and understood the context #383 now. I'll send a patch to swift-mode.el instead. Thank you for your reply! |
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.
Summary
This updates Swift indentation support so that
indent_sizeis applied to all relevantswift-modeindentation offsets:swift-mode:basic-offsetswift-mode:multiline-statement-offsetswift-mode:parenthesized-expression-offsetPreviously,
editorconfig-emacsonly appliedindent_sizetoswift-mode:basic-offset.Background
This follows the discussion in swift-emacs/swift-mode#202.
Historically
swift-modehas three separate indentation settings for Swift code: block indentation, multiline statement indentation, and parenthesized expression indentation. They are all customizable viadefcustominswift-mode:https://github.com/swift-emacs/swift-mode/blob/5782bb9ab0773b5c6abddc23a14b82e5356cc2db/swift-mode-indent.el#L36-L52
In that discussion, we agreed that
swift-modeshould move towards using the same indentation value for these offsets by default. This PR applies the same idea on theeditorconfig-emacsside: when a project providesindent_size, it should be applied to all three Swift indentation settings instead of onlyswift-mode:basic-offset.This makes
editorconfig-emacshandle all indentation settings exposed byswift-mode, so that a project-levelindent_sizecan control Swift indentation consistently.