Skip to content

Suggestion: typescript.format.rememberManuallyFormattedCode #14601

@alialtun14

Description

@alialtun14

Most of the time, it's needed to format some part of code manually by developers to align the code vertically.

For example: in the following code that is formatted by typescript formatter,

constructor (public http: Http, public chd: ChangeDetectorRef) {
	this.ctx.customer_exp = { sel: { "new0.customer": "id" } };
	this.ctx.perso_exp = { sel: { "new0.perso": "id" } };
	this.ctx.car_exp = { sel: { "new0.car": "id" } };
}

I changed format of some part to improve readability of the formatted code, After changing the code is like this

constructor (public http: Http, public chd: ChangeDetectorRef) {
    this.ctx.customer_exp = {sel: { "new0.customer": "id" }};
    this.ctx.perso_exp    = {sel: { "new0.perso"   : "id" }};
    this.ctx.car_exp      = {sel: { "new0.car"     : "id" }};
}

It would be nice, typescript formatter remember code that manually formatted part and protect them.

According to my opinion if this is possible, no longer needed to align colons automatically.

In connection with this property, following value can be added to settings file.

typescript.format.rememberManuallyFormattedCodePart = true;

Otherwise to find a common solution that will be a solution for everyone is very difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixedVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions