typstfmt icon indicating copy to clipboard operation
typstfmt copied to clipboard

Open tag leads to wrong formatting

Open haenoe opened this issue 1 year ago • 5 comments

Hey! Many thanks for your work on this project which keeps my thesis nice and clean ^^' I'm not entirely sure if this is intended behavior or if this can be fixed easily. If it is intended - sorry! If it isn't I would be glad to assist to find a good solution to the problem :D Thank you very much!

  • [x] I have tested with the master version of typstfmt and not just typst-lsp

Describe the bug

When having an open tag #cite( typst-fmt tries to inline the rest of the document (and doesn't respect boundaries like newlines, headings etc.)

To Reproduce

Works on simple document

#cite(
// Newline

= Level 1
== Level 2

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

After format

#cite(
  // Newline
   = Level1 == Level2Loremipsumdolorsitamet, consetetursadipscingelitr, seddiamnonumyeirmodtemporinviduntutlaboreetdoloremagnaaliquyamerat, seddiamvoluptua.

The problem is that, after closing #cite(), typst-fmt can't reconstruct the original syntax tree.

haenoe avatar Feb 08 '24 09:02 haenoe