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

Update .editorconfig fix accessibility issues #265

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

Conversation

ttytm
Copy link
Contributor

@ttytm ttytm commented Oct 28, 2023

This PR makes some minor fixes as the current setting unfortunately creates some confusion in the editor.

It wants to:

  • Fix shifting tab widths and misalignments when e.g., switching splits in VSCode or entering buffers in nvim. It also should fix not respecting a users tab width setting.
    Screenshot_20230528_230737

    This issue is due to specifying indent_size as an anti-setting for tabs.
    Unlike with spaces, specifying a width is not needed; one tab is always one indentation. Without it we'll get the benefit of increased accessibility and more developer friendliness, so any preferred indent width can be used or dynamically adapted to a given situation. If you check https://editorconfig.org/, you will also see # Tab indentation (no size specified).

    I would further suggest to move towards a more modern setting for indentation for odinfmt that takes either an int or "tab" as value indendation=int|"tab". Like e.g. stylelint does https://stylelint.io/user-guide/rules/indentation#options

  • Extend file support. Yaml unfortunately requires spaces, as my editor didn't behave properly when working on Renovate and extend CI workflow #264, so .editorconfig was extended to cover yaml files.

@DanielGavin
Copy link
Owner

DanielGavin commented Oct 28, 2023

The reason tabs_width exists is not for tabs itself, but when you are breaking lines when they exceed line width. If there is no tab_width it could get quite wonky when someone makes a billion scopes, but we act like the tab is just one space, but on the editor it is 4-8 spaces.

It's one of shortcomings of tabs, formatter is operating in an uncertain environment.

I still prefer having a config to get a compromise between pretending tabs is one space.

Would to hear your opinion on how to manage line breaking when odinfmt uses tabs.

Example:


func :: proc() {

    {
        {
             {
                 {
                     a := 2 //this would in spaces be 28, but 12 with tabs pretending the symbol is one space
                 }

             }
        }

    }

}


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