• kakes@sh.itjust.works
    link
    fedilink
    arrow-up
    43
    arrow-down
    4
    ·
    4 months ago

    I can’t imagine it would be difficult for an IDE to scale the width of spaces found at the start of a line, to emulate this same customization while still preserving my sanity as a fervent space-indenter. I’ve never seen an IDE that does this, but it’d be an interesting compromise.

    • Maestro@kbin.social
      link
      fedilink
      arrow-up
      28
      arrow-down
      1
      ·
      4 months ago

      It’s not difficult at all, and many editors and IDEs already support this, making the entire point moot. Just do whatever the style guide says. I’m into PHP and Python so for me it’s spaces all the way.

      • LaggyKar@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        4 months ago

        How can it tell the difference between spaces used for indentation and spaces used for alignment, if you use the same character for both?

        • lud@lemm.ee
          link
          fedilink
          arrow-up
          8
          ·
          4 months ago

          I guess the indention sizer thing knows how the formater works and adjusts accordingly. I can’t imagine it would be too much of a problem.

          Iirc Jetbrain IDEs has a feature called dynamic tabs/space (or something like that) which uses exclusively tabs until it needs to align something and a tab doesn’t fit, so it uses a few spaces instead.

        • coloredgrayscale@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          4 months ago

          Maybe alignment more for the righthand side of assignments. If you have a block of variables with different name lengths, or within a constructor / function call.

        • MotoAsh@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          4 months ago

          All parsers ignore a shitload of whitespace already. Just compare unformatted code, COMPLETELY unformatted code, code without character returns, and it’ll become obvious how any given language is interpreted around whitespace.

          Also fun to see just how infrequent a semicolon is ‘actually’ needed to tell when the end of a statement is here.

    • fidodo@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 months ago

      What if instead of having the IDE special case space characters at the start of a line, we had a special character that could represent a variable width space?

        • fidodo@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          4 months ago

          Then you use the variable width space for code indentation, then, when you’re at the code indentation level, you’d switch to spaces for alignment. If the IDE special cased all space characters at the start of the line you wouldn’t have that flexibility. You could also easily create a linter that ensured that the variable width space always has the correct indentation level, and ignore the standard space characters after it.

          • kakes@sh.itjust.works
            link
            fedilink
            arrow-up
            2
            ·
            4 months ago

            You’re entirely correct. Plus, I hate the idea of changing the width of spaces for any reason lol.