Skip to content

Semantic indentation? #398

Closed
Closed

Description

@xiongtx

I recently came across a description of semantic indentation for SLIME, which sounds pretty sweet.

Is it possible to implement this for Clojure through CIDER, instead of having to specify indentation for special forms and macros with define-clojure-indent?

Activity

  1. bbatsov commented on Jul 26, 2016

    @bbatsov
    Member

    This is doable, but I'm not sure how useful it will be. There was a ticket about this for CIDER a while back, but I think I closed it when we added support for indentation metadata. Guessing the indentation from some param names simply doesn't feel very reliable to me. But in general implementing this should be rather simple - when you evaluate some macro, we'd inspect its params and add some indentation metadata automatically if we find some "special" param names.

  2. Malabarba commented on Jul 26, 2016

    @Malabarba
    Member

    I implemented something like that when I was implementing the indentation metadata. In the end, I pulled it out because it just wasn't reliable.

    1. People are (sadly) not that careful in Clojure when naming their arguments.
    2. Multi-arity is a problem. If the macro has two arities, which one do you use when indenting?
    3. It doesn't support a lot of macros from core whose internal complexity is not reflected on the arglist (for instance, the whole defrecord family).
  3. xiongtx commented on Jul 26, 2016

    @xiongtx
    MemberAuthor

    👍 Great that it's been considered! Yes, the defrecord family is weird. I'll close this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions