prettier 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/README.md +2 -2
- data/package.json +1 -1
- data/src/parseSync.js +1 -1
- data/src/server.rb +15 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69429c1f7b0cc5b82babb8463afcdacbb30026b0c9a77afcf8f6c4dbddd5b545
|
4
|
+
data.tar.gz: f81d934981c3086071371a9013184fbb19543dd7a86ca4258addd5870defbe73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6e612eb427b6c244c365b4595d1cefb0987e43255a541accd4843cadd4c73c0c5dd96268cf6ed8444afe2c2008e4792e3ad3155474d6ec20ffb880f65c23fb7
|
7
|
+
data.tar.gz: f825fb2f339e52c9c9dae9b287b5f21436fadaaea29ed0e93b14ee0ebb97bfaaac9aa1e16eaa2549b4a66e513c1007a3f48e1aa587efe6032568f77afd85d77f
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.1.2] - 2022-05-13
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- [#1127](https://github.com/prettier/plugin-ruby/issues/1227) - mscrivo, kddnewton - Support passing the `printWidth` option.
|
14
|
+
|
9
15
|
## [3.1.1] - 2022-05-12
|
10
16
|
|
11
17
|
### Changed
|
@@ -1237,7 +1243,10 @@ would previously result in `array[]`, but now prints properly.
|
|
1237
1243
|
|
1238
1244
|
- Initial release 🎉
|
1239
1245
|
|
1240
|
-
[unreleased]: https://github.com/prettier/plugin-ruby/compare/v3.
|
1246
|
+
[unreleased]: https://github.com/prettier/plugin-ruby/compare/v3.1.2...HEAD
|
1247
|
+
[3.1.2]: https://github.com/prettier/plugin-ruby/compare/v3.1.1...v3.1.2
|
1248
|
+
[3.1.1]: https://github.com/prettier/plugin-ruby/compare/v3.1.0...v3.1.1
|
1249
|
+
[3.1.0]: https://github.com/prettier/plugin-ruby/compare/v3.0.0...v3.1.0
|
1241
1250
|
[3.0.0]: https://github.com/prettier/plugin-ruby/compare/v2.1.0...v3.0.0
|
1242
1251
|
[2.1.0]: https://github.com/prettier/plugin-ruby/compare/v2.0.0...v2.1.0
|
1243
1252
|
[2.0.0]: https://github.com/prettier/plugin-ruby/compare/v2.0.0-rc4...v2.0.0
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ end
|
|
68
68
|
|
69
69
|
## Getting started
|
70
70
|
|
71
|
-
To run `prettier` with the Ruby plugin, you're going to need [`ruby`](https://www.ruby-lang.org/en/documentation/installation/) (version `2.
|
71
|
+
To run `prettier` with the Ruby plugin, you're going to need [`ruby`](https://www.ruby-lang.org/en/documentation/installation/) (version `2.7.3` or newer) and [`node`](https://nodejs.org/en/download/) (version `8.3` or newer). If you're integrating with a project that is not already using `prettier`, you should use the Ruby gem. Otherwise you can use the `npm` package directly.
|
72
72
|
|
73
73
|
Note that currently the editor integrations work best with the `npm` package, as most of the major editor plugins expect a `node_modules` directory. You can get them to work with the Ruby gem, but it requires manually configuring the paths.
|
74
74
|
|
@@ -121,7 +121,7 @@ yarn add --dev prettier @prettier/plugin-ruby
|
|
121
121
|
You'll also need to add the necessary Ruby dependencies. You can do this by running:
|
122
122
|
|
123
123
|
```bash
|
124
|
-
gem install bundler syntax_tree syntax_tree-haml syntax_tree-rbs
|
124
|
+
gem install bundler prettier_print syntax_tree syntax_tree-haml syntax_tree-rbs
|
125
125
|
```
|
126
126
|
|
127
127
|
The `prettier` executable is now installed and ready for use:
|
data/package.json
CHANGED
data/src/parseSync.js
CHANGED
data/src/server.rb
CHANGED
@@ -6,6 +6,7 @@ require "json"
|
|
6
6
|
require "fileutils"
|
7
7
|
require "open3"
|
8
8
|
|
9
|
+
require "prettier_print"
|
9
10
|
require "syntax_tree"
|
10
11
|
require "syntax_tree/haml"
|
11
12
|
require "syntax_tree/rbs"
|
@@ -73,7 +74,8 @@ listener =
|
|
73
74
|
|
74
75
|
# Start up a new thread that will handle each successive connection.
|
75
76
|
Thread.new(server.accept_nonblock) do |socket|
|
76
|
-
parser, source =
|
77
|
+
parser, width, source =
|
78
|
+
socket.read.force_encoding("UTF-8").split("|", 3)
|
77
79
|
|
78
80
|
source.each_line do |line|
|
79
81
|
case line
|
@@ -90,16 +92,25 @@ listener =
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
95
|
+
maxwidth = width.to_i
|
93
96
|
response =
|
94
97
|
case parser
|
95
98
|
when "ping"
|
96
99
|
"pong"
|
97
100
|
when "ruby"
|
98
|
-
SyntaxTree.
|
101
|
+
formatter = SyntaxTree::Formatter.new(source, [], maxwidth)
|
102
|
+
SyntaxTree.parse(source).format(formatter)
|
103
|
+
formatter.flush
|
104
|
+
formatter.output.join
|
99
105
|
when "rbs"
|
100
|
-
SyntaxTree::RBS.
|
106
|
+
formatter = SyntaxTree::RBS::Formatter.new(source, [], maxwidth)
|
107
|
+
SyntaxTree::RBS.parse(source).format(formatter)
|
108
|
+
formatter.flush
|
109
|
+
formatter.output.join
|
101
110
|
when "haml"
|
102
|
-
|
111
|
+
PrettierPrint.format(+"", maxwidth) do |q|
|
112
|
+
SyntaxTree::Haml.parse(source).format(q)
|
113
|
+
end
|
103
114
|
end
|
104
115
|
|
105
116
|
if response
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prettier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: syntax_tree
|