Skip to content
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

[Enhancement] Add Option to Override Indentation #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kevinmatthes
Copy link
Contributor

Again, as originally suggested in #41, here is the implementation make the tab versus spaces setting an option for the configuration file.

@mcobzarenco
Copy link
Collaborator

Hey @kevinmatthe, thanks for the PR. Some thoughts -- while #29 added mode-specific configuration for indentation, it remained unused. Rather than having a global option as you add in this PR, should we not rely on the mode-specific configuration?

I created a PR #49 and tried to add you as a reviewer (but couldn't?), I resolved to mentioning you. Let me know what you think

@kevinmatthes
Copy link
Contributor Author

I agree with you that applying the settings from the configured is a sane design decision for having some initial configurations. This Pull Request was intended to provide an override functionality therefore since in some projects, people indent with tabs instead of spaces in all languages they use. It is easier to just edit one setting instead of twenty-five, for instance, to meet the indentation convention.

To provide a minimal-invasive session override therefore, I suggested an according option in #41 which performed this action without editing the configuration file at all. The downside was that it worked only in one direction in order to prevent a precedence between the override settings in case multiple ones should be passed.

@kevinmatthes
Copy link
Contributor Author

One possible solution might be to invert the meaning of the suggested override option to indent_with_tabs, for example, to keep all language modes configured with spaces, and to set up the override option to change the session indentation unit to tab characters.

For maximum language sensitivity, this option should be disabled / without any effect, however, for certain languages, such as Haskell whose compiler GHC refuses the compilation when reading tab characters in a source file.

@kevinmatthes
Copy link
Contributor Author

I would like to suggest to wait for #49 being merged before continuing working on this feature.

@kevinmatthes kevinmatthes marked this pull request as draft July 19, 2022 03:30
@kevinmatthes
Copy link
Contributor Author

Continuing the discussion on indentation unit overrides from #49, I would like to add that the possibility to detect the currently used indentation unit would resolve the necessity of those overriding mechanisms.

VS Code-like IDEs have exactly this detection. You can set up your preferred indentation unit in the settings, also per language, but if the editor finds a file which is indented with the opposite indentation unit, for instance, tabs instead of spaces, it will continue to use the found indentation unit in order to do not violate against the obvious coding conventions of this source file.

When working in teams, this is quite useful in order to prevent non-uniformly indented source files. This is why I tried to add such a feature, as well. I thought it would be easier to begin with a configuration variable and some additional command line options, if required.

What do you think, would this functionality add a useful feature to zee regarding the long term development?

@kevinmatthes
Copy link
Contributor Author

I created a discussion thread therefore: #54.

@kevinmatthes kevinmatthes marked this pull request as ready for review July 20, 2022 18:33
@kevinmatthes
Copy link
Contributor Author

These changes allow defining a global override of the indentation setup as required when required. If these settings are not needed, just set the configuration variable indentation_override to None.

@kevinmatthes kevinmatthes marked this pull request as draft July 27, 2022 18:36
@kevinmatthes kevinmatthes marked this pull request as ready for review July 28, 2022 17:18
@kevinmatthes kevinmatthes changed the title [Enhancement] Add Option to Disable Tabs [Enhancement] Add Option to Override Indentation Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants