This commit is contained in:
Henning Dieterichs
2023-12-05 23:14:19 +01:00
committed by Henning Dieterichs
parent 56fda3234c
commit 4728954baa
6 changed files with 57 additions and 3 deletions
@@ -92,6 +92,10 @@ export class LinesSliceCharSequence implements ISequence {
// don't break between \r and \n
return 0;
}
if (prevCategory === CharBoundaryCategory.LineBreakLF) {
// prefer the linebreak before the change
return 150;
}
let score = 0;
if (prevCategory !== nextCategory) {
@@ -187,7 +191,7 @@ const score: Record<CharBoundaryCategory, number> = {
[CharBoundaryCategory.WordNumber]: 0,
[CharBoundaryCategory.End]: 10,
[CharBoundaryCategory.Other]: 2,
[CharBoundaryCategory.Separator]: 3,
[CharBoundaryCategory.Separator]: 30,
[CharBoundaryCategory.Space]: 3,
[CharBoundaryCategory.LineBreakCR]: 10,
[CharBoundaryCategory.LineBreakLF]: 10,
@@ -21,8 +21,12 @@
"modifiedRange": "[7,76 -> 7,80]"
},
{
"originalRange": "[12,153 -> 12,155 EOL]",
"modifiedRange": "[7,157 -> 8,1 EOL]"
"originalRange": "[12,153 -> 12,153]",
"modifiedRange": "[7,157 -> 7,181]"
},
{
"originalRange": "[13,1 -> 13,1]",
"modifiedRange": "[8,1 -> 9,1]"
},
{
"originalRange": "[13,31 -> 13,31]",
@@ -0,0 +1 @@
function x(alignments: RangeMapping[]): x[] { }
@@ -0,0 +1 @@
function x(alignments: RangeMapping[], originalLines: string[], modifiedLines: string[]): x[] { }
@@ -0,0 +1,22 @@
{
"original": {
"content": "function x(alignments: RangeMapping[]): x[] { }\n",
"fileName": "./1.tst"
},
"modified": {
"content": "function x(alignments: RangeMapping[], originalLines: string[], modifiedLines: string[]): x[] { }\n",
"fileName": "./2.tst"
},
"diffs": [
{
"originalRange": "[1,2)",
"modifiedRange": "[1,2)",
"innerChanges": [
{
"originalRange": "[1,38 -> 1,38]",
"modifiedRange": "[1,38 -> 1,88]"
}
]
}
]
}
@@ -0,0 +1,22 @@
{
"original": {
"content": "function x(alignments: RangeMapping[]): x[] { }\n",
"fileName": "./1.tst"
},
"modified": {
"content": "function x(alignments: RangeMapping[], originalLines: string[], modifiedLines: string[]): x[] { }\n",
"fileName": "./2.tst"
},
"diffs": [
{
"originalRange": "[1,2)",
"modifiedRange": "[1,2)",
"innerChanges": [
{
"originalRange": "[1,38 -> 1,38]",
"modifiedRange": "[1,38 -> 1,88]"
}
]
}
]
}