microsoft / vscode-html-languageservice

Language services for HTML
MIT License
220 stars 109 forks source link

Add new angular templating option from js-beautify v1.15.1 #177

Open bitwiseman opened 6 months ago

bitwiseman commented 6 months ago

js-beautify v1.15.1 added a new setting to support indenting of Angular at-string syntax (https://github.com/beautifier/js-beautify/pull/2247).

Previous additions were on-by-default. This new feature causes problems for non-angular users, so it is off by default.

It looks like the settings will need to be updated to allow supplying a list of templating formatters and add angular as an option:

https://github.com/microsoft/vscode-html-languageservice/blob/81cf18fc8aca3ac4ea1e5a99864731a3757260be/src/htmlLanguageTypes.ts#L31-L48

https://github.com/microsoft/vscode-html-languageservice/blob/81cf18fc8aca3ac4ea1e5a99864731a3757260be/src/beautify/beautify-html.d.ts#L119

simon-knu commented 6 months ago

Can we have some news about this ? Do you consider it ?

@bitwiseman did all the hard work 👍 Thanks for that BTW

It's been weeks since Angular 17 was released and the only option we have now is to change our code formatter... or do it manually

I just want to know if you plan to add the option shortly, could you provide some info ?

parliament718 commented 6 months ago

Can we have some news about this ? Do you consider it ?

@bitwiseman did all the hard work 👍 Thanks for that BTW

It's been weeks since Angular 17 was released and the only option we have now is to change our code formatter... or do it manually

I just want to know if you plan to add the option shortly, could you provide some info ?

Weeks? It's been 5 months since Angular 17 was released and still no basic formatting support. Sad. I wonder how many thousands of teams had no choice but to switch to Prettier and now hate their lives.

bitwiseman commented 6 months ago

@bitwiseman did all the hard work 👍 Thanks for that BTW

Thank you, but I should point out that the implementation in the library was done by a Beautifier contributor, @gergely-gyorgy-both .

My intent in providing the links to the code locations above was to help another contributor zero in on the code that needs updating here. I hope someone has time to submit a PR for this soon.

ssougnez commented 6 months ago

I don't mean to be rushing this, but can this PR be reviewed or merged? Control flow are available in Angular for months now and we're still unable to use it without this feature. This is pretty blocking in the Angular upgrade path.

Thanks

NesTeRDGIT commented 5 months ago

I created an extension where you can change the templating option for js-beautify. As a temporary solution to the problem. While VSCode finishes the PR ps this is my first extention for VSCode, possible errors..

link: https://marketplace.visualstudio.com/items?itemName=nesterenok.js-beautify-extentions For support for Angular control flow formatting: set parameters: [js-beautify-for-vscode:html.templating] = ['angular']

thaoula commented 5 months ago

I created an extension where you can change the templating option for js-beautify. As a temporary solution to the problem. While VSCode finishes the PR ps this is my first extention for VSCode, possible errors..

link: https://marketplace.visualstudio.com/items?itemName=nesterenok.js-beautify-extentions For support for Angular control flow formatting: set parameters: [js-beautify-for-vscode:html.templating] = ['angular'] [html.format.indentHandlebars]: true

Many thanks @NesTeRDGIT

ssougnez commented 5 months ago

I created an extension where you can change the templating option for js-beautify. As a temporary solution to the problem. While VSCode finishes the PR ps this is my first extention for VSCode, possible errors..

link: https://marketplace.visualstudio.com/items?itemName=nesterenok.js-beautify-extentions For support for Angular control flow formatting: set parameters: [js-beautify-for-vscode:html.templating] = ['angular'] [html.format.indentHandlebars]: true

You're a life saver !