Sublime Text/TextMate syntax definition for Beancount

203 views
Skip to first unread message

Martin Andreas Andersen

unread,
Sep 9, 2014, 6:50:41 PM9/9/14
to bean...@googlegroups.com
Hi,

So I got bit by the hacking bug, and mashed out a .tmLanguage syntax definition for Beancount.

Find it here:

for now. I'll look into adding that to Package Control later.

As far as I can tell, most of the syntax is adequately covered. There are some rough edges, but that is mostly from a code quality/maintenance point of view.
I've tried to be as explicit as possible, so most syntax errors get caught visually.

hope this can be of use for somebody!

-- martin

Martin Blais

unread,
Sep 9, 2014, 8:00:11 PM9/9/14
to Martin Andreas Andersen, bean...@googlegroups.com
Thanks Martin!
This is awesome.

(If you would like me to pull that in the main repo under a contrib/sublime subdirectory, let me know.)


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/9f8892ab-0605-4c24-94ca-6578aec878f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Andreas Andersen

unread,
Sep 10, 2014, 4:27:04 AM9/10/14
to bean...@googlegroups.com
Feel free to pull it in :)

I'm dreaming of expanding this with some snippets. A full plugin would be nice as well - sublime plugins are written in Python, so no problem there.

Useful features would be
- snippets for most common directives, particularly transactions
- aligning transactions
- validation of account names in directives
- reports output to command log
- flagging unbalanced transactions
- source reordering

To name a few. We'll see how far my hacking kick takes me :)

Martin Blais

unread,
Sep 10, 2014, 4:50:16 AM9/10/14
to Martin Andreas Andersen, bean...@googlegroups.com


On Sep 10, 2014 4:27 AM, "Martin Andreas Andersen" <martin.andr...@gmail.com> wrote:
>
> Feel free to pull it in :)
>
> I'm dreaming of expanding this with some snippets. A full plugin would be nice as well - sublime plugins are written in Python, so no problem there.
>
> Useful features would be
>  - snippets for most common directives, particularly transactions
>  - aligning transactions

Very useful. You might want to look at what I did recently for emacs, which is align on the previous transaction in the for. Just an idea.

>  - validation of account names in directives

Most important is auto complete for existing account names.  You really do need that.

>  - reports output to command log
>  - flagging unbalanced transactions

I'll be adding a command to bean-doctor to display inventory contents before and after the transaction that the cursor is in. It will accept a filename and line number.

>  - source reordering
>
> To name a few. We'll see how far my hacking kick takes me :)

That's awesome!

>
> --
> You received this message because you are subscribed to the Google Groups "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
> To post to this group, send email to bean...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/1ba4acfc-2c54-4903-9d92-37fe8d9b476e%40googlegroups.com.

Martin Andreas Andersen

unread,
Sep 10, 2014, 7:48:25 AM9/10/14
to bean...@googlegroups.com, martin.andr...@gmail.com
> Most important is auto complete for existing account names.  You really do need that.

Well, Sublime Text has a builtin autocompletion for strings in the current file, which works OK. Something that walks the account tree and only suggests accounts that are children of the previous one would reduce some errors though.
Reply all
Reply to author
Forward
0 new messages