Reputation: 5612
I am working with Liquid files (.liquid extension) that have a YAML section at the start.
e.g.
settings:
- label: "bla bla bla"
id: some_id
type: select
options:
- label: "Option 1"
value: option-1
- label: "Option 2"
value: option-2
---
{% for item in array.items %}
<div id="{{ liquid_array | filter }}">
{% if liquid_object = some_condition %}
// do some stuff
{% else %}
// do some other stuff
{% endif %}
</div>
{% endfor %}
The preferred tab spacing for YAML is 2 spaces. (And certainly for the environment I'm working in (Locomotive CMS) a 4-space tab setting causes issues when the file is pushed to the server).
I prefer to work with 4-space tabs for HTML and liquid though.
Is there any way to get VS Code to allow 2-space tabs in one part of a file and 4-space tabs in another part of the same file?
It appears VS Code detects file type based on the file extension and I understand that you can set tab spacing based on file type, but this obviously won't solve my problem. I was wondering if there is any way to get VS Code to detect the file type based on the markup structure? Perhaps the I could set a tab-space setting for YAML and a tab-space setting for HTML and both would be applied with a .liquid file...?
Upvotes: 1
Views: 264