Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Remove onNewRenderLine #160

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/breakpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,6 @@ export namespace Breakpoints {
this.breakpoints = this._state[newType];
}

changeLines(lines: number[]) {
if (!lines && this.breakpoints.length === 0) {
return;
}
if (lines.length === 0) {
this.breakpoints = [];
} else {
const breakpoint = { ...this.breakpoints[0] };
let breakpoints: Breakpoints.IBreakpoint[] = [];
lines.forEach(line => {
breakpoints.push({ ...breakpoint, line });
});
this.breakpoints = [...breakpoints];
}
}

get isDisposed(): boolean {
return this._isDisposed;
}
Expand Down
27 changes: 1 addition & 26 deletions src/handlers/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IDisposable } from '@phosphor/disposable';

import { Signal } from '@phosphor/signaling';

import { Doc, Editor } from 'codemirror';
import { Editor } from 'codemirror';

import { Breakpoints, SessionTypes } from '../breakpoints';

Expand Down Expand Up @@ -142,8 +142,6 @@ export class CellManager implements IDisposable {

const editor = cell.editor as CodeMirrorEditor;

this.previousLineCount = editor.lineCount;

const editorBreakpoints = this.getBreakpointsInfo(cell).map(lineInfo => {
return Private.createBreakpoint(
this._debuggerService.session.client.name,
Expand All @@ -161,13 +159,11 @@ export class CellManager implements IDisposable {
]);

editor.editor.on('gutterClick', this.onGutterClick);
editor.editor.on('renderLine', this.onNewRenderLine);
}

protected removeListener(cell: CodeCell) {
const editor = cell.editor as CodeMirrorEditor;
editor.editor.off('gutterClick', this.onGutterClick);
editor.editor.off('renderLine', this.onNewRenderLine);
}

protected getEditorId(): string {
Expand Down Expand Up @@ -197,26 +193,6 @@ export class CellManager implements IDisposable {
void this._debuggerService.updateBreakpoints(breakpoints);
};

protected onNewRenderLine = (editor: Editor, line: any) => {
const lineInfo = editor.lineInfo(line);
if (lineInfo.handle && lineInfo.handle.order === false) {
return;
}
const doc: Doc = editor.getDoc();
const linesNumber = doc.lineCount();
if (this.previousLineCount !== linesNumber) {
let lines: number[] = [];
doc.eachLine(line => {
if ((line as ILineInfo).gutterMarkers) {
const lineInfo = editor.lineInfo(line);
lines.push(lineInfo.line + 1);
}
});
this.breakpointsModel.changeLines(lines);
this.previousLineCount = linesNumber;
}
};

private addBreakpointsToEditor(cell: CodeCell) {
this.clearGutter(cell);
const editor = cell.editor as CodeMirrorEditor;
Expand All @@ -243,7 +219,6 @@ export class CellManager implements IDisposable {
}

private _previousCell: CodeCell;
private previousLineCount: number;
private _debuggerModel: Debugger.Model;
private breakpointsModel: Breakpoints.Model;
private _activeCell: CodeCell;
Expand Down