Comments (2)
The problem is the formatter is written much in the vein of javascripts prettier/rustfmt. There is no way of telling the formatter it should use one line it. It uses the width of lines to determine whether it should be broken.
You could technically ignore the core concept of the formatter by having some break character like the comma, but what happens in the reverse, the user wants to one line it, but the character width is above the threshold? One could say well it should just look at the comma, but then the whole width line breaking is completly removed.
In that case it would be better just to write a whole new formatter that acts less opinionated like gofmt. That is not necessarily a bad idea. This formatter could potentially be too agressive for some people. Even I sometimes wonder whether making a lighter gofmt styled formatter would be better.
from ols.
As a language designer, I think having an "official" opinionated style is a good thing because it helps with readability. It's good that all the code looks the same.
As a programmer, I rather be programming and not care about formatting. If the choice is taken away from me it's one less thing to care about.
I was thinking that a comma could be useful as a hint but I get that if it runs into with width limit and that then triggers other behavior then it's just more confusing.
I made a quick test in Go and it doesn't seem to care about the comma, I can break where I like. It will just indent stuff.
Which would enable layouts like this but why would you wanna do that? At least, to me it strikes me as odd because it is inconsistent. IMAO easy to misread?
swap_chain_desc := dxgi.SWAP_CHAIN_DESC1 {
BufferCount = BACK_BUFFER_COUNT,
Width = 0, Height = 0,
Format = dxgi.FORMAT.R8G8B8A8_UNORM,
Flags = {.FRAME_LATENCY_WAITABLE_OBJECT},
BufferUsage = {.RENDER_TARGET_OUTPUT},
SampleDesc = {
Count = 1,
Quality = 0,
},
SwapEffect = .FLIP_DISCARD, AlphaMode = .UNSPECIFIED, Scaling = .STRETCH, Stereo = false,
}
And what about alignment, is this better, worse or doesn't matter kind of deal?
swap_chain_desc := dxgi.SWAP_CHAIN_DESC1 {
BufferCount = BACK_BUFFER_COUNT,
Width = 0,
Height = 0,
Format = dxgi.FORMAT.R8G8B8A8_UNORM,
Flags = {.FRAME_LATENCY_WAITABLE_OBJECT},
BufferUsage = {.RENDER_TARGET_OUTPUT},
SampleDesc = {
Count = 1,
Quality = 0,
},
SwapEffect = .FLIP_DISCARD,
AlphaMode = .UNSPECIFIED,
Scaling = .STRETCH,
Stereo = false,
}
SampleDesc
kinda stands out in the above example.
Also, I might have misunderstood the relevance of the comma here. It is required for the code to be syntactically valid. I don't even think it's possible to use as I originally thought.
The more I think about it I don't know that it makes anything simpler. Bah, forget what I said.
from ols.
Related Issues (20)
- Odinfmt: Breaks code on long "If-statements with initialization"
- Rename feature HOT 2
- Parse statements with `or_continue` and `or_break` HOT 3
- Didn't compile HOT 1
- Items involving generic functions fail to return results depending on package scope. HOT 4
- Unable to find x library. HOT 1
- Constant timeouts HOT 9
- [odinfmt] Struct formatting is broken when there are many `where` cases HOT 1
- OLS timesout on format HOT 1
- New directive #hash isn't properly parsed by OLS HOT 1
- Stroustrup brace style inserting extra space in front of else HOT 1
- formatter only allows two values in for loop HOT 1
- OLS Build Failed HOT 1
- `foreign import` library path corrupted after code format HOT 3
- Build failure on Windows HOT 2
- Unhandled specialization `&Pointer_Type` HOT 2
- Crash on shadowing proc name in it's body HOT 6
- Comp literal disables completion when not using them as key value assignments
- OLS confused by bit field definitions HOT 1
- Failed to download nightly release HOT 1
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 ols.