Open arnaudgolfouse opened 11 months ago
Testing it further, there is also this weird thing:
A code block:
```rust
if b {
let x = 2;
}
Formats to
````typst
A code block: ```rust
if b {
let x = 2;
}
A code block:
rust if b { let x = 2; }
I just fixed this
REMARK: To motivate against using a hack (like "look inside the markup block, and if it contains a
Raw
don't add indentation!"), let me use the following example:
I agree since for this example we would need the hack to be in code blocks and list enum and ....
I discovered a similar issue:
text[
J'ai fait un snippet neovim qui crée des banners ! ```
//////////////////////
// This is a banner //
//////////////////////
```]
This is a combination of a few problems. First, the opening of the backticks gets shifted to the line above; secondly, the closing ]
gets wrapped around the code block. Lastly, the raw block drifts to the right, as this issues suggests.
Thank you for your time spent on this project! It makes typst even more awesome. Have a nice day =)
Thank you for your kind words <3
I think disabling raw text formatting until this is fixed could be a good idea as it messes up real bad any raw block (if saving regularly), i know this can be done manually but as it is a known issue for many
Not against reviewing someone doing that, I'm less and less motivated to work on this to be honest
How do you turn off raw text formatting?
I don't think you can unfortunately, maybe take a look at typstyles https://github.com/Enter-tainer/typstyle/
[x] I have tested with the master version of typstfmt and not just typst-lsp
Describe the bug
So, uh, sorry to bring this up again, but:
In this case, we enter the third branch, and call
ctx.push_raw_indent(s, &mut res);
BUT: herenode.kind()
is not, as one might expect,Raw
(which would allow filtering it somehow), butMarkup
(which internally contains aRaw
) !!Overall, I think simply adding an offset as
push_raw_indent
does is not the right thing to do here. I don't really know how to fix that.REMARK: To motivate against using a hack (like "look inside the markup block, and if it contains a
Raw
don't add indentation!"), let me use the following example:}