Comments (8)
@mnazirov that's a super-old version. Can you check that it's still happening on 0.51.15 before I investigate further? Thanks.
from swiftformat.
@mnazirov thanks for double checking. The issue is that --nowrapoperators
only applies to operators, and <
isn't considered an operator by SwiftFormat when it's used as a bracket in a generics list.
It's not especially difficult for me to change that behavior, but I'm not sure if that would really solve your problem in this case, as it would just wrap at the ,
instead, which presumably isn't what you'd want.
What is the behavior you'd want in this case? Where should that line wrap?
from swiftformat.
@nicklockwood Updated to version 0.51.15, but the issue with line breaks in generic types still persists
Before formatting
func createConnectScreen() -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
...
}
After formatting
func createConnectScreen() -> DestinationStep<
NewConnectFactory.ViewController,
NewConnectFactory.Context
> {
...
}
from swiftformat.
@nicklockwood Thank you for the detailed explanation. I've tried to ensure only the method parameters wrap, while the return types of generics remain unchanged.
from swiftformat.
@mnazirov sure, I understand that. But in the example above there are no method parameters, so is your desired behavior that the line should just not wrap at all, even if it exceeds your specified max line width?
from swiftformat.
@nicklockwood Yep, I want the line breaks to only occur at method arguments. Can you please advise how I can achieve this result?)
Before formatting
func createConnectScreen(argument: Int, argument2: Int) -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
...
}
Expected formatting result
func createConnectScreen(
argument: Int,
argument2: Int
) -> DestinationStep<NewConnectFactory.ViewController, NewConnectFactory.Context> {
...
}
from swiftformat.
@nicklockwood I think there's no way to do this currently other than to disable the wrap
rule.
from swiftformat.
Thank you so much for the speedy reply)
from swiftformat.
Related Issues (20)
- Comment before `--ifdef` results in unexpected modifier indentation HOT 2
- docComments don't work for code inside #if HOT 2
- Xcode 15 recommended settings cause sandbox reports for BuildTools HOT 2
- Question: Wrap function calls HOT 7
- `hoistAwait` removes necessary `await` for operators/functions with async autoclosures. HOT 5
- opaqueGenericParameters cannot be disabled? HOT 8
- `Alman = false` in combination with long char count in line breaks the `{` into a new row HOT 7
- redundantReturn removes return statements of consecutive if statements HOT 4
- conditionalAssignment matches expression within try block HOT 11
- Rule Request: Remove redundant parenthesis from closures HOT 7
- conditionalAssignment rule HOT 4
- doesn't recognize both --disable all and // swiftformat:disable all HOT 1
- Make blankLinesAroundMark prioritized over blankLinesAtStartOfScope
- Compile error with conditionalAssignment and Swift version 5.9 HOT 5
- App doesn't manage non-rule config file options HOT 1
- Compiler error with 5.9 conversion to switch expression HOT 1
- Swift warning: BuildTools should be located under 'Sources/BuildTools' HOT 1
- How do I use the `--funcattributes prev-line` rule in the config file? HOT 2
- Outputted code doesn't build HOT 3
- error: 'switch' may only be used as expression in return, throw, or as the source of an assignment HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftformat.