andorsk / d2-mode

emacs major mode for d2 graphs
GNU General Public License v3.0
73 stars 8 forks source link

Indentation Not Working #45

Closed joyguar closed 4 months ago

joyguar commented 1 year ago

Hello,

I've just installed and tried making use of d2-mode but indentation isn't working. If I type out the example

My Class {
   shape: class
   +field: string
   read ()
}

indentation behaves the same as in fundamental mode. I have to manually tab the shape: class line, and then I have to manually de-indent the curly brace. I've installed both from melpa and tried a git clone, but I get the same behavior.

Are there limits on the indentation?

andorsk commented 1 year ago

Thanks for raising this @dstrr. I don't think there's any specific indentation policies set yet, so I think you're right, this can be a feature request that can be added in.

MoisMoshev commented 6 months ago

I'm willing to take on that, if I get any idea of how indentation works. Is there a simple mode that does it, which I can look at for inspiration? I'm reasonably comfortable in emacs lisp.

andorsk commented 5 months ago

Hey Mois. Sorry for the delay in a response here. https://github.com/abrochard/mermaid-mode/blob/master/mermaid-mode.el#L133 is a good starting point and I would certainly welcome the contribution!

Thank you and I look forward to the PR!

MoisMoshev commented 5 months ago

Ooh that's nice. Moving point and then searching backwards, I hadn't thought of that. Let me see when I'll fit it in the schedule.