@typespec/prettier-plugin-typespec 1.4.0-dev.0 → 1.4.0

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.
package/dist/index.js CHANGED
@@ -6780,7 +6780,7 @@ function printComment(commentPath, options) {
6780
6780
  case SyntaxKind.BlockComment:
6781
6781
  return printBlockComment(commentPath, options);
6782
6782
  case SyntaxKind.LineComment:
6783
- return `${options.originalText.slice(comment.pos, comment.end).trimEnd()}`;
6783
+ return `${getRawText(comment, options).trimEnd()}`;
6784
6784
  default:
6785
6785
  throw new Error(`Not a comment: ${JSON.stringify(comment)}`);
6786
6786
  }
@@ -6803,7 +6803,7 @@ function printIndentableBlockCommentContent(rawComment) {
6803
6803
  }
6804
6804
  function printDoc(path, options, print) {
6805
6805
  const node = path.node;
6806
- const rawComment = options.originalText.slice(node.pos + 3, node.end - 2);
6806
+ const rawComment = getRawText(node, options).slice(3, -2);
6807
6807
  const printed = isIndentableBlockComment(rawComment) ? printIndentableBlockCommentContent(rawComment) : rawComment.includes("\n") ? rawComment : ` ${rawComment.trim()} `;
6808
6808
  return ["/**", printed, "*/"];
6809
6809
  }
@@ -7428,7 +7428,7 @@ function isMultiline(node, options) {
7428
7428
  }
7429
7429
  function printNumberLiteral(path, options) {
7430
7430
  const node = path.node;
7431
- return getRawText(node, options);
7431
+ return node.valueAsString;
7432
7432
  }
7433
7433
  function printBooleanLiteral(path, options) {
7434
7434
  const node = path.node;
@@ -7479,6 +7479,9 @@ function trimMultilineString(lines, whitespaceIndent) {
7479
7479
  return newLines;
7480
7480
  }
7481
7481
  function getRawText(node, options) {
7482
+ if ("rawText" in node) {
7483
+ return node.rawText;
7484
+ }
7482
7485
  return options.originalText.slice(node.pos, node.end);
7483
7486
  }
7484
7487
  function hasComments(node, flags) {