Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements to the syntax highlighting: #63

Merged
merged 3 commits into from
Nov 2, 2017

Conversation

rohieb
Copy link
Contributor

@rohieb rohieb commented Oct 23, 2017

  • highlight all known directives known to the documentation
  • support all allowed single-line comment characters
  • support multiline comment blocks

For the block comments, I've read section 14.2.1 of the documentation very carefully three times now and something like this should be counted as a comment:

comment
This is a comment.
It can span multiple lines.
end

However, in my case with ledger 3.1.2-20160801, if I actually put this snippet into my journal, this leads to all statements after that comment being ignored by ledger. I'm not sure if this is actually a bug in ledger, so if someone could shed light at this, I'd be happy to fix the highlighting if I understood the docs wrong.

Acording to <http://ledger-cli.org/3.0/doc/ledger3.html>

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
@kljohann
Copy link
Member

Very nice, thank you. Regarding the block comment syntax: If you look at http://ledger-cli.org/3.0/doc/ledger3.html#index-block-comments it says:

Block comments can be made by use comment ... end comment.

; This is a single line comment,
#  and this,
%   and this,
|    and this,
*     and this.

comment
    This is a block comment with
    multiple lines
end comment

So I guess every comment block has to end with end comment on a line by its own.
I'm not sure what directive would be used to end test blocks, though. As they are not part of ledger files as produced by a typical user I think we could get away with not supporting those.

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
According to the manual, section 14.2.1 [1], the characters #, |, and *
are also supported as comment characters at the beginning of a line.

[1]: http://ledger-cli.org/3.0/doc/ledger3.html#Comments-and-meta_002ddata

Signed-off-by: Roland Hieber <rohieb@rohieb.name>
@rohieb rohieb force-pushed the syntax-highlight-improvements branch from 312646b to 6d0820e Compare October 25, 2017 09:09
@rohieb
Copy link
Contributor Author

rohieb commented Oct 25, 2017

Ah thanks for the hint. comment … end comment and test … end test work alike, I've included both of them now.

@kljohann kljohann merged commit 17be971 into ledger:master Nov 2, 2017
@kljohann
Copy link
Member

kljohann commented Nov 2, 2017

Merged, thank you! :)

@rohieb rohieb deleted the syntax-highlight-improvements branch November 2, 2017 19:57
@alerque alerque mentioned this pull request Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants