Skip to content

Commit ec689c6

Browse files
committed
Remove unnecessary code
1 parent 5e60e34 commit ec689c6

2 files changed

Lines changed: 1 addition & 78 deletions

File tree

src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -315,63 +315,10 @@ function createLineMappingFromPreviousLineMapping(classifier: WrappingCharacterC
315315
breakingOffsetsVisibleColumn.length = breakingOffsetsCount;
316316
arrPool1 = previousBreakingData.breakOffsets;
317317
arrPool2 = previousBreakingData.breakingOffsetsVisibleColumn;
318-
previousBreakingData.breakingColumn = firstLineBreakingColumn;
319318
previousBreakingData.breakOffsets = breakingOffsets;
320319
previousBreakingData.breakingOffsetsVisibleColumn = breakingOffsetsVisibleColumn;
321320
previousBreakingData.wrappedTextIndentLength = wrappedTextIndentLength;
322321
return previousBreakingData;
323-
324-
// return new LineBreakingData(firstLineBreakingColumn, breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
325-
326-
// const expected = createLineMapping(classifier, lineText, tabSize, firstLineBreakingColumn, columnsForFullWidthChar, hardWrappingIndent);
327-
// const actual = new LineBreakingData(firstLineBreakingColumn, breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
328-
// try {
329-
// actual.assertEqual(expected);
330-
// } catch (err) {
331-
// console.log(`BREAKING!!`);
332-
// console.log(err);
333-
// console.log(`
334-
// firstLineBreakingColumn: ${firstLineBreakingColumn}
335-
336-
// previous breaks: ${JSON.stringify(prevBreakingOffsets)}, breakingOffsetsVisibleColumn: ${JSON.stringify(prevBreakingOffsetsVisibleColumn)}
337-
// expected breaks: ${JSON.stringify(expected?.breakOffsets)}, breakingOffsetsVisibleColumn: ${JSON.stringify(expected?.breakingOffsetsVisibleColumn)}
338-
// actual breaks: ${JSON.stringify(actual?.breakOffsets)}, breakingOffsetsVisibleColumn: ${JSON.stringify(actual?.breakingOffsetsVisibleColumn)}
339-
340-
// previous str: ${toAnnotatedText(lineText, previousBreakingData)}
341-
// expected str: ${toAnnotatedText(lineText, expected)}
342-
// actual str: ${toAnnotatedText(lineText, actual)}
343-
344-
// assertIncrementalLineMapping(
345-
// factory, ${str(lineText)}, 4,
346-
// ${previousBreakingData.breakingColumn}, ${str(toAnnotatedText(lineText, previousBreakingData))},
347-
// ${expected!.breakingColumn}, ${str(toAnnotatedText(lineText, expected))},
348-
// WrappingIndent.${hardWrappingIndent === WrappingIndent.None ? 'None' : hardWrappingIndent === WrappingIndent.Same ? 'Same' : hardWrappingIndent === WrappingIndent.Indent ? 'Indent' : 'DeepIndent'}
349-
// );
350-
// `);
351-
// function str(strr: string) {
352-
// return `'${strr.replace(/\\/g, '\\\\').replace(/'/g, '\\\'')}'`;
353-
// }
354-
// function toAnnotatedText(text: string, lineBreakingData: LineBreakingData | null): string {
355-
// // Insert line break markers again, according to algorithm
356-
// let actualAnnotatedText = '';
357-
// if (lineBreakingData) {
358-
// let previousLineIndex = 0;
359-
// for (let i = 0, len = text.length; i < len; i++) {
360-
// let r = LineBreakingData.getOutputPositionOfInputOffset(lineBreakingData.breakOffsets, i);
361-
// if (previousLineIndex !== r.outputLineIndex) {
362-
// previousLineIndex = r.outputLineIndex;
363-
// actualAnnotatedText += '|';
364-
// }
365-
// actualAnnotatedText += text.charAt(i);
366-
// }
367-
// } else {
368-
// // No wrapping
369-
// actualAnnotatedText = text;
370-
// }
371-
// return actualAnnotatedText;
372-
// }
373-
// }
374-
// return actual;
375322
}
376323

377324
function createLineMapping(classifier: WrappingCharacterClassifier, lineText: string, tabSize: number, firstLineBreakingColumn: number, columnsForFullWidthChar: number, hardWrappingIndent: WrappingIndent): LineBreakingData | null {
@@ -459,7 +406,7 @@ function createLineMapping(classifier: WrappingCharacterClassifier, lineText: st
459406
breakingOffsets[breakingOffsetsCount] = len;
460407
breakingOffsetsVisibleColumn[breakingOffsetsCount] = visibleColumn;
461408

462-
return new LineBreakingData(firstLineBreakingColumn, breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
409+
return new LineBreakingData(breakingOffsets, breakingOffsetsVisibleColumn, wrappedTextIndentLength);
463410
}
464411

465412
function computeCharWidth(charCode: number, visibleColumn: number, tabSize: number, columnsForFullWidthChar: number): number {

src/vs/editor/common/viewModel/splitLinesCollection.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,11 @@ export class OutputPosition {
2828

2929
export class LineBreakingData {
3030
constructor(
31-
public breakingColumn: number,
3231
public breakOffsets: number[],
3332
public breakingOffsetsVisibleColumn: number[],
3433
public wrappedTextIndentLength: number
3534
) { }
3635

37-
assertEqual(other: LineBreakingData | null): void {
38-
if (other === null) {
39-
throw new Error(`x--unexpected--1`);
40-
}
41-
if (other.breakingColumn !== this.breakingColumn) {
42-
throw new Error(`x--unexpected--2`);
43-
}
44-
if (other.wrappedTextIndentLength !== this.wrappedTextIndentLength) {
45-
throw new Error(`x--unexpected--3`);
46-
}
47-
if (other.breakOffsets.length !== this.breakOffsets.length) {
48-
throw new Error(`x--unexpected--4`);
49-
}
50-
for (let i = 0; i < this.breakOffsets.length; i++) {
51-
if (this.breakOffsets[i] !== other.breakOffsets[i]) {
52-
throw new Error(`x--unexpected--5`);
53-
}
54-
if (this.breakingOffsetsVisibleColumn[i] !== other.breakingOffsetsVisibleColumn[i]) {
55-
throw new Error(`x--unexpected--6`);
56-
}
57-
}
58-
}
59-
6036
public static getInputOffsetOfOutputPosition(breakOffsets: number[], outputLineIndex: number, outputOffset: number): number {
6137
if (outputLineIndex === 0) {
6238
return outputOffset;

0 commit comments

Comments
 (0)