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

Feature: Add option for setting indentation #2566

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

Feature: Add option for setting indentation #2566

Ledzz opened this issue Oct 7, 2016 · 15 comments

Comments

@Ledzz
Copy link

Ledzz 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
Copy link

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
Copy link
Author

Ledzz 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
Copy link
Contributor

Dupe of #1252

@ArturKwiatkowski
Copy link

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
Copy link

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

@prestonvanloon
Copy link
Contributor

@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
Copy link

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
Copy link

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

@tstackhouse
Copy link

👍

@theryansmee
Copy link

theryansmee 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
Copy link

kleber-swf 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
Copy link

I love tabs and hate spaces, plz halp!

@filipesilva
Copy link
Contributor

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

@bentaly
Copy link

bentaly commented Sep 29, 2017

@kleber-swf Genius

@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