plugin-pug icon indicating copy to clipboard operation
plugin-pug copied to clipboard

Bug: removes 2nd block with angular interpolation

Open valera33 opened this issue 5 years ago • 2 comments

Info

Tool Version
Plugin v1.1.9
Prettier v1.19.1
Node v13.6.0
OS linux

Input

foo(title="{{'something' | translate}} - {{'something else' | translate}}")

Output or Error

foo(title="{{ 'something' | translate }}")

Expected Output

foo(title="{{ 'something' | translate }} - {{ 'something else' | translate }}")

valera33 avatar Mar 10 '20 09:03 valera33

I think that thats coming from starts and ends with {{...}} Have to check the middle of the string

https://github.com/prettier/plugin-pug/blob/e74dbb33ac6b2a6ac6a3c4844298653b5235f066/src/utils/angular.ts#L77

Hope I have time for this soon

Shinigami92 avatar Mar 10 '20 11:03 Shinigami92

At that time, I'm going to release a hotfix for this issue: https://github.com/prettier/plugin-pug/commit/1968c8cbe4919f747ad25a9d23522309d913bcaa

However, this only suppresses formatting if there is more than one binding within an attribute value. Therefore you have to format them yourself.

Shinigami92 avatar Mar 14 '20 09:03 Shinigami92