[Indentation] Autodetection / Overriding Indentation Unit? #54
Replies: 2 comments 1 reply
-
The reason why I assume that the implementation might be difficult is that the detection requires a statistical approach: when there is just one tab character by accident, the configured spaces shall be applied anyway. But when more than the half of the lines is indented using tabs, the override should become active for this file. This decision -- whether to override the settings -- might differ for every file opened in this session and all of its windows. The mechanism needs to react accordingly to do not mix up the respective units. Beginning with the configuration settings, they bring at least the required fields for the context to be edited by a further implementation of the auto-detection. |
Beta Was this translation helpful? Give feedback.
-
Another option would be to introduce a configuration setting of type If set to |
Beta Was this translation helpful? Give feedback.
-
The preferred indentation units can be set in
config.ron
but sometimes, there are some coding conventions in a project that enforce to use a certain indentation unit. This might not match the settings and would require, hence, to adjust the configuration when working on that project and to revert the changes when working on another one.VS Code-like IDEs bring an automatic detection which overrides the preferred settings when finding a source file being indented using another than the configured preferred indentation unit. While this is quite comfortable, it might be somehow difficult to implement it into the current repository state.
This is why I would like to suggest to introduce a global overriding configuration setting. Especially when having numerous languages defined in the configuration file, this overriding option would come in handy. It could, for instance, consist of two variables: the first one as switch whether to override and the second one as the indentation unit to apply in case the switch is set to true.
What do you think about this?
Beta Was this translation helpful? Give feedback.
All reactions