-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whitespace forwarding weirdness #3
Comments
Ok, so the answer to this question is yes, and no :P So your feedback would be nice to have here. So I tried to be too smart, and make it so you could properly indent your templates, so you could read them. So what I tried to do is account for the fact that you'd indent your block, like you did and remove the extra spacing for the block. So for example, lets say I want a list of items:
I look for an opening '{' bracket, and keep track of the fact that you may have actually tabbed out the template so it is more readable, and then try to remove the tabbing in the generated content, and remove the tab when generating the string. I got frustrated having to choose between well formatted templates, or well formatted generated code - so I tried to achieve both. When you use an actual tab before your whitespace, depending upon the depth of the surrounding template logic the associated number of tabs are removed from the generated output. (This only works with tabs) Now that you've filed a bug I realize how non-intuitive it is :P What are your thoughts? |
So I to work around this try doubling the spacing |
I think that what you did with detecting the opening I did not know about the need to use tabs in Another important use case is indentation of nested templates:
I would like embedded |
This should be improved in 0.0.5, and you can now set the indent option in the options field. You can specify two spaces or a tab, etc and it will try to do the right thing. I've also updated the README to reflect this change. Thanks! |
I just realized I haven't resolved the spacing of nested templates, I will work on that next. |
Thanks a lot, will try the new changes after I get some sleep. :) |
So I was just about to write my test case for this (before I fixed it) and then realized my test case for nested templates does remove the extra indention. Does it work for you ? |
I have tried the auto-indentation with tabs and it seems to work fine. (before today's changes) Now that other indentation styles are supported I think that nested templates indentation is the only indentation problem remaining. I will test your new code as soon as I can. |
I wonder, if current indentation was available in scope it could be possible to do the following in pure js
or simply (if currentIndent was available globally)
A bit more verbose but more clean in my opinion. Now what could |
fireTs.parseSync(filename, { indent: ' ' }); Working good! |
I am generating some type definitions in C++ and it seems that whitespace before
<%parameter.type%> arg<%=i%>
is not forwarded until some other character appears there.;<%parameter.type%> arg<%=i%>
would forward the whitespace but obviously I would like to change this behaviour. Is that a bug?The text was updated successfully, but these errors were encountered: