Skip to content

Commit

Permalink
fix: invalid breakpoints line number error
Browse files Browse the repository at this point in the history
  • Loading branch information
erha19 committed Sep 5, 2023
1 parent 1333888 commit 44a6c09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/debug/src/browser/editor/debug-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ export class DebugModel implements IDebugModel {
if (positions.length <= 1) {
return;
}
const maxLineCount = model.getLineCount();
if (lineNumber > maxLineCount) {
return;
}
const firstColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
const lastColumn = model.getLineLastNonWhitespaceColumn(lineNumber);
positions.forEach((p) => {
Expand Down Expand Up @@ -538,7 +542,8 @@ export class DebugModel implements IDebugModel {
const lineNumber = status && status.line ? status.line : breakpoint.raw.line;
const column = breakpoint.raw.column || 0;
const model = this.editor.getModel()!;
const renderInline = column > model.getLineFirstNonWhitespaceColumn(lineNumber);
const maxLine = model.getLineCount();
const renderInline = lineNumber > maxLine ? false : column > model.getLineFirstNonWhitespaceColumn(lineNumber);
const range = new monaco.Range(lineNumber, column, lineNumber, column + 1);
const { className, message } = this.decorator.getDecoration(
breakpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ export class DebugBreakpointsService extends WithEventBus {
if (!monacoModel) {
return;
}

const getContent = monacoModel.instance.getMonacoModel().getLineContent(line);
const model = monacoModel.instance.getMonacoModel();
const maxLineCount = model.getLineCount();
if (line > maxLineCount) {
return;
}
const getContent = model.getLineContent(line);
node.fireDescriptionChange(getContent.trim());
}
}
Expand Down

0 comments on commit 44a6c09

Please sign in to comment.