-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
global indentation configuration #6652
base: master
Are you sure you want to change the base?
Conversation
a5acca9
to
ed5b53b
Compare
Would be nice to try and merge this |
8b477a0
to
ce0bede
Compare
Would really like this, annoying to have to keep setting it every time I open helix. It would be nice if there was some helix.rc or such so this wouldn't be a problem |
@@ -695,7 +695,7 @@ roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json"] | |||
comment-token = "#" | |||
language-servers = [ "pylsp" ] | |||
# TODO: pyls needs utf-8 offsets | |||
indent = { tab-width = 4, unit = " " } | |||
indent = { tab-width = 4, unit = " ", required = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent = { tab-width = 4, unit = " ", required = true } | |
indent = { tab-width = 4, unit = " " } |
Python allows using hard tabs for indentation (and actually any amount of spaces works too), it only disallows ambiguous mixing (i.e. when semantics depend on a specific tab width)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mark the indentation style as required
because Python requires it; I did it in order to override the global setting for conformance with PEP 8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think required
should only be applied to languages that do not support using tabs (like Nim) or spaces (like Makefile); everything else is basically just your stylistic choice which shouldn't affect anyone else. I mean, that's exactly the reason for using tabs instead of spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree—I use tabs in Python and everywhere else—but this felt right to me at the time. In any case, I'll leave the decision to the maintainers.
Any updates on this? |
So this won't be merged for now? We have to wait for plugin system to be implemented? |
6e50669
to
3d6fd54
Compare
Indentation can be configured globally as shown below.
These settings are used when a buffer is loaded and an indentation style is not detected and override language-specific defaults. However, they can be overridden per language in
languages.toml
by settingindent.required = true
.Setting
indent.required = false
for a language in the user'slanguage.toml
requires settingindent.{tab-width,unit}
too but I think that this is out of the scope of this patch given that the same happens when settingindent.tab-width
orindent.unit
only.These changes should resolve #3159.