racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
453 stars 93 forks source link

lighter alternative to drracket:indentation? #60

Closed mbutterick closed 8 years ago

mbutterick commented 8 years ago

I know how to use 'drracket:indentation to use a custom indenter in a #lang. But all I’m doing with my custom indenter is handling a few custom keywords, and otherwise relying on the default indenter.

But this amounts to indenting in two passes. Is it possible to accomplish this in a more lightweight manner — specifically, by appending new keywords to DrRacket’s existing classes of keywords?

screen shot 2016-06-03 at 1 54 56 pm

rfindler commented 8 years ago

It does seem like it would be nice if DrRacket let you specify the default content of those 8 spots (4 lists and 4 regexps) on a per-language basis instead of globally.

rfindler commented 8 years ago

How about calling this method (now that it has an optional argument for you to use) from your indentation predicate?

https://github.com/racket/gui/commit/7c857706d75f03155a03eb4de8e556865a5f528c

mbutterick commented 8 years ago

Thank you. This works well.

FWIW I find get-keyword-type a confusing name, as its idea of “keyword” conflicts with the much more pervasive usage throughout Racket of “keyword” in the sense of “keyword argument” (even within the DrRacket docs).

I’m not sure I have a better suggestion, though. Arguably, get-identifier-type would be more accurate, yet also too generic. These identifiers only accrue their special indentation status in the first position of an S-expression. carword perhaps?

rfindler commented 8 years ago

Okay, I went with a different name.

https://github.com/racket/gui/commit/af33c705589c7273c2d967ff2287774572b46390