prettier 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/package.json +1 -1
- data/src/parser/server.rb +2 -2
- data/src/ruby/embed.js +7 -5
- data/src/ruby/nodes/heredocs.js +5 -3
- data/src/ruby/parser.rb +6 -0
- data/src/utils.js +1 -1
- data/src/utils/literallineWithoutBreakParent.js +7 -0
- metadata +3 -3
- data/src/utils/literalLineNoBreak.js +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97cf5963c684d5bf17079800c59b79fb15f787c89c1b1d7bd315c3851307737f
|
4
|
+
data.tar.gz: 721e04eaa93f654d873e2b972b718b3d1db41d7acca278b8eec743aa92daf755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe8997d3c57f9ed1d6cc23d198555c51d234dd856d0e3803879fb4a92809204fcb5d8b70e0a02421e902d9fd4d33e34e02e7e6ccd778caef203ce3aa7b6c6037
|
7
|
+
data.tar.gz: 91656de653ca7b90469dfbc3e6363259d3e9977693e649846d0bc4fd39e0585798f985334b1895790efbb9613f39ba35dce3193aecb59844d0f419d0da2c5bf0
|
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
|
+
## [1.5.2] - 2021-02-03
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- kddeisz - Fix up `binary` node comparison operators so that it will handle either Symbol literals or the `@op` nodes which are incorrectly coming from JRuby (https://github.com/jruby/jruby/issues/6548).
|
14
|
+
|
9
15
|
## [1.5.1] - 2021-01-27
|
10
16
|
|
11
17
|
### Changed
|
@@ -199,7 +205,7 @@ end
|
|
199
205
|
- kddeisz - Fix up a bug with constant aliases, e.g., `alias in IN`.
|
200
206
|
- andyw8, kddeisz - Ensure `rescue` comments stay on the same line as their declaration.
|
201
207
|
|
202
|
-
|
208
|
+
## [0.22.0] - 2020-12-08
|
203
209
|
|
204
210
|
### Changed
|
205
211
|
|
@@ -1071,7 +1077,8 @@ would previously result in `array[]`, but now prints properly.
|
|
1071
1077
|
|
1072
1078
|
- Initial release 🎉
|
1073
1079
|
|
1074
|
-
[unreleased]: https://github.com/prettier/plugin-ruby/compare/v1.5.
|
1080
|
+
[unreleased]: https://github.com/prettier/plugin-ruby/compare/v1.5.2...HEAD
|
1081
|
+
[1.5.2]: https://github.com/prettier/plugin-ruby/compare/v1.5.1...v1.5.2
|
1075
1082
|
[1.5.1]: https://github.com/prettier/plugin-ruby/compare/v1.5.0...v1.5.1
|
1076
1083
|
[1.5.0]: https://github.com/prettier/plugin-ruby/compare/v1.4.0...v1.5.0
|
1077
1084
|
[1.4.0]: https://github.com/prettier/plugin-ruby/compare/v1.3.0...v1.4.0
|
data/package.json
CHANGED
data/src/parser/server.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'bundler/setup' if ENV['
|
3
|
+
require 'bundler/setup' if ENV['PLUGIN_RUBY_CI']
|
4
4
|
require 'socket'
|
5
5
|
require 'json'
|
6
6
|
|
@@ -14,7 +14,7 @@ $PROGRAM_NAME = 'prettier-ruby-parser'
|
|
14
14
|
# Make sure we trap these signals to be sure we get the quit command coming from
|
15
15
|
# the parent node process
|
16
16
|
quit = false
|
17
|
-
trap(:QUIT) { quit = true }
|
17
|
+
trap(:QUIT) { quit = true } if RUBY_PLATFORM != 'java'
|
18
18
|
trap(:INT) { quit = true }
|
19
19
|
trap(:TERM) { quit = true }
|
20
20
|
|
data/src/ruby/embed.js
CHANGED
@@ -8,7 +8,7 @@ const {
|
|
8
8
|
stripTrailingHardline
|
9
9
|
} = require("../prettier");
|
10
10
|
|
11
|
-
const {
|
11
|
+
const { literallineWithoutBreakParent } = require("../utils");
|
12
12
|
|
13
13
|
const parsers = {
|
14
14
|
css: "css",
|
@@ -30,7 +30,7 @@ function replaceNewlines(doc) {
|
|
30
30
|
? concat(
|
31
31
|
currentDoc
|
32
32
|
.split(/(\n)/g)
|
33
|
-
.map((v, i) => (i % 2 === 0 ? v :
|
33
|
+
.map((v, i) => (i % 2 === 0 ? v : literallineWithoutBreakParent))
|
34
34
|
)
|
35
35
|
: currentDoc
|
36
36
|
);
|
@@ -106,7 +106,7 @@ function embed(path, print, textToDoc, _opts) {
|
|
106
106
|
|
107
107
|
// Pass that content into the embedded parser. Get back the doc node.
|
108
108
|
const formatted = concat([
|
109
|
-
|
109
|
+
literallineWithoutBreakParent,
|
110
110
|
replaceNewlines(stripTrailingHardline(textToDoc(content, { parser })))
|
111
111
|
]);
|
112
112
|
|
@@ -119,7 +119,7 @@ function embed(path, print, textToDoc, _opts) {
|
|
119
119
|
group(
|
120
120
|
concat([
|
121
121
|
indent(markAsRoot(formatted)),
|
122
|
-
|
122
|
+
literallineWithoutBreakParent,
|
123
123
|
ending.trim()
|
124
124
|
])
|
125
125
|
)
|
@@ -132,7 +132,9 @@ function embed(path, print, textToDoc, _opts) {
|
|
132
132
|
return markAsRoot(
|
133
133
|
concat([
|
134
134
|
path.call(print, "beging"),
|
135
|
-
lineSuffix(
|
135
|
+
lineSuffix(
|
136
|
+
group(concat([formatted, literallineWithoutBreakParent, ending.trim()]))
|
137
|
+
)
|
136
138
|
])
|
137
139
|
);
|
138
140
|
}
|
data/src/ruby/nodes/heredocs.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { concat, group, lineSuffix, join } = require("../../prettier");
|
2
|
-
const {
|
2
|
+
const { literallineWithoutBreakParent } = require("../../utils");
|
3
3
|
|
4
4
|
function printHeredoc(path, opts, print) {
|
5
5
|
const { body, ending } = path.getValue();
|
@@ -11,7 +11,7 @@ function printHeredoc(path, opts, print) {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
// In this case, the part of the string is just regular string content
|
14
|
-
return join(
|
14
|
+
return join(literallineWithoutBreakParent, part.body.split("\n"));
|
15
15
|
});
|
16
16
|
|
17
17
|
// We use a literalline break because matching indentation is required
|
@@ -23,7 +23,9 @@ function printHeredoc(path, opts, print) {
|
|
23
23
|
concat([
|
24
24
|
path.call(print, "beging"),
|
25
25
|
lineSuffix(
|
26
|
-
group(
|
26
|
+
group(
|
27
|
+
concat([literallineWithoutBreakParent].concat(parts).concat(ending))
|
28
|
+
)
|
27
29
|
)
|
28
30
|
])
|
29
31
|
);
|
data/src/ruby/parser.rb
CHANGED
@@ -565,6 +565,12 @@ class Prettier::Parser < Ripper
|
|
565
565
|
# binary is a parser event that represents a binary operation between two
|
566
566
|
# values.
|
567
567
|
def on_binary(left, oper, right)
|
568
|
+
# On most Ruby implementations, oper is a Symbol that represents that
|
569
|
+
# operation being performed. For instance in the example `1 < 2`, the `oper`
|
570
|
+
# object would be `:<`. However, on JRuby, it's an `@op` node, so here we're
|
571
|
+
# going to explicitly convert it into the same normalized form.
|
572
|
+
oper = scanner_events.delete(oper)[:body] unless oper.is_a?(Symbol)
|
573
|
+
|
568
574
|
{
|
569
575
|
type: :binary,
|
570
576
|
body: [left, oper, right],
|
data/src/utils.js
CHANGED
@@ -5,7 +5,7 @@ module.exports = {
|
|
5
5
|
isEmptyStmts: require("./utils/isEmptyStmts"),
|
6
6
|
hasAncestor: require("./utils/hasAncestor"),
|
7
7
|
literal: require("./utils/literal"),
|
8
|
-
|
8
|
+
literallineWithoutBreakParent: require("./utils/literallineWithoutBreakParent"),
|
9
9
|
makeCall: require("./utils/makeCall"),
|
10
10
|
noIndent: require("./utils/noIndent"),
|
11
11
|
printEmptyCollection: require("./utils/printEmptyCollection"),
|
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: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Deisz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -100,7 +100,7 @@ files:
|
|
100
100
|
- src/utils/isEmptyBodyStmt.js
|
101
101
|
- src/utils/isEmptyStmts.js
|
102
102
|
- src/utils/literal.js
|
103
|
-
- src/utils/
|
103
|
+
- src/utils/literallineWithoutBreakParent.js
|
104
104
|
- src/utils/makeCall.js
|
105
105
|
- src/utils/noIndent.js
|
106
106
|
- src/utils/printEmptyCollection.js
|