Differentiate line, inline, and block comments - #277
Open
yutotakano wants to merge 1 commit into
Open
Conversation
Owner
|
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: ***@***.***>
|
Author
|
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 |
Owner
|
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:
***@***.***>
|
Author
|
Great, okay. Sorry, I'll be on a slight winter break for a week or two but I'll get to it after. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hledgersupports 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,
hledgersupports 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! :)