You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/src/diff.ts
+10-7Lines changed: 10 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -33,10 +33,10 @@ export function diffResolve(
33
33
34
34
/**
35
35
* Attempts to parse a diff string into a structured format.
36
-
* If parsing fails, logs the error and returns an empty array.
36
+
* If parsing fails, logs the error message and returns an empty array.
37
37
*
38
38
* @param diff - The diff string to parse.
39
-
* @returns An array of parsed file objects if successful, or an empty array if parsing fails.
39
+
* @returns An array of parsed file objects if successful, or an empty array if parsing fails. Logs an error message if parsing fails.
40
40
*/
41
41
exportfunctiontryDiffParse(diff: string){
42
42
try{
@@ -49,10 +49,13 @@ export function tryDiffParse(diff: string) {
49
49
50
50
/**
51
51
* Creates a unified diff between two workspace files.
52
-
* @param left - The original workspace file or its content. If a string, it is wrapped in a WorkspaceFile object with a default filename.
53
-
* @param right - The modified workspace file or its content. If a string, it is wrapped in a WorkspaceFile object with a default filename.
54
-
* @param options - Optional parameters, such as the number of context lines, case sensitivity, and whitespace handling.
55
-
* @returns The diff as a string, with redundant headers removed.
52
+
* If the input is a string, it is wrapped in a WorkspaceFile object with a default filename.
53
+
* If the input is an object, it should contain a filename and content.
54
+
*
55
+
* @param left - The original workspace file or its content. If a string, it is wrapped in a WorkspaceFile object with the filename "left".
56
+
* @param right - The modified workspace file or its content. If a string, it is wrapped in a WorkspaceFile object with the filename "right".
57
+
* @param options - Optional parameters, such as the number of context lines, case sensitivity, and whitespace handling. Defaults to ignoring case and whitespace. Additional options can be provided.
58
+
* @returns The diff as a string, with redundant headers removed. The diff is generated using createTwoFilesPatch.
0 commit comments