-
Notifications
You must be signed in to change notification settings - Fork 5.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
Switch to hard tabs #6224
Comments
cc @sebmck you were asking about this in discord the other day |
@caspervonb I did not. I searched the Deno Discord and the |
@sebmck apologies, it linked to your tweet so I wrongly made the assumption it was your account 😕 |
ref: #3695 |
We stick with JS conventions - which is basically prettier defaults - and I'm a 2-space type programmer. |
I don't like editing with tabs. More generally, multi-column characters that can't be visibly told apart from another whitespace are annoying when they get shifted around unexpectedly, or I backspace/delete on them. This is merely the perspective of my personal convenience given my current physical circumstances so weigh it as you will. However, I don't think this thought should be discarded as a "preference vs an all-important accessibility issue". There can still be a discussion. In particular, I'm curious about the current state of accessibility tools in editors. Isn't identifying an indent-space and rendering it differently an extremely simple problem? Doing it like that would seem more consistent with changing font sizes, regular space sizes, etc. |
I agree with @caspervonb allowing the use of tabs is most definitely an accessibility issue. Tabs are inherently just characters that represent indentation. Due to that, any developer can configure their editor to be able to use any length they need to be able to work more efficiently. And no, I have never seen an editor be able to represent a 2-space indentation as anything other than 2 spaces. Currently, it would have to change the number of spaces, which I think to say that 2-spaces is the JavaScript convention, @ry, is to force your opinion and inability to accept that tabs may help people with disabilities onto the rest of the community. Tabs can help lots of people. Even if you prefer to stick to a so-called "convention" for indentation in the JavaScript community, saying no to tabs altogether is reductive. Tabs may not be as preferable to some — however, to other people, it could mean being able to use the built-in formatter for Deno at all. |
I strongly believe the Deno team should consider providing a switch with the Deno formatter that allows for the use of tabs. # Here are some options
deno fmt -t
deno fmt --tabs
deno fmt --use-tabs
deno fmt --with-tabs
# Or perhaps Deno could take a more simplistic approach of using existing indentation
deno fmt -d
deno fmt --detect
deno fmt --detect-indentation Those were just some ideas, feel free to come up with your own ideas if you plan to implement this. Do, please, reopen this issue though. I don't believe there needs to be a total switch over just support for those who need hard tabs. |
I'm not saying it exists, I'm wondering why people don't request this feature from editors. It would solve the issue for a lot more people at the same time while allowing individual projects to stick to their preference. It would be like changing font size. |
@nayeemrmn That sounds good but at the same time, that seems quite difficult. The editor would have to change the size only of spaces that it recognizes as indentation. If it changes the style of any other spaces then the code will look very weird and probably make it harder to work with. Once you look at this idea from the perspective of writing the code to style indentation spaces separately, then it makes sense why they only support adjusting the width of |
Again, recognising indent spaces is an extremely simple problem. Editors already handle indent spaces differently. |
@nayeemrmn That is an example of someone attempting to create a plugin in VS Code. Recognizing indentation isn't the hard part, it's changing the width of the indentation only visually that's hard. I apologize for wording it poorly. Even with their attempt to create a plugin for this, their solution is terribly inflexible. |
It seems there exists a VS code extension for changing the visual width of indentation spaces: https://marketplace.visualstudio.com/items?itemName=kylepaulsen.stretchy-spaces |
@dsherret I'm assuming there are a lot of places that don't have this functionality available to them, including the web. On the web, if you want to change the size of hard How I view the accessibility of it
I am glad that someone made the SolutionI still support the solution of adding a new switch for using hard tabs. # Boolean flag
deno fmt -t
deno fmt --hard-tabs
# One of two values in: enum { soft, hard }
# This could allow future support for an auto mode `-t auto`
deno fmt -t hard
deno fmt --tabs=hard |
We won't switch the Deno code or the We recognise though that formatting via |
@kitsonk I'm not saying that the default has any need to change. A lot of people like 2 space tabs and it's convenient for a lot of neurotypical and able-bodied developers. My solution was simply to add a flag that allows hard tabs as an additional option. Also, I see you want to stick to the same options/features as Prettier. Prettier also has the ability to use hard tabs. It supports the use of hard tabs via |
I understand what you are saying. I was just making it clear that we wouldn't be implementing what this issue originally requested, but implementing via a unified configuration file (and unlikely to implement via adding additional command line flags, but we might). |
Furthermore, tabs are more semantically correct |
this should be configurable. i find it annoying when i run "deno add my-package" and it just fucks up my formatting. in my opinion, .editorconfig should be respected (currently it isn't). i absolutely DESPISE 2-width tabs, but some programmers love it, and there isn't a good argument to make for either of them, hence it should be configurable |
You can switch to tabs using |
Indeed, but I think that issue is about redefining defaults |
Currently
deno fmt
uses 2 spaces for indentation; I propose we switch to using hard tabs.Tabs allow people in the same codebase to select their indentation widths across every tool including GitHub as even browsers support tab-width in stylesheets these days.
Now this isn't just "a preference", a preference would be what brace style to use but a narrow indentation width is an accessibility issue.
You can still easily parse the opening brace after a statement if you put them on the same line or the next one making it a stylistic preference but narrow whitespace tends to just disappear and blend in with the line when you have less than perfect sight.
This thread from Reddit comes to mind on the topic of accessibility of tabs
Lastly, please refrain from getting into the X is better than Y debates, I used to think X was better than Y too but then I had to get glasses 😉
The text was updated successfully, but these errors were encountered: