Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting issues despite the formatter being disabled #150

Closed
richayles opened this issue Feb 3, 2023 · 5 comments
Closed

Formatting issues despite the formatter being disabled #150

richayles opened this issue Feb 3, 2023 · 5 comments
Labels
Bug Something isn't working in the vscode extension ⚡Enhancement New feature or request

Comments

@richayles
Copy link

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
Copy link

Arifursdev commented Feb 15, 2023

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
Copy link
Owner

panoply commented Feb 15, 2023

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 panoply added Bug Something isn't working in the vscode extension ⚡Enhancement New feature or request labels Feb 15, 2023
@panoply
Copy link
Owner

panoply commented Feb 15, 2023

@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 added a commit that referenced this issue Feb 17, 2023
Basically, people don't like defaults appropriated and don't read the documentation nor seem to have any idea how basic vscode implementation works.

Fixes #150
Fixes #142
@panoply
Copy link
Owner

panoply commented Feb 17, 2023

@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
Copy link

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

@panoply panoply closed this as completed Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working in the vscode extension ⚡Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants