panoply / vscode-liquid

đź’§Liquid language support for VS Code
https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid
Other
171 stars 22 forks source link

New update corrupts my files #100

Closed idwithin1 closed 1 year ago

idwithin1 commented 1 year ago

Hi there, I updated to the new version and every time I try to save any file, specifically a .liquid - something happens where all my formatting changes, and code starts getting erased and things change randomly etc. Whatever happened in the new version does not play nice with editing and trying to save new files. I had to disable it so I could edit my files again.

It is really messing up my files. A shame as this was a great plugin yet whatever happened to this new update has warped it greatly for me.

panoply commented 1 year ago

Hey @idwithin1, did you have a look a the release notes and readme? This does not sound right. You can use the previous versions as per the documentation here.

I'd love to be able to help you with your issues, I need more insight to your setup and we can get it figured out.

idwithin1 commented 1 year ago

Hi there I made a quick video. I never saw your release notes or anything. Just went to edit a site earlier today and it almost destroyed it. Obv I use Github so was able to reverse changes. But as you can see when I re-upgrade and try to edit a file and save it. Everything goes to hell - https://shared-assets.adobe.com/link/23265282-c37c-493e-5525-a6b9f438ecec

panoply commented 1 year ago

Oke, I see. So this actually the intended result.

The extension applies beautification to the .css.liquid and .scss.liquid files automatically. It will also go ahead and combine all your selectors and refine everything in your file. It is not actually a bug or glitch, but a feature. The changes shipped in this version are going to be a big transition for a lot of users, so of course continue using v2.3.0 until you feel ready to move to v3.0.0.

In hindsight, I think it might a tad alarming to users to have automatic beautification applied automatically, as I definitely don't developers to panic when this happens. I appreciate you submitting the issue. I will ship a patch and make this opt-in this evening.

Some additional Information

You can exclude beautification from being applied on save a few different ways. You can add the following settings to your vscode workspace settings:

{
  "[liquid-css]": {
     "editor.formatOnSave": false // This will disable that behavior. 
  }
}

Alternatively, you can exclude files using liquid.format.ignore option or by adding a /* @prettify-ignore */ comment at the top of CSS documents you don't want to format.

Definitely have a look at the Release Notes. The new version no longer supports completions for suffixed stylesheets, eg: css.liquid but I'd be happy to revert that if folks still heavily rely on it like yourself.

Lastly, when you do feel ready to transition, you may need to configure the beautification rules for style and customize them to your liking. The new release supports beautification of CSS and Liquid together.

Hope this Helps.

panoply commented 1 year ago

Closing this as the v3.0.1 patch no longer assumes beautification on default configurations. I will upstream all CSS beautification issues to Prettify. @MaxDesignFR has put some time into testing and reporting on defects in CSS, so anything that persists will be addressed in that project starting with his finds.

Thanks for submitting the issue and taking the time to make a video.

idwithin1 commented 1 year ago

Hey so even though it’s a feature it’s still something I don’t think should happen automatically.

It didn’t even beautify my css it actually destroyed it, and a lot of the liquid code as well. So it’s definitely not working. As it really screwed up my website.

Good attempt but maybe this should be an option left for people to turn on since it seems to be so experimental. Looks like it still needs work as the experience I had with it was dreadful.

From: ΝΙΚΟΛΑΣ @.> Sent: Wednesday, 28 September 2022 7:35 PM To: panoply/vscode-liquid @.> Cc: idwithin1 @.>; Mention @.> Subject: Re: [panoply/vscode-liquid] New update corrupts my files (Issue #100)

Oke, I see. So this actually the intended result.

The extension applies beautification to the .css.liquid and .scss.liquid files automatically. It will also go ahead and combine all your selectors and refine everything in your file. It is not actually a bug or glitch, but a feature. The changes shipped in this version are going to be a big transition for a lot of users, so of course continue using v2.3.0 until you feel ready to move to v3.0.0.

In hindsight, I think it might a tad alarming to users to have automatic beautification applied automatically, as I definitely don't developers to panic when this happens. I appreciate you submitting the issue. I will ship a patch and make this opt-in this evening.

Some additional Information

You can exclude beautification from being applied on save a few different ways. You can add the following settings to your vscode workspace settings:

{ "[liquid-css]": { "editor.formatOnSave": false // This will disable that behavior. } }

Alternatively, you can exclude files using liquid.format.ignore option or by adding a / @prettify-ignore / comment at the top of CSS documents you don't want to format.

Definitely have a look at the Release Notes https://github.com/panoply/vscode-liquid/releases/tag/v3.0.0 . The new version no longer supports completions for suffixed stylesheets, eg: css.liquid but I'd be happy to revert that if folks still heavily rely on it like yourself.

Lastly, when you do feel ready to transition, you may need to configure the beautification rules for style and customize them to your liking. The new release supports beautification of CSS and Liquid together.

Hope this Helps.

— Reply to this email directly, view it on GitHub https://github.com/panoply/vscode-liquid/issues/100#issuecomment-1261238654 , or unsubscribe https://github.com/notifications/unsubscribe-auth/APPJHD6LGJ2ZMBAQJRVP7SDWAR6VNANCNFSM6AAAAAAQX4YDY4 . You are receiving this because you were mentioned. https://github.com/notifications/beacon/APPJHDYTEPVRLXWNOYVWAEDWAR6VNA5CNFSM6AAAAAAQX4YDY6WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSLFT4X4.gif Message ID: @. @.> >

panoply commented 1 year ago

Revisited this and you were right. Pseudo selectors were wreaking havoc. I have addressed the issues in f662b00 and v3.1 will ship the corrections.

Thanks for taking the time to submit the issue.

panoply commented 1 year ago

Large refactor applied for Style formatting available in 3.1.0 should resolve these.