src/nodes/strings.js in prettier-0.12.2 vs src/nodes/strings.js in prettier-0.12.3
- old
+ new
@@ -4,12 +4,12 @@
hardline,
indent,
join,
literalline,
softline
-} = require("../builders");
-const { concatBody, empty, makeList, surround } = require("../utils");
+} = require("../prettier");
+const { concatBody, empty, makeList, prefix, surround } = require("../utils");
const escapePattern = require("../escapePattern");
// If there is some part of this string that matches an escape sequence or that
// contains the interpolation pattern ("#{"), then we are locked into whichever
// quote the user chose. (If they chose single quotes, then double quoting
@@ -70,10 +70,15 @@
}
const quote = preferSingleQuotes ? "'" : '"';
return body.length === 2 ? concat([quote, body.slice(1), quote]) : body;
},
+ dyna_symbol: (path, opts, print) => {
+ const { quote } = path.getValue().body[0];
+
+ return concat([":", quote, concat(path.call(print, "body", 0)), quote]);
+ },
heredoc: (path, opts, print) => {
const { beging, ending } = path.getValue();
return concat([
beging,
@@ -127,9 +132,11 @@
}
});
return concat([quote].concat(parts).concat([quote]));
},
+ symbol: prefix(":"),
+ symbol_literal: concatBody,
word_add: concatBody,
word_new: empty,
xstring: makeList,
xstring_literal: (path, opts, print) =>
group(