Open Andrew15-5 opened 1 year ago
Here, block isn't ignored at all:
#{
let a = ""
// typstfmt::off
```anylang
anything
// typstfmt::on }
wow this skipped my attention, I'll have to take a look, thanks!
I have an idea of what's going on but it's going to be a pain to fix I suspect
This is fixed in code blocks but testing would need to be done for content blocks, args (breaking and tight) etc
Related case: https://github.com/astrale-sharp/typstfmt/pull/101
Happens not only in ignored blocks.
/* multiline
comments */
also do float each typstfmt call, and so do raw blocks
Happens not only in ignored blocks.
/* multiline comments */
also do float each typstfmt call, and so do raw blocks
That's supposed to be fixed, are you using the last version? (not on vscode yet probably)
Any updates on this? This is a major reason why I can't use typstfmt
yet.
I think ignore code block still doesn't work as intended and to fix this and many other things, a big refactoring needs to be done to make code more maintainable. At least this information was accurate about a month ago.
This is indeed a major feature without which the formatting becomes much less flexible. If I want to put 1 row per line in a table
, this feature would make it possible and can increase readability of tables. Right now, formatter puts 1 cell per line. BTW, this could be a new feature where typstfmt
would read the number of columns
and try to put x amount of args per line (opt-in or opt-out option).
But there are many other cases where ignoring only part of a file would be beneficial.
Yes I would love to see dev in this area as well, It's quite difficult for me to handle it right now
Before formatting
```typ #let template(doc) = { //typstfmt::off show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== doc } #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] ```After 1st run
```typ #let template(doc) = { //typstfmt::off show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== doc } #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] ```After 10th run
```typ #let template(doc) = { //typstfmt::off show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== doc } #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] #let template(doc) = [ //typstfmt::off #show figure.where(kind: table): it => align(center)[ #it.body ] //typstfmt::on // END ====================================================================== #doc ] ```Smaller examples:
Config:
Version: https://github.com/astrale-sharp/typstfmt/commit/578d39fb304020d0c26118e4eeab272868c9d525