Closed TheCommieAxolotl closed 1 year ago
@yeonjuan Just in case you missed it.
Hi @TheCommieAxolotl , Thanks for the PR. I have a question. Why we add the context to the result? Could you explain more?
Thanks @yeonjuan, I'm using your package under the hood in an upcoming project of mine and I would like to display the context of diff chunks to the user to help them better understand where their code is. I was thinking about just writing my own parser to run as well as yours but I saw you were using a regex and it would be easy for me to contribute.
@TheCommieAxolotl I got it. I think it's a bug. The result should contain "function hello() {"
as a UnchangedLine (rather than add context
). I'll work on it!
@yeonjuan So you would just add an UnchangedLine
to the beginning of the chunk?
@TheCommieAxolotl Yes Right, the result should contain all lines!
@yeonjuan I think you may be misunderstanding. The "context" isn't always part of the chunk, sometimes it can refer to a line several hundreds of lines above the current chunk and is just shown for orientation.
@TheCommieAxolotl
@yeonjuan I think you may be misunderstanding. The "context" isn't always part of the chunk, sometimes it can refer to a line several hundreds of lines above the current chunk and is just shown for orientation.
Yes right, But I don't think we need new node type. Isn't this just the unchanged line output from the git-diff command?
@yeonjuan No, it is a separate part of the diff output. If you don't want to add a new entry to the chunk I understand but I think adding it as an UnchangedLine
is incorrect behavior.
-
@TheCommieAxolotl You're right. I was misunderstanding, the string following the "@@" is not just representing the Unchaned Line. I'll do some more testing and review, thanks.
Adds a
Chunk.context
entry with the context of the Chunke.g.
will result in a chunk with