Open innocenzi opened 1 year ago
This feels a bit like recast's bug to me. As I checked, we seems to be detecting them correctly and passing { useTabs: true, tabWidth: 1 }
. And normally I think when useTabs
is set, tabWidth
should be ignored, but in real, it actually affects how many tabs are generated (passing 2 makes it generate fewer tabs somehow).
Could use some help if anyone wants to go deeper on it.
@antfu I assume tabWidth is a bit like the ts
query parameter in github. If the indentation is 2 tabs in your code, and you set ?ts=2
in any GitHub URL, the 2 tabs will look like 4 spaces. Similarly if you do ?ts=4
, 4 tabs will look like 4 spaces.
Hence I guess tabWidth: 1
tells the generator that to preserve the look of 4 spaces, insert 4 tabs there.
Environment
magicast@0.2 typescript@5.0.3 node@19.8.1
Reproduction
Describe the bug
In the reproduction above, the indentation of
plugins
is a single tab. However, the generated code uses four tabs.Additional context
Result:
Expected: