Comments (4)
@xfalcox --print-width
is in the CLI for v3.1.0
from syntax_tree.
Yeah I don't really want to add more configuration but print width is so fundamental I think I have to. I think I'm going to add --print-width
as a command-line option to all of the commands that it makes sense.
That being said @xfalcox I really wouldn't suggest increasing it all of the way to 120. It's fundamentally different from something like rubocop's line length for instance. This doc here: https://prettier.io/docs/en/options.html#print-width goes into why and is a pretty good explanation. I've seen people have success with 100 occasionally, but leaving it at 80 is definitely a better way to go in the long run (in my opinion).
That being said, I am going to support this option.
from syntax_tree.
Configurable line width would be a big help for me, too.
I have been focusing on the VS Code extension and not really on the core gem. The gem has a plugin architecture; if I were to do line width, I would see about making it a plugin (might need to adjust the core code to enable that).
The other factor is, how to specify the parameter (desired max width)? Your idea of using an environment variable was interesting. I know the philosophy of this gem is KISS / zero-config as much as possible -- introducing any config is a bit of a bummer.
An alternate idea would be to introduce a way to specify parameters for plugins, on the CLI or at instantiation time, --plugin=foo/bar:120
or something like that.
Or, perhaps the gem could ship with a plugin that expands line width to 120 / 160 / etc, and people can subclass that plugin and install their own subclass if they want another value.
Anyhow: random musings. Curious to hear @kddnewton's take on line length. It's not blocking adoption in my company but would be nice to have down the road.
from syntax_tree.
Hahaha you are right on the money with the 120. I implemented both 120 and 100 as plugins on my fork and we found 120 removing too much if blocks into guard clauses.
We are now evaluating 100 as a middle ground!
from syntax_tree.
Related Issues (20)
- Is it possible to configure indentation size? HOT 1
- VSCode does not pick up `stree` HOT 2
- Multiline blocks sometimes use braces, sometimes do/end
- Incorrect nodes end location for some nodes HOT 1
- ERB-formatter HOT 1
- Character literals are formatted incorrectly
- Plugin for not switching to `%w`/`%i` array syntax HOT 1
- Empty hash literal should be kept on one line
- subscript assignment should not be split into multiple lines
- Comments in long call chains regressed in 6.2.0
- Use `rubydoc.info` for API documentation
- Formatting changing type of hash key
- Constructor with block gets split onto new line even if it would fit HOT 1
- Prism integration status? HOT 1
- Block with long list of block vars doesn't get split onto multiple lines
- Disabling single-line conditional formatting
- Method chain ending with block always breaks on multiple lines due to argument
- `stree write` turns correct code into incorrect code for method call with mix of keyword types
- Issue with Ruby 3.1.5 HOT 4
- [Feature] Allow parsing top-level yield in Ruby 3.3 HOT 2
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 syntax_tree.