-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add positional information, escape \r\n
#1
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
Conversation
Nice work! Could you squash the branch? |
I just check your code out, and now I’m thinking, right now it looks like this: RootNode[1] (start={l:1, c:1, o:0}, end={l:1, c:36, o:35})
└─ ParagraphNode[3] (start={l:1, c:1, o:0}, end={l:1, c:36, o:35}) But this is more compact: RootNode[1] (1:1-1:36, 0-35)
└─ ParagraphNode[3] (1:1-1:36, 0-35) I think the latter looks really nice, especially the line-column part, which is pretty standard. I’m not so sure about the offset (especially because it’s optional), so the comma might be a bit weird! |
I agree with your compact idea. I try to squash. but it looks no good. May I close this pull request and retry to new pull request? |
The article I posted before should be able to help you, what you can also do, is “uncommit” the three commits, and then To come back to your question, I prefer this PR over others though! |
How about it? And I changed code by compact format. |
I like it a lot, however I’m going to refactor a little bit and for some reason a commit by me, with your changes also came through, so I cannot rebase (meaning, it won't show your name/face next to the commit). But I’m very grateful for the help 😄 |
Thanks a lot! Never mind. |
@@ -96,7 +96,13 @@ function formatNode(node) { | |||
if (node.children && node.children.length) { | |||
log += dim('[') + yellow(node.children.length) + dim(']'); | |||
} else { | |||
log += dim(': \'') + green(node.value) + dim('\''); | |||
log += dim(': ') + green(JSON.stringify(node.value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muraken720 Why did you opt to use JSON.stringify
here versus the previous system? I really liked the single quotes, and I don’t think node.value
can/should be non-string!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh just noticed that it has to do with \n
and \r
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var paragraph = 'Some simple text.\nOther �$B!H�(Bsentence�$B!I�(B.';
In this case,
I want to show '\n' value.
Easy way is to use JSON.stringfy() .
I like single quote too.
but I could not output '\n' instead of "\n".
2015/10/03 7:34�$B!"�(BTitus Wormer notifications@github.com �$B$N%a%C%;!<%8�(B:
In index.js:
@@ -96,7 +96,13 @@ function formatNode(node) {
if (node.children && node.children.length) {
log += dim('[') + yellow(node.children.length) + dim(']');
} else {
log += dim(': \'') + green(node.value) + dim('\'');
Oh just noticed that it has to do with \n and \r!log += dim(': ') + green(JSON.stringify(node.value));
�$B!=�(B
Reply to this email directly or view it on GitHub.
Thanks @muraken720 for the work, this was release in 2.0.0. |
\r\n
Please merge if you like it.
I want to check position information.
And if a sentence contains '\r' or '\n', inspect's tree output is broken. so I want to avoid it.