CestDiego / nand2tetris.el

Major Mode for HDL files in nand2tetris.
42 stars 11 forks source link

Auto-indent for parenthesis #11

Open abingham opened 6 years ago

abingham commented 6 years ago

It would be nice if the mode would automatically indent multi-line function arguments to the appropriate parenthesis. For example, when I tab-indent the second line in this example I currently get this:

Mux16(a=XWithY, b=InvertedXWithY, sel=no,
out[0..7]=OutLow, out[8..15]=OutHigh, out[15]=ng, out=out);

But I expected to get this:

Mux16(a=XWithY, b=InvertedXWithY, sel=no,
      out[0..7]=OutLow, out[8..15]=OutHigh, out[15]=ng, out=out);

I've done a little bit of this in the past, and I might be able to put some time into this at some point. But I at least wanted to get this onto the issue tracker.

abingham commented 6 years ago

After looking at the code a bit, I see that the mode does this kind of indentation quite well:

Mux16(
            a=XWithY, b=InvertedXWithY, sel=no,
            out[0..7]=OutLow, out[8..15]=OutHigh, out[15]=ng, out=out);

This is pretty reasonable to me. If you think that this is all that the mode needs to support, I'm fine to close this out.