Skip to content
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

Feature: Add option for setting indentation #2566

Closed
Ledzz opened this issue Oct 7, 2016 · 15 comments

Comments

@Ledzz
Copy link

commented Oct 7, 2016

I think I'm not the only one who prefers tabs to spaces. Also I know that many people use different space count on indentation.
I suggest adding defaults.indent option to angular-cli.json.

@fullstackdave

This comment has been minimized.

Copy link

commented Oct 7, 2016

Curious, what would this be used for? I am assuming you are talking about how the code is laid out; couldn't you modify that in your IDE?

@Ledzz

This comment has been minimized.

Copy link
Author

commented Oct 7, 2016

@fullstackdave yes, ofc I can, but I have to do this with every file file generated. I think I can automate it (I'm using Sublime Text 3), but I use it for other projects and I don't know how to do it without any problems with other files.

@filipesilva

This comment has been minimized.

Copy link
Member

commented Oct 10, 2016

Dupe of #1252

@ArturKwiatkowski

This comment has been minimized.

Copy link

commented Mar 24, 2017

Well, that referenced issue didn't end too good.

Quite frankly I do not understand why there is a really nice .editorconfig but after setting the indent_size to 4 from 2 and executing ng g component mycomponent I still have to use the inbuilt option in visual studio code to format document to be 4 spaces long for each tab as I set it in my preferences. Just why this file is there if CLI ignores it? Does it also ignores rest of it or just this one option?

This really isn't an issue for professional programmers who know their tools but from time to time you can get that amazing opportunity to have an intern on your project who will touch the codebase and I think this option could be helpful for those guys and also you're gonna have one thing less on your list of things you have to watch that guy for.

@mpragliola

This comment has been minimized.

Copy link

commented Apr 11, 2017

+1 I really don't understand, I have to re-edit everytime the scaffolded files

@prestonvanloon

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2017

@mpragliola the blueprint files are tab space 2. There isn't a setting to change tab space, you would need a whole new blueprint with tab space 4 or run some formatter on the newly generated file with your config settings.

@froodley

This comment has been minimized.

Copy link

commented Apr 18, 2017

Yeah, that other thread aside... I'm with everyone else who would like this feature, and it seems like if you have the value set in .editorconfig it should be honored. Having to reformat everything the cli generates is not desirable.

@prestonvanloon what about replacing the double-spaces with an arbitrary character and then using the .editorconfig to replace that character on the way out?

@AneelaBrister

This comment has been minimized.

Copy link

commented Apr 24, 2017

I would also like the feature to generate components etc. with tabs instead of spaces. Thank you.

@tstackhouse

This comment has been minimized.

Copy link

commented May 2, 2017

👍

@theryansmee

This comment has been minimized.

Copy link

commented May 6, 2017

Agreed. I am loving the CLI but i spend half my time converting from tabs to spaces and then 2-4 width.. To have this configurable would be the polish on an otherwise super useful tool.

@kleber-swf

This comment has been minimized.

Copy link

commented May 7, 2017

Since it seems that this issue will not be fixed anytime soon and since it takes some time to manually format the files every time I create a component (and I create them very often), I've made an ugly, not recomended workaround for this: I edited the file npm_modules/@angular/cli/blueprints/component/files/__path__/__name__.component.ts to have my usual formatting (with tabs).

Please note that this is a workaround and it's not recommended.

And please, please, let's not argue what is "best" or "right" about using tabs, spaces or their sizes. Let's just accept that each professional likes the configuration that is best for their eyes 😃

@iliketomatoes

This comment has been minimized.

Copy link

commented May 11, 2017

I love tabs and hate spaces, plz halp!

@filipesilva

This comment has been minimized.

Copy link
Member

commented May 12, 2017

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

@bentaly

This comment has been minimized.

Copy link

commented Sep 29, 2017

@kleber-swf Genius

@angular-automatic-lock-bot

This comment has been minimized.

Copy link

commented Sep 7, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.