adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.25k stars 7.63k forks source link

Remove indentation from blank line after adding another line #10512

Open alizahid opened 9 years ago

alizahid commented 9 years ago

Updated issue

When I insert a few lines, they're all indented to my cursor's current position but after I insert another line, they don't clear up. This video illustrates what I mean.

Is there a way to deal with that? E.g., Android Studio and Sublime Text add those tabs but remove them if I press enter again to move to the next line.

Old issue

Hi. I have a slightly different style of writing code than the "standard" way, as seen in this video.

$.ajax('url.php',
{
    var: value,
    var: value

}).then(function()
{
    // what?

}, function()
{
    // hello

});

If you watch the video, you'll notice the indentation problems that I run into. Is there a setting I can tweak to fix this? It really kills my flow and messes with my OCD big-time.

For reference, here's a video of the more popular / standard of coding.

Thanks.

redmunds commented 9 years ago

@alizahid Take a look at the list of supported preferences. I think setting "smartIndent": false will fix that.

alizahid commented 9 years ago

It has, thank you!

Also, when I insert a few lines, they're all indented to my cursor's current position but after I insert another line, they don't clear up. This video illustrates what I mean.

Is there a way to deal with that? E.g., Android Studio and Sublime Text add those tabs but remove them if I press enter again to move to the next line.

redmunds commented 9 years ago

@alizahid No, there's currently no way to do that in Brackets. That would be nice. I think Visual Studio also does that. Update the Title and Description of this Issue to describe the desired behavior for this Feature Request.

alizahid commented 9 years ago

@redmunds It would definitely be nice. I'm used to it, and it's kinda annoying not having it.

I've updated the title + description. Did I do that correctly?

redmunds commented 9 years ago

@alizahid I think this looks good.

This needs to be a preference, because I know some people would not want this.

You only want this to clear indentation that you recently inserted (not any indentation), right? If so, that might be tricky to get right.

ChamuMutezva commented 5 years ago

Visual studio has made life easier. You can simply right click on an open file and select "Format Document", its not properly indented.