-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Allow setting indent
globally
#3159
Comments
I would like to second this. I'm currently doing the exact same thing, and am still worried I run the risk of starting to use a new language that automatically starts using spaces for indentation without me noticing. Not trying to get into the tabs vs spaces debate (just adding my objective reasoning for this need), but my personal opinion is that someone's personal indentation width preference should not be forced on everyone else. I have a lot of trouble reading 2-space indentation, so I like to render at 4, and tabs let me do that, so as a courtesy to others, I use tabs so they can view my code however they like. However, in today's development world, devs (or at least I) use so many languages on a day-to-day basis it's hard to keep track, and I'd love a global setting with language-specific override for languages with intolerant syntax (for example, Home Assistant's YAML parser really seems to hate tabs, so I should be able to override for YAML). I may be willing to help with this in my spare time if someone could point me to the relevant parts of the project. |
I think this is a key feature for users working on projects which have a strict coding style and use multiple programming languages. Also note that simply enumerating indent overrides for all languages which helix currently knows about is not a one-off solution. This list would also have to be updated if new languages are added to Helix's default |
I'm actually personally against having a global setting for tab width. Each language has its own style, and I don't agree with the mindset of just ignoring idiomatic conventions. Just as one shouldn't write snake case in Java, or camel case in Rust, one shouldn't use an unconventional tab width. Also, it's likely that if you really insisted on doing this, you're probably not talking about more than half a dozen languages, max. It's not like you'd notice some Prolog dialect was added and have to go add another entry. |
I don't actually use Helix anymore (and will probably unsubscribe from this ticket), but as of when I stopped, I had 11: C++, C, Rust, JavaScript, TypeScript, HTML, YAML, Python, CSS, Markdown, and Bash. For the sort of personal use I was using it for, consistency with my own opinions was far more important than consistency with the opinions of some style guide. The nice thing about optional settings is that you don't have to set them if they don't suit you :) |
I understand that I'm not the target audience as I'm pretty much a normie who enjoys tinkering with my computer, a non-dev, mostly janky scripts, configs and markdown documents. But I would also like some way of telling Helix: unless told otherwise a tab consists of spaces, two spaces to be exact. |
My issue is that I don't want to write a config for every language. |
in regards to #6652 If going with that, then to increase reuse whilst resolving the issue posed in the openning comment of this thread, perhaps languages which are dependent on a specific indentation can have their inheritance set to the helix default, by default as opposed to the user specified global setting. I do not have the time to change this my self and it is not an issue that would be desirable for me to see develop into a halt in existing work. |
i think global options should override the default languages.toml and the global languages.toml, meaning they are only overriddeo by the languages.toml present in a project directory This means that you can have
Which I think is an ideal amount of control |
That's why formatters and linters are a thing 🙃. And that's why the global setting should be just a default, overriden by whatever
Rust's |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I currently have an incredibly long
~/.config/helix/languages.toml
, to which I append a copy of this for every language I use or encounter:I discovered while writing this that I don't actually have to set
auto-pairs = false
in each language anymore (I don't think the global one existed/worked when I started using Helix?), so that's neat, thanks!I would like to be able to do the same for
indent
. The desired behavior is that I can say "always indent with tabs, for any file type", and spaces are only used if I open an existing file that is already indented with spaces.Potential issue with this: Some languages (e.g. makefiles) require a particular type of indentation as part of their syntax. These languages should probably have some sort of "no, really, use this even if the user said something else" flag in their
indent
configuration, to avoid emitting broken makefiles when the user has set space-indentation globally. Alternatively, the language-levelindent
could be split intoindent
anddefault-indent
, where the order of precedence islanguage.indent > global.indent > language.default-indent
.The text was updated successfully, but these errors were encountered: