Skip to content

Commit

Permalink
12970 Fixes hover widget jumping (#12971)
Browse files Browse the repository at this point in the history
Fixes #12970
  • Loading branch information
Zebsterpasha authored Oct 12, 2023
1 parent ff1ee2b commit e0c82d1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/debug/src/browser/editor/debug-hover-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,24 @@ export class DebugHoverWidget extends SourceTreeWidget implements monaco.editor.
}
} else { // use fallback if no provider was registered
matchingExpression = this.expressionProvider.get(this.editor.getControl().getModel()!, options.selection);
if (matchingExpression) {
const expressionLineContent = this.editor
.getControl()
.getModel()!
.getLineContent(this.options.selection.startLineNumber);
const startColumn =
expressionLineContent.indexOf(
matchingExpression,
this.options.selection.startColumn - matchingExpression.length
) + 1;
const endColumn = startColumn + matchingExpression.length;
this.options.selection = new monaco.Range(
this.options.selection.startLineNumber,
startColumn,
this.options.selection.startLineNumber,
endColumn
);
}
}

if (!matchingExpression) {
Expand Down

0 comments on commit e0c82d1

Please sign in to comment.