Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change number of spaces in tabs for all generated files #3219

Closed
thardy opened this issue Nov 21, 2016 · 10 comments
Closed

Change number of spaces in tabs for all generated files #3219

thardy opened this issue Nov 21, 2016 · 10 comments

Comments

@thardy
Copy link

thardy commented Nov 21, 2016

This was already mentioned in #1252, but since that was ignored/closed without any resolution, I will open a new issue. The number of tabs angular-cli uses in all generated files needs to be configurable.

It's very frustrating to have to fight our editors whenever we use angular-cli to generate files. That goes against the entire purpose of the cli as a convenience mechanism. Most modern editors try hard to honor an existing file's tab spacing, causing angular-cli users to have to fight their editor whenever they generate a new file. We would also like to be able to keep our editors functioning this way for when we edit other people's source code. For source code we author ourselves, however, we'd like to control exactly how many spaces are used in tabs without having to fight against our code generation tools.

@Igonato
Copy link

Igonato commented Nov 27, 2016

Overridable/custom templates for ng generate would be nice. This way you can at least copy all the standard files and edit them for the desired tabulation. Also being able to make brand new generate snippets would be really cool.

@Igonato
Copy link

Igonato commented Nov 27, 2016

How about making generate command look in the project_dir/src/blueprints first, and only after check blueprints provided by angular-cli?
@filipesilva what do you think about this as a compromise?

@thardy-pd
Copy link

I like the idea of having a specific folder that angular-cli looks for and, if present, will use any templates present in that folder to override any default templates. That's what Visual Studio did for most of its T4 templates, and it's a system that works very well.

Just publish the names of the templates and the default templates themselves, so we can modify them.

Any codegen solution is only as useful as it is customizable.

@ush189
Copy link

ush189 commented Dec 17, 2016

I also would very much like the possibilty to configure the tab size in any way.

@Brocco
Copy link
Contributor

Brocco commented Dec 17, 2016

@thardy I understand the issue you are having here and it's not a trivial one to solve in a way that will make everyone happy. On the roadmap for the CLI is to provide the ability to have custom blueprints for all generations, so you will be able to have your own blueprints in the future. For right now, we are going to rely on editors/IDEs to handle the re-formatting of generated files so that developers can tailor their environments to how they and their team want their files formatted.

To further explain it is not just a matter of simply specifying the number of tabs or spaces. There are many file formats to consider (i.e. *.ts *.json *.html) that some teams want to mix tabs vs spaces.

I know this is likely not the response/answer you were looking for, but I ask for your patience as we do have a plan to deal with this to ease your frustrations.

I'm going to leave this open for further discussion.

@thardy
Copy link
Author

thardy commented Dec 18, 2016

I agree that the best and most comprehensive solution is custom blueprints. That way, everyone can do exactly what they want, when they want.

It's good to hear that's on the roadmap. Thanks for your response.

@equinox
Copy link
Contributor

equinox commented Dec 20, 2016

@Brocco What happened to keeping it open?

@Brocco
Copy link
Contributor

Brocco commented Dec 20, 2016

The consensus between the OP (@thardy) and I was sufficient for me to know that this issue is OK to be accommodated currently by IDEs/editors and addressed with custom blueprints in the future.

@filipesilva
Copy link
Contributor

filipesilva commented May 11, 2017

This should be available soon-ish via automatically running TS Lint fixers on generators. This is being tracked in #6272.

Edit: actually #6272 (currently) will only allow spaces->tabs, not 4 spaces -> 2 spaces. There is an open feature request on TS Lint for that functionality: palantir/tslint#581.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants