syntax_tools icon indicating copy to clipboard operation
syntax_tools copied to clipboard

more/better hooks in erl_prettypr

Open richcarl opened this issue 12 years ago • 0 comments

Vlad Dumitrescu wrote (08/12/2005 12:01 PM):

I would like to use syntax_tools to prettyprint source code, but with a slightly modified layout - for example, I'd like to have a newline after function clause arrows.

I made the layout so that it tries to be as compact as possible, so it will not break lines if there is enough room horizontally. Of course, this might not suit everyone, but it suited me at the time.

At first I thought this would be done with prettyprinter hooks, but they are only called for annotations.

Yes. In hindsight, maybe I should have added more hooks after all. Perhaps I can still change it and remain backwards compatible.

My question is: is there a way to customize the behaviour like this in a friendly way, or do I have to take the axe and hack away?

If you add annotations to the nodes you want to handle, as a prepass, you should be able to trigger the hooks and do the formatting your way.

richcarl avatar Aug 04 '11 19:08 richcarl