this post was submitted on 05 Sep 2023
167 points (79.7% liked)

Programming

17392 readers
144 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] kevincox@lemmy.ml 6 points 1 year ago

You are missing the point. Lots of code has multiple authors. There is offer no space indention that works for all authors. With tabs each author or reader can use the width that works for them.

automatically display indent spaces as a tab character

You can't really do this reliably. The problem is that spaces may be used in other places for alignment where the width shouldn't be dynamic. If you do a simple s/ /\t/g you will have funny results where code was aligned carefully using spaces. (The reverse does work though if you want to go from tabs to spaces, because tabs contain more information.)

You could potentially do a good job with a full parser for the language in question to determine the indent level and separate indent from alignment. But I'd rather not rely on this for no reason. Sometimes I don't have a full parser available for every language I want to edit.