-
Notifications
You must be signed in to change notification settings - Fork 9
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
Differentiate line, inline, and block comments #277
base: main
Are you sure you want to change the base?
Conversation
Thanks, seems like a good feature to support. Can you add some tests? There
are lots of existing tests to see examples
…On Tue, 27 Dec 2022 at 02:34, Yuto Takano ***@***.***> wrote:
hledger supports asterisks as a comment starter, but only for standalone
comments not attached to any specific posting. This is written here:
https://hledger.org/1.28/hledger.html#payee-and-note
In addition, hledger supports block comments, documented here:
https://hledger.org/1.28/hledger.html#comment-blocks
This PR changes the parse syntax to support both of these. I have tested
this locally, I hope you can accept it! :)
------------------------------
You can view, comment on, or merge this pull request online at:
#277
Commit Summary
- 39d758e
<39d758e>
Differentiate line, inline, and block comments
File Changes
(1 file <https://github.com/mhansen/hledger-vscode/pull/277/files>)
- *M* syntaxes/hledger.tmLanguage.json
<https://github.com/mhansen/hledger-vscode/pull/277/files#diff-89b42d1b3542ae0696e5a3816ce607372c14d198667fd9ad5fef318867385990>
(10)
Patch Links:
- https://github.com/mhansen/hledger-vscode/pull/277.patch
- https://github.com/mhansen/hledger-vscode/pull/277.diff
—
Reply to this email directly, view it on GitHub
<#277>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZYOO6P7KTW2PSR7WB26TWPG3JXANCNFSM6AAAAAATJXKMVY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for the quick reply. I was just writing tests (and fixing the numerous other ones that are now parsed differently), when I realised that one case would behave differently: With the new syntax, this will just be parsed as a single comment, with no tag inside. To me, the change makes sense since account names aren't tags, and hledger doesn't do anything with them anyway. But I'd like your opinion as the maintainer, should I allow The usual inline-comments behave the same and parse tags as intended. Before
After
|
I think your change makes sense. I think account name in comment doesn’t
need to be highlighted, it’s mostly accidental that it is today.
…On Tue, 27 Dec 2022 at 03:36, Yuto Takano ***@***.***> wrote:
Thanks for the quick reply. I was just writing tests (and fixing the
numerous other ones that are now parsed differently), when I realised that
one case would behave differently: AccountInComment.
With the new syntax, this will just be parsed as a single comment, with no
tag inside. To me, the change makes sense since account names aren't tags,
and hledger doesn't do anything with them anyway. But I'd like your opinion
as the maintainer, should I allow string.unquoted.tags within the new
standalone comments too, just for visuals?
Before
; This is a comment, containing income:salary, and expenses:food
^
["comment.line"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
["comment.line"]
^^^^^^^^^^^^^
["comment.line","string.unquoted.tag"]
^^^^^^
["comment.line"]
^^^^^^^^^^^^^^
["comment.line","string.unquoted.tag"]
After
; This is a comment, containing income:salary, and expenses:food
^
["comment.line"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
["comment.line"]
—
Reply to this email directly, view it on GitHub
<#277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZYOPDQAMUP4ZZ4KKLLDLWPHCRNANCNFSM6AAAAAATJXKMVY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Great, okay. Sorry, I'll be on a slight winter break for a week or two but I'll get to it after. |
hledger
supports asterisks as a comment starter, but only for standalone comments not attached to any specific posting. This is written here: https://hledger.org/1.28/hledger.html#payee-and-noteIn addition,
hledger
supports block comments, documented here: https://hledger.org/1.28/hledger.html#comment-blocksNeither those standalone comments or block comments support tags, so I have omitted those.
This PR changes the parse syntax to support both of these. I have tested this locally, I hope you can accept it! :)