Highlighted code get wrong indentation but none highlighted code is indented right. #5757
Replies: 4 comments 14 replies
-
Please provide more information. The title is not self explanatory at all. |
Beta Was this translation helpful? Give feedback.
-
This is not an actual bug but intentional. Your code is probably indented with tabs rather than spaces. Helix allows configuring the amounts of spaces used to render a tab per language. Without highlight usually means that no language config was found for a file which means that tabwidth default to 4 but for json the If you are unahppy with this default you can change it by adding the following to your languages.toml: [[language]]
name = "json"
indent = { tab-width = 4, unit = "\t" } # by default helix inserts two spaces when pressing tab in json this changes the setting to insert a tab instead and render a tab with a width of 4 instead of 2. |
Beta Was this translation helpful? Give feedback.
-
@pascalkuthe Problem is that I already have that in my language.toml and its happening regardless of that. |
Beta Was this translation helpful? Give feedback.
-
I think I have seen this as well: the preview pane in the file picker doesn't take the indentation for the language into account - it treats it as plain text. This can cause some jumpiness in the picker when the preview becomes highlighted on the idle-timeout if you are using long tabs. For example I see this in the erlang/otp codebase which tends to use tabs as 8 columns. It also mixes tabs with spaces so you can see the jumpiness that happens here: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
We have a 4 spaces indentation setup in our project. As seen in picture below when code in not highlighted its being rendered wright but when its highlighted it is being rendered with 2 spaces only.
Reproduction Steps
I tried this:
I expected this to happen:
Instead, this happened:
Helix log
~/.cache/helix/helix.log
Platform
macOS
Terminal Emulator
Kitty 26.5
Helix Version
22.12 (96ff64ab)
Beta Was this translation helpful? Give feedback.
All reactions