panoply / vscode-liquid

💧Liquid language support for VS Code
https://marketplace.visualstudio.com/items?itemName=sissel.shopify-liquid
Other
173 stars 22 forks source link

Formatting issues despite the formatter being disabled #150

Closed richayles closed 1 year ago

richayles commented 1 year ago

image

Have a schema block laid out as below image I have made a single space addition to the end of the line - and on hitting save it reformats the whole JSON I've tried a number of different setting change configurations - but it always results in the same auto indent happening image

The below seems quite temperamental and clicking on it has no effect at times, and it re-enables itself between changing between files image

Hoping this is all resolved by v3.4 - is there an expected release date?

Arifursdev commented 1 year ago

yes.. it seems this is broken.. despite disabling with { "liquid.format.enable": false }

it still is the default formatter and formats code on save.

I suggest installing the 3.0 version , it doesn't have that bug

panoply commented 1 year ago

Hey guys,

I apologize for being so late in getting this addressed. I have had a really busy 2023 so far. I am working on this from tomorrow. If you want to turn off formatting, you need to do this using Language Specific VSCode settings, for example:

In your workspace settings:

  "[liquid]": {
    "editor.defaultFormatter": "sissel.shopify-liquid",
    "editor.formatOnSave": false // Make this false
  },

This will turn off formatting.

Additional Context

The liquid.format.enable option will actually be deprecated in the next version (see #132) and moving forward, formatting will be applied using vscode language specific settings (as above). The only reason this option still exists is because of legacy reasons. See #138 PR for more info.

panoply commented 1 year ago

@richayles FYI: This is the default behaviour for external code regions in markup. This is why your schema is being indented. It follows common standard when formatting structures. I can look into introducing a rule within Æsthetic to counter that behaviour.

Let me know.

panoply commented 1 year ago

@richayles I'll introduce a new rule to adhere to this behaviour in v4.0.0 which will be made available to the new liquid ruleset. This rule will enable you to override the default behaviour of level indentation being applied to {% schema %} code regions.

This capability will be made available underdedentTagList and will accept an array list of Liquid tag names that should not apply indentation. In your case, you'd need to add schema to the rule (when it becomes available), eg:

{
   "liquid": {
       "dedentTagList": ["schema"]
   }
}

I will inform up its availability in this issue.

Arifursdev commented 1 year ago

@panoply sorry, i think it used to have the snippet for both {% %} and {%- -%} now it just {% %}