feat: diff parser #33

Merged
张泊明518370910136 merged 10 commits from diff into master 2024-09-11 19:12:13 +08:00
No description provided.
周赵嘉程521432910016 was assigned by 张泊明518370910136 2024-09-09 03:24:26 +08:00
Author
Owner

@zzjc123 You need to rebase the branch on master instead of healthcheck so that I can start reviewing the code.

The diff parser needs a character-by-character comparison algorithm so that we can choose whether to ignore whitespace or not as not all the problems requires the output format to be exactly the same.

You can check https://cs.opensource.google/go/x/tools/+/refs/tags/v0.1.12:internal/lsp/diff/myers/diff.go and https://github.com/cj1128/myers-diff/blob/master/main.go.

@zzjc123 You need to rebase the branch on master instead of healthcheck so that I can start reviewing the code. The diff parser needs a character-by-character comparison algorithm so that we can choose whether to ignore whitespace or not as not all the problems requires the output format to be exactly the same. You can check https://cs.opensource.google/go/x/tools/+/refs/tags/v0.1.12:internal/lsp/diff/myers/diff.go and https://github.com/cj1128/myers-diff/blob/master/main.go.
周赵嘉程521432910016 force-pushed diff from 0af0994b8c to d47e14612a 2024-09-09 12:32:19 +08:00 Compare

You mean we need to compare it by character but we still output like

-This is a test case.
-Hello, world
+This is a bad case.
+Hello, Hello
 test 12 asdf
+test 13 asdf
You mean we need to compare it by character but we still output like ```diff -This is a test case. -Hello, world +This is a bad case. +Hello, Hello test 12 asdf +test 13 asdf ```

Could you give me a demo output for handling whitespace, didn't get you clearly. Which kind of cases we may face due to whitespace?

Could you give me a demo output for handling whitespace, didn't get you clearly. Which kind of cases we may face due to whitespace?
Author
Owner

For some cases, if the answer is 123 456 789, we should also accept 123 456 789 and 1234 56 789. The output comment is just for assistance, no need to make it precise. Just show them in which line characters are different is enough.

For some cases, if the answer is `123 456 789`, we should also accept `123 456 789` and `1234 56 789`. The output comment is just for assistance, no need to make it precise. Just show them in which line characters are different is enough.

Can we just pass an argument to ignore all whitespace? Or we cheat space tab as the same?

Can we just pass an argument to ignore all whitespace? Or we cheat space tab as the same?
Author
Owner

The argument should be in conf.toml, ignore_whitespace = true. You can start by ignoring all \r, \n, \t, and when it is true.

The argument should be in `conf.toml`, `ignore_whitespace = true`. You can start by ignoring all `\r`, `\n`, `\t`, and ` ` when it is `true`.

Add tests in the example repo diff/basic diff/complex.

Add tests in the example repo diff/basic diff/complex.
张泊明518370910136 force-pushed diff from dae5247887 to ac9547f1f1 2024-09-11 08:29:24 +08:00 Compare

all test cases passed

all test cases passed
张泊明518370910136 was assigned by 周赵嘉程521432910016 2024-09-11 12:09:45 +08:00
张泊明518370910136 force-pushed diff from f389aa7329 to 2c742852fb 2024-09-11 17:55:22 +08:00 Compare
张泊明518370910136 added 1 commit 2024-09-11 18:20:49 +08:00
张泊明518370910136 added 1 commit 2024-09-11 19:06:54 +08:00
张泊明518370910136 changed title from WIP: feat: diff parser to feat: diff parser 2024-09-11 19:10:31 +08:00
张泊明518370910136 merged commit 52491478a4 into master 2024-09-11 19:12:13 +08:00
张泊明518370910136 deleted branch diff 2024-09-11 19:12:14 +08:00
Sign in to join this conversation.
No description provided.