Post History
Hi everyone, I recently set up Helix and noticed that every time I save a CSS file, it gets automatically formatted. I didn’t enable any formatter for CSS in my configuration, only for Python. My ...
#2: Post edited
- Hi everyone,
- I recently set up Helix and noticed that every time I save a CSS file, it gets automatically formatted. I didn’t enable any formatter for CSS in my configuration, only for Python. My `languages.toml` looks like this:
- ```toml
- [[language]]
- name = "python"
- language-servers = ["ruff"]
- auto-format = true
- scope = "source.python"
- [language-server.ruff]
- command = "ruff"
- args = ["server"]
- [language.formatter]
- command = "ruff"
- args = ["format", "-"]
- [[language]]
- name = "css"
- auto-format = false
- ```
- Even with `auto-format = false` for CSS, Helix still reformats the file on save.
- Does anyone know why this happens and how I can stop Helix from formatting CSS automatically?
Thanks!
- Hi everyone,
- I recently set up Helix and noticed that every time I save a CSS file, it gets automatically formatted. I didn’t enable any formatter for CSS in my configuration, only for Python. My `languages.toml` looks like this:
- ```toml
- [[language]]
- name = "python"
- language-servers = ["ruff"]
- auto-format = true
- scope = "source.python"
- [language-server.ruff]
- command = "ruff"
- args = ["server"]
- [language.formatter]
- command = "ruff"
- args = ["format", "-"]
- [[language]]
- name = "css"
- auto-format = false
- ```
- Even with `auto-format = false` for CSS, Helix still reformats the file on save.
- Does anyone know why this happens and how I can stop Helix from formatting CSS automatically?
- Thanks!
- Edit:
- I think what’s happening is that Helix’s auto-formatting is kicking in. According to the [Helix language support docs](https://docs.helix-editor.com/lang-support.html#language-support), CSS has "Auto Indent".
- The reason it seems odd in my case is that I'm using **Jinja templates**, and Helix doesn’t fully recognize them.
- I *can* toggle auto-formatting for the current buffer with:
- ```
- :toggle-option auto-format
- ```
- …but the choice is basically between:
- 1. **Never auto-format CSS**.
- 2. **Figure out a way for Helix to auto-format Jinja templates properly**.
- So it’s less of a “bug” and more of an interaction between **auto-indent** and Helix’s limited template recognition.
#1: Initial revision
Why is Helix auto-formatting my CSS files on save?
Hi everyone, I recently set up Helix and noticed that every time I save a CSS file, it gets automatically formatted. I didn’t enable any formatter for CSS in my configuration, only for Python. My `languages.toml` looks like this: ```toml [[language]] name = "python" language-servers = ["ruff"] auto-format = true scope = "source.python" [language-server.ruff] command = "ruff" args = ["server"] [language.formatter] command = "ruff" args = ["format", "-"] [[language]] name = "css" auto-format = false ``` Even with `auto-format = false` for CSS, Helix still reformats the file on save. Does anyone know why this happens and how I can stop Helix from formatting CSS automatically? Thanks!
