chore: 🐛 put more context lines in history diffs
This commit is contained in:
parent
8d68230035
commit
2352fb0bff
2 changed files with 10 additions and 2 deletions
|
|
@ -17,10 +17,16 @@ export const createDiff = (
|
|||
afterContent: string,
|
||||
filePath: string,
|
||||
diffType: DiffFormatType,
|
||||
contextLines: number = 3,
|
||||
) => {
|
||||
switch (diffType) {
|
||||
case DiffFormatType.Unified:
|
||||
return createUnifiedDiff(beforeContent, afterContent, filePath);
|
||||
return createUnifiedDiff(
|
||||
beforeContent,
|
||||
afterContent,
|
||||
filePath,
|
||||
contextLines,
|
||||
);
|
||||
case DiffFormatType.TokenLineDiff:
|
||||
return createTokenLineDiff(beforeContent, afterContent, filePath);
|
||||
}
|
||||
|
|
@ -31,6 +37,7 @@ const createUnifiedDiff = (
|
|||
beforeContent: string,
|
||||
afterContent: string,
|
||||
filePath: string,
|
||||
contextLines: number,
|
||||
) => {
|
||||
const normalizedBefore = beforeContent.endsWith("\n")
|
||||
? beforeContent
|
||||
|
|
@ -45,7 +52,7 @@ const createUnifiedDiff = (
|
|||
normalizedAfter,
|
||||
"before",
|
||||
"after",
|
||||
{ context: 3 },
|
||||
{ context: contextLines },
|
||||
);
|
||||
|
||||
return patch;
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ export const processNextEditData = async ({
|
|||
afterContent,
|
||||
filePath,
|
||||
DiffFormatType.Unified,
|
||||
25, // 25 context lines; store a large number for trimming later on
|
||||
),
|
||||
fileUri: filePath,
|
||||
workspaceUri: workspaceDir,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue