Files
test-repo/changelog_unreleased/javascript/13340.md
T

466 B

Fix cursor positioning for files containing emoji (#13340 by @fisker)

$ cat test.js
const { formatWithCursor } = await import("prettier");
const code = "'😀😀😀😀'";
await formatWithCursor(code, {parser: "babel", cursorOffset: 9})

# Prettier stable
$ node test.js
{ formatted: '"😀😀😀😀";\n', cursorOffset: 5, comments: [] }

# Prettier main
$ node test.js
{ formatted: '"😀😀😀😀";\n', cursorOffset: 9, comments: [] }