brackets-typescript icon indicating copy to clipboard operation
brackets-typescript copied to clipboard

Indentation in Brackets 1.3 does not work as expected

Open rasmk opened this issue 10 years ago • 7 comments
trafficstars

After Brackets update to 1.3, TS code indentation started behaving strangely. Example:

  • I type if ( - right after I open parenthesis, the whole line jumps one or two tabs to the right
  • I continue typing 2 > 1) { - right after the brace the whole line jumps to the column 1 (all indentation spaces are removed)
  • afterwards the line remains there, subsequent lines are aligned to it

When I downgrade Brackets to 1.2, everything is fine again. Looks like a breaking change in 1.3.

So far the solution is to stay on 1.2. The problem needs a solution though. Meanwhile, is there a way to disable the formatting in the plugin with some configuration options? I had a look into the sources, but I have not found anything.

rasmk avatar Apr 29 '15 08:04 rasmk

Also having indentation problems, but only when with the : sign. Everytime I use a colon, the whole line is un-indented by either 1 indent or all indents. In the below example, adding a colon to bar, would un-indent it by 2 spaces.

interface HTMLElement {
  foo: boolean;
  bar
}

This example is more deeply indented. Adding a colon to foo, would un-indent the entire line.

  export class ApplicationDetail {
    application: st.response.applications.ApplicationInfo;
    timeline: Array<TimelineItem>;
    foo

senhongo avatar Jul 09 '15 06:07 senhongo

Just updated Brackets to 1.4 and still get the problems described by rasmk and SenHeng, it makes using typescript in Brackets quite a pain.

Treer avatar Aug 04 '15 03:08 Treer

Having the same problems in Brackets 1.4. After typing ":" or "{" it moves line indent to left. After pressing "(" it adds extra indent to right. Seeing as how common those symbols are, it makes editing quite painful. I also could not find a way to disable the auto-indentation in Brackets.

aaronbeall avatar Oct 01 '15 17:10 aaronbeall

Only way to disable auto-indent in Brackets is through the preferences file. I remember it being something like 'auto-indent' but all I could find in my prefs was smartIndent. I guess maybe the name was changed?

"smartIndent": false,

Here's a useful plug-in that shows a list of all current preferences and their default values. Should make finding the relevant tags easier.

senhongo avatar Oct 02 '15 01:10 senhongo

Still not working as of 1.5

turning smartIndent to false didn't help.

Has anyone found a solution?

JoshDrentlaw avatar Dec 27 '15 18:12 JoshDrentlaw

It worked for me when I turned off smartIndent, but it will be very helpful if there is a workaround for turn it off just when is a TypeScript file.

JJBocanegra avatar Jan 08 '16 22:01 JJBocanegra

Thanks SenHeng! it works on Brackets 1.5.

wakino avatar Feb 05 '16 01:02 wakino