-
Notifications
You must be signed in to change notification settings - Fork 31
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
Don't apply to the code viewer #3
Comments
Disagree here. Having proper indentation is important for both viewing and editing code. In desktop editors those are just not meant to split. If repo owner sets |
No I really really don't. What I want is for the saved code to have the project set indentation, but I would much prefer to view the file with my preferred indentation. The only reason EditorConfig doesn't work like that is because most editors couple those concepts. On GitHub you actually have the opportunity to not be limited by this. I prefer indent 4 when reading code. Why should some project for no good reason dictate I read their code with indent 2? |
I agree with @sindresorhus. This is the first thing that hit my mind when I saw this repo. Reading code on gh != committing code |
Agree with Sindre. Thanks for this making this, @RReverser! |
Because our world is not ideal and much projects don't distinguish "indentation" and "alignment" and often mix spaces and tabs, and if you have wrong tab size configured in viewer, entire code looks screwed up. I definitely don't say it's alright, but I can't fix every such project, and respecting EditorConfig at least gives ability to normally read such code. For example, one company I'm working with, uses This variety of possible configurations is exactly the problem that EditorConfig solves perfectly, allowing to see any code properly indented and never broken. This was demanded not just me but by other developers as well (at least, I can mention @narirou, @rlidwka, @izaakschroeder and @genbit from isaacs/github#170, but there was a lot of others). So reading code was a main reason why I created this extension - as that's what I do 90% time on GitHub and use online editor for only really simple fixes. However, I do want to find solution that would suit everybody's needs. Do you think adding a dropdown on viewer page would help? (same on as in editor - with 1,2,4,8 indentation and one selected as "auto") Or do you want just a checkbox in options page that would turn EditorConfig on/off for viewer completely? Thank you in advance. P.S. Would be interesting to hear @jedmao's thoughts here as well. |
I think @sindresorhus brings up valid points, but I can see both sides. It's unfortunate that some projects use tabs for alignment, which creates the problems you have mentioned. It's even more unfortunate that this can't be fixed from a tooling perspective (as of yet). Perhaps a bigger question is, "Why does EditorConfig even support a That said, if someone has gone through the trouble of adding a All I'm saying is that some people want this feature, others don't. For those who want it, download it. For those who don't, don't. |
A couple thoughts:
Here's an example from the vim source code which uses tabs for alignment. With a rule setting With no indentation specified (tab width defaults to 8): |
Silly VIM source code |
@treyhunner I'm somewhat confused.
Those statements look opposite to me. What am I missing? Are you saying that tab size for viewing should be set only when EditorConfig manually sets
That doesn't seem to be allowed value for
If you mean extension defaults (and not repo's |
The core library defaults In my statement about I think |
The code viewer is for viewing code and I don't think the repo project should decide how I view its code.
Applying to the editor makes sense, but for the code viewer it should be some default values. Might add an option page to change them. The code viewer should not be affected by the .editorconfig config.
The text was updated successfully, but these errors were encountered: