ide-assi 0.415.0 → 0.417.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +40 -14
- package/dist/bundle.esm.js +40 -14
- package/dist/components/ideDiff.js +40 -14
- package/package.json +1 -1
- package/src/components/ideDiff.js +40 -14
package/dist/bundle.cjs.js
CHANGED
|
@@ -235048,42 +235048,68 @@ class IdeDiff extends HTMLElement {
|
|
|
235048
235048
|
|
|
235049
235049
|
#applyDiffDecorations = (asisSrc, tobeSrc) => {
|
|
235050
235050
|
const dmp = new diffMatchPatchExports.diff_match_patch();
|
|
235051
|
-
|
|
235051
|
+
|
|
235052
|
+
// dmp의 기본 cleanupThreshold를 줄여서 더 세밀한 차이를 감지하도록 시도
|
|
235053
|
+
// 기본값은 0.5인데, 0으로 하면 더 많은 변화를 감지할 수 있습니다.
|
|
235054
|
+
// 하지만 너무 낮추면 노이즈가 많아질 수 있습니다.
|
|
235055
|
+
// dmp.Diff_EditCost = 4; // 편집 비용 조정, 기본 4
|
|
235056
|
+
// dmp.Diff_DualThreshold = 0.5; // 불명확한 Diff에 대한 임계값. 기본 0.5
|
|
235057
|
+
// dmp.Diff_Timeout = 1.0; // 타임아웃, 기본 1.0
|
|
235058
|
+
|
|
235059
|
+
// 텍스트를 줄 단위로 변환하여 Diff 수행
|
|
235060
|
+
const a = dmp.diff_linesToChars_(asisSrc, tobeSrc);
|
|
235061
|
+
const lineText1 = a.chars1;
|
|
235062
|
+
const lineText2 = a.chars2;
|
|
235063
|
+
const lineArray = a.lineArray;
|
|
235064
|
+
|
|
235065
|
+
// dmp.diff_main(text1, text2, checklines, deadline)
|
|
235066
|
+
// checklines: true (기본값)는 줄 단위 최적화, false는 문자 단위로.
|
|
235067
|
+
// 여기서는 diff_linesToChars_를 사용했으므로 true가 적절.
|
|
235068
|
+
const diffs = dmp.diff_main(lineText1, lineText2, true);
|
|
235069
|
+
|
|
235070
|
+
// cleanupEfficiency를 먼저 적용하여 효율적인 Diff를 만듭니다.
|
|
235071
|
+
// 이는 작은 변경사항이 인접해 있을 때 하나의 큰 변경으로 합치는 경향이 있습니다.
|
|
235072
|
+
// dmp.diff_cleanupEfficiency(diffs); // 오히려 이동을 놓칠 수 있음
|
|
235073
|
+
|
|
235074
|
+
// 그 다음 의미론적 정리를 적용합니다.
|
|
235052
235075
|
dmp.diff_cleanupSemantic(diffs);
|
|
235053
235076
|
|
|
235077
|
+
// 다시 문자열로 변환
|
|
235078
|
+
dmp.diff_charsToLines_(diffs, lineArray);
|
|
235079
|
+
|
|
235054
235080
|
const asisLineBuilder = new RangeSetBuilder();
|
|
235055
235081
|
const tobeLineBuilder = new RangeSetBuilder();
|
|
235056
235082
|
|
|
235057
235083
|
let asisCursor = 0;
|
|
235058
235084
|
let tobeCursor = 0;
|
|
235059
235085
|
|
|
235086
|
+
// 변경된 줄에 대한 새로운 데코레이션 클래스를 추가할 수 있습니다.
|
|
235060
235087
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
235061
235088
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
235089
|
+
// const changedLineDeco = Decoration.line({ class: "cm-changed-line-bg" }); // 필요하다면
|
|
235062
235090
|
|
|
235063
235091
|
for (const [op, text] of diffs) {
|
|
235064
235092
|
const len = text.length;
|
|
235065
|
-
const linesInChunk = text.split('\n');
|
|
235066
235093
|
|
|
235067
235094
|
switch (op) {
|
|
235068
235095
|
case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
|
|
235069
|
-
|
|
235070
|
-
|
|
235071
|
-
|
|
235072
|
-
|
|
235096
|
+
const tobeLines = text.split('\n');
|
|
235097
|
+
for (let i = 0; i < tobeLines.length; i++) {
|
|
235098
|
+
// 빈 줄이 아니고, 마지막 줄이면서 줄바꿈이 없는 경우가 아니면 데코레이션
|
|
235099
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && !text.endsWith('\n'))) {
|
|
235100
|
+
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
235073
235101
|
}
|
|
235074
|
-
|
|
235075
|
-
tobeCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
235102
|
+
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
235076
235103
|
}
|
|
235077
235104
|
break;
|
|
235078
235105
|
|
|
235079
235106
|
case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
|
|
235080
|
-
|
|
235081
|
-
|
|
235082
|
-
|
|
235083
|
-
|
|
235107
|
+
const asisLines = text.split('\n');
|
|
235108
|
+
for (let i = 0; i < asisLines.length; i++) {
|
|
235109
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === '' && !text.endsWith('\n'))) {
|
|
235110
|
+
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
235084
235111
|
}
|
|
235085
|
-
|
|
235086
|
-
asisCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
235112
|
+
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
235087
235113
|
}
|
|
235088
235114
|
break;
|
|
235089
235115
|
|
package/dist/bundle.esm.js
CHANGED
|
@@ -235044,42 +235044,68 @@ class IdeDiff extends HTMLElement {
|
|
|
235044
235044
|
|
|
235045
235045
|
#applyDiffDecorations = (asisSrc, tobeSrc) => {
|
|
235046
235046
|
const dmp = new diffMatchPatchExports.diff_match_patch();
|
|
235047
|
-
|
|
235047
|
+
|
|
235048
|
+
// dmp의 기본 cleanupThreshold를 줄여서 더 세밀한 차이를 감지하도록 시도
|
|
235049
|
+
// 기본값은 0.5인데, 0으로 하면 더 많은 변화를 감지할 수 있습니다.
|
|
235050
|
+
// 하지만 너무 낮추면 노이즈가 많아질 수 있습니다.
|
|
235051
|
+
// dmp.Diff_EditCost = 4; // 편집 비용 조정, 기본 4
|
|
235052
|
+
// dmp.Diff_DualThreshold = 0.5; // 불명확한 Diff에 대한 임계값. 기본 0.5
|
|
235053
|
+
// dmp.Diff_Timeout = 1.0; // 타임아웃, 기본 1.0
|
|
235054
|
+
|
|
235055
|
+
// 텍스트를 줄 단위로 변환하여 Diff 수행
|
|
235056
|
+
const a = dmp.diff_linesToChars_(asisSrc, tobeSrc);
|
|
235057
|
+
const lineText1 = a.chars1;
|
|
235058
|
+
const lineText2 = a.chars2;
|
|
235059
|
+
const lineArray = a.lineArray;
|
|
235060
|
+
|
|
235061
|
+
// dmp.diff_main(text1, text2, checklines, deadline)
|
|
235062
|
+
// checklines: true (기본값)는 줄 단위 최적화, false는 문자 단위로.
|
|
235063
|
+
// 여기서는 diff_linesToChars_를 사용했으므로 true가 적절.
|
|
235064
|
+
const diffs = dmp.diff_main(lineText1, lineText2, true);
|
|
235065
|
+
|
|
235066
|
+
// cleanupEfficiency를 먼저 적용하여 효율적인 Diff를 만듭니다.
|
|
235067
|
+
// 이는 작은 변경사항이 인접해 있을 때 하나의 큰 변경으로 합치는 경향이 있습니다.
|
|
235068
|
+
// dmp.diff_cleanupEfficiency(diffs); // 오히려 이동을 놓칠 수 있음
|
|
235069
|
+
|
|
235070
|
+
// 그 다음 의미론적 정리를 적용합니다.
|
|
235048
235071
|
dmp.diff_cleanupSemantic(diffs);
|
|
235049
235072
|
|
|
235073
|
+
// 다시 문자열로 변환
|
|
235074
|
+
dmp.diff_charsToLines_(diffs, lineArray);
|
|
235075
|
+
|
|
235050
235076
|
const asisLineBuilder = new RangeSetBuilder();
|
|
235051
235077
|
const tobeLineBuilder = new RangeSetBuilder();
|
|
235052
235078
|
|
|
235053
235079
|
let asisCursor = 0;
|
|
235054
235080
|
let tobeCursor = 0;
|
|
235055
235081
|
|
|
235082
|
+
// 변경된 줄에 대한 새로운 데코레이션 클래스를 추가할 수 있습니다.
|
|
235056
235083
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
235057
235084
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
235085
|
+
// const changedLineDeco = Decoration.line({ class: "cm-changed-line-bg" }); // 필요하다면
|
|
235058
235086
|
|
|
235059
235087
|
for (const [op, text] of diffs) {
|
|
235060
235088
|
const len = text.length;
|
|
235061
|
-
const linesInChunk = text.split('\n');
|
|
235062
235089
|
|
|
235063
235090
|
switch (op) {
|
|
235064
235091
|
case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
|
|
235065
|
-
|
|
235066
|
-
|
|
235067
|
-
|
|
235068
|
-
|
|
235092
|
+
const tobeLines = text.split('\n');
|
|
235093
|
+
for (let i = 0; i < tobeLines.length; i++) {
|
|
235094
|
+
// 빈 줄이 아니고, 마지막 줄이면서 줄바꿈이 없는 경우가 아니면 데코레이션
|
|
235095
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && !text.endsWith('\n'))) {
|
|
235096
|
+
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
235069
235097
|
}
|
|
235070
|
-
|
|
235071
|
-
tobeCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
235098
|
+
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
235072
235099
|
}
|
|
235073
235100
|
break;
|
|
235074
235101
|
|
|
235075
235102
|
case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
|
|
235076
|
-
|
|
235077
|
-
|
|
235078
|
-
|
|
235079
|
-
|
|
235103
|
+
const asisLines = text.split('\n');
|
|
235104
|
+
for (let i = 0; i < asisLines.length; i++) {
|
|
235105
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === '' && !text.endsWith('\n'))) {
|
|
235106
|
+
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
235080
235107
|
}
|
|
235081
|
-
|
|
235082
|
-
asisCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
235108
|
+
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
235083
235109
|
}
|
|
235084
235110
|
break;
|
|
235085
235111
|
|
|
@@ -231,42 +231,68 @@ export class IdeDiff extends HTMLElement {
|
|
|
231
231
|
|
|
232
232
|
#applyDiffDecorations = (asisSrc, tobeSrc) => {
|
|
233
233
|
const dmp = new diff_match_patch();
|
|
234
|
-
|
|
234
|
+
|
|
235
|
+
// dmp의 기본 cleanupThreshold를 줄여서 더 세밀한 차이를 감지하도록 시도
|
|
236
|
+
// 기본값은 0.5인데, 0으로 하면 더 많은 변화를 감지할 수 있습니다.
|
|
237
|
+
// 하지만 너무 낮추면 노이즈가 많아질 수 있습니다.
|
|
238
|
+
// dmp.Diff_EditCost = 4; // 편집 비용 조정, 기본 4
|
|
239
|
+
// dmp.Diff_DualThreshold = 0.5; // 불명확한 Diff에 대한 임계값. 기본 0.5
|
|
240
|
+
// dmp.Diff_Timeout = 1.0; // 타임아웃, 기본 1.0
|
|
241
|
+
|
|
242
|
+
// 텍스트를 줄 단위로 변환하여 Diff 수행
|
|
243
|
+
const a = dmp.diff_linesToChars_(asisSrc, tobeSrc);
|
|
244
|
+
const lineText1 = a.chars1;
|
|
245
|
+
const lineText2 = a.chars2;
|
|
246
|
+
const lineArray = a.lineArray;
|
|
247
|
+
|
|
248
|
+
// dmp.diff_main(text1, text2, checklines, deadline)
|
|
249
|
+
// checklines: true (기본값)는 줄 단위 최적화, false는 문자 단위로.
|
|
250
|
+
// 여기서는 diff_linesToChars_를 사용했으므로 true가 적절.
|
|
251
|
+
const diffs = dmp.diff_main(lineText1, lineText2, true);
|
|
252
|
+
|
|
253
|
+
// cleanupEfficiency를 먼저 적용하여 효율적인 Diff를 만듭니다.
|
|
254
|
+
// 이는 작은 변경사항이 인접해 있을 때 하나의 큰 변경으로 합치는 경향이 있습니다.
|
|
255
|
+
// dmp.diff_cleanupEfficiency(diffs); // 오히려 이동을 놓칠 수 있음
|
|
256
|
+
|
|
257
|
+
// 그 다음 의미론적 정리를 적용합니다.
|
|
235
258
|
dmp.diff_cleanupSemantic(diffs);
|
|
236
259
|
|
|
260
|
+
// 다시 문자열로 변환
|
|
261
|
+
dmp.diff_charsToLines_(diffs, lineArray);
|
|
262
|
+
|
|
237
263
|
const asisLineBuilder = new RangeSetBuilder();
|
|
238
264
|
const tobeLineBuilder = new RangeSetBuilder();
|
|
239
265
|
|
|
240
266
|
let asisCursor = 0;
|
|
241
267
|
let tobeCursor = 0;
|
|
242
268
|
|
|
269
|
+
// 변경된 줄에 대한 새로운 데코레이션 클래스를 추가할 수 있습니다.
|
|
243
270
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
244
271
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
272
|
+
// const changedLineDeco = Decoration.line({ class: "cm-changed-line-bg" }); // 필요하다면
|
|
245
273
|
|
|
246
274
|
for (const [op, text] of diffs) {
|
|
247
275
|
const len = text.length;
|
|
248
|
-
const linesInChunk = text.split('\n');
|
|
249
276
|
|
|
250
277
|
switch (op) {
|
|
251
278
|
case diff_match_patch.DIFF_INSERT:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
279
|
+
const tobeLines = text.split('\n');
|
|
280
|
+
for (let i = 0; i < tobeLines.length; i++) {
|
|
281
|
+
// 빈 줄이 아니고, 마지막 줄이면서 줄바꿈이 없는 경우가 아니면 데코레이션
|
|
282
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && !text.endsWith('\n'))) {
|
|
283
|
+
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
256
284
|
}
|
|
257
|
-
|
|
258
|
-
tobeCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
285
|
+
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
259
286
|
}
|
|
260
287
|
break;
|
|
261
288
|
|
|
262
289
|
case diff_match_patch.DIFF_DELETE:
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
290
|
+
const asisLines = text.split('\n');
|
|
291
|
+
for (let i = 0; i < asisLines.length; i++) {
|
|
292
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === '' && !text.endsWith('\n'))) {
|
|
293
|
+
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
267
294
|
}
|
|
268
|
-
|
|
269
|
-
asisCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
295
|
+
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
270
296
|
}
|
|
271
297
|
break;
|
|
272
298
|
|
package/package.json
CHANGED
|
@@ -231,42 +231,68 @@ export class IdeDiff extends HTMLElement {
|
|
|
231
231
|
|
|
232
232
|
#applyDiffDecorations = (asisSrc, tobeSrc) => {
|
|
233
233
|
const dmp = new diff_match_patch();
|
|
234
|
-
|
|
234
|
+
|
|
235
|
+
// dmp의 기본 cleanupThreshold를 줄여서 더 세밀한 차이를 감지하도록 시도
|
|
236
|
+
// 기본값은 0.5인데, 0으로 하면 더 많은 변화를 감지할 수 있습니다.
|
|
237
|
+
// 하지만 너무 낮추면 노이즈가 많아질 수 있습니다.
|
|
238
|
+
// dmp.Diff_EditCost = 4; // 편집 비용 조정, 기본 4
|
|
239
|
+
// dmp.Diff_DualThreshold = 0.5; // 불명확한 Diff에 대한 임계값. 기본 0.5
|
|
240
|
+
// dmp.Diff_Timeout = 1.0; // 타임아웃, 기본 1.0
|
|
241
|
+
|
|
242
|
+
// 텍스트를 줄 단위로 변환하여 Diff 수행
|
|
243
|
+
const a = dmp.diff_linesToChars_(asisSrc, tobeSrc);
|
|
244
|
+
const lineText1 = a.chars1;
|
|
245
|
+
const lineText2 = a.chars2;
|
|
246
|
+
const lineArray = a.lineArray;
|
|
247
|
+
|
|
248
|
+
// dmp.diff_main(text1, text2, checklines, deadline)
|
|
249
|
+
// checklines: true (기본값)는 줄 단위 최적화, false는 문자 단위로.
|
|
250
|
+
// 여기서는 diff_linesToChars_를 사용했으므로 true가 적절.
|
|
251
|
+
const diffs = dmp.diff_main(lineText1, lineText2, true);
|
|
252
|
+
|
|
253
|
+
// cleanupEfficiency를 먼저 적용하여 효율적인 Diff를 만듭니다.
|
|
254
|
+
// 이는 작은 변경사항이 인접해 있을 때 하나의 큰 변경으로 합치는 경향이 있습니다.
|
|
255
|
+
// dmp.diff_cleanupEfficiency(diffs); // 오히려 이동을 놓칠 수 있음
|
|
256
|
+
|
|
257
|
+
// 그 다음 의미론적 정리를 적용합니다.
|
|
235
258
|
dmp.diff_cleanupSemantic(diffs);
|
|
236
259
|
|
|
260
|
+
// 다시 문자열로 변환
|
|
261
|
+
dmp.diff_charsToLines_(diffs, lineArray);
|
|
262
|
+
|
|
237
263
|
const asisLineBuilder = new RangeSetBuilder();
|
|
238
264
|
const tobeLineBuilder = new RangeSetBuilder();
|
|
239
265
|
|
|
240
266
|
let asisCursor = 0;
|
|
241
267
|
let tobeCursor = 0;
|
|
242
268
|
|
|
269
|
+
// 변경된 줄에 대한 새로운 데코레이션 클래스를 추가할 수 있습니다.
|
|
243
270
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
244
271
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
272
|
+
// const changedLineDeco = Decoration.line({ class: "cm-changed-line-bg" }); // 필요하다면
|
|
245
273
|
|
|
246
274
|
for (const [op, text] of diffs) {
|
|
247
275
|
const len = text.length;
|
|
248
|
-
const linesInChunk = text.split('\n');
|
|
249
276
|
|
|
250
277
|
switch (op) {
|
|
251
278
|
case diff_match_patch.DIFF_INSERT:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
279
|
+
const tobeLines = text.split('\n');
|
|
280
|
+
for (let i = 0; i < tobeLines.length; i++) {
|
|
281
|
+
// 빈 줄이 아니고, 마지막 줄이면서 줄바꿈이 없는 경우가 아니면 데코레이션
|
|
282
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === '' && !text.endsWith('\n'))) {
|
|
283
|
+
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
256
284
|
}
|
|
257
|
-
|
|
258
|
-
tobeCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
285
|
+
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
259
286
|
}
|
|
260
287
|
break;
|
|
261
288
|
|
|
262
289
|
case diff_match_patch.DIFF_DELETE:
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
290
|
+
const asisLines = text.split('\n');
|
|
291
|
+
for (let i = 0; i < asisLines.length; i++) {
|
|
292
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === '' && !text.endsWith('\n'))) {
|
|
293
|
+
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
267
294
|
}
|
|
268
|
-
|
|
269
|
-
asisCursor += linesInChunk[i].length + (i < linesInChunk.length - 1 ? 1 : 0);
|
|
295
|
+
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
270
296
|
}
|
|
271
297
|
break;
|
|
272
298
|
|