saschakiefer / generator-openui5

yeoman generator for OpenUI5 applications and assets
Other
64 stars 17 forks source link

rewrite() in utils.js only preserves formatting when using spaces - fails when using tabs in editor #55

Closed js1972 closed 10 years ago

js1972 commented 10 years ago

The logic used to prefix the splicable with spaces needs to account for the fact that the index.html might be written using tabs instead of spaces. It just so happens that our classical app generator has an index.html that still uses space instead of tabs.

saschakiefer commented 10 years ago

I copied your coding from your commit, but it doesn't seem to work. Maybe you can check that again.

js1972 commented 10 years ago

Hmm. Was working ok. Just the end result formatting was not perfect. The current code indents to the same level as the needle. When I'm adding to the bootstrap I need to add an extra indent. Plus I need to add logic to put a comma on the previous line as we're actually adding out applicable to json on this case. If you've pushed all these changes you've done up to "develop" I'll take a look and fix up what I can on Monday.

On Sat, Feb 22, 2014 at 1:36 AM, saschakiefer notifications@github.com wrote:

I copied your coding from your commit, but it doesn't seem to work. Maybe you can check that again.

Reply to this email directly or view it on GitHub: https://github.com/saschakiefer/generator-openui5/issues/55#issuecomment-35753519

saschakiefer commented 10 years ago

Yeah, I pushed everything. It's just the indents that seems to have issues. Maybe I get a chance to debug it today or tomorrow. I'll let you know if I find sth. out.

js1972 commented 10 years ago

As can be seen here - if the index.html uses all spaces or all tabs and not mixed whitespace the formatting is correct.: image

Now just need to enhance the logic with options to increase the indent and add a comma to the previous line...

js1972 commented 10 years ago

Think of a good way to test this re-write functionality. Probably easiest to use a dummy index.html file and add the test to the sub-generators...

saschakiefer commented 10 years ago

That's what I planned anyways ;-) But more on the "is the content there" level. Not sure about the formatting...