Skip to content

Conversation

@mvtec-richter
Copy link
Contributor

What it does

When debugging, the current position is always actively centered. This causes the visible part of the document to jump around for each debug step. The auto option for reveal position leads to a much smoother experience.

How to test

  • Debug a script, that does not fit on the screen.
  • Use step or jump to line.
  • The position should not update on every step, but only when the new position is out of sight.

Follow-ups

  • This change applies the 'auto' option to all usages of EditorManager.open and EditorManager.revealSelection. I'm not 100% sure, this is always the right thing. Nevertheless, I think, 'auto' is a much better default then 'center'.

Attribution

Contributed on behalf of MVTec Software GmbH

Review checklist

Reminder for reviewers

When debugging, the current position always is centered, which leads to a lot of jumping around during stepping. The auto option for reveal position is much smoother.

Signed-off-by: Florian Richter <[email protected]>
if (Position.is(selection)) {
editor.cursor = selection;
editor.revealPosition(selection);
editor.revealPosition(selection, { vertical: 'auto' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the behavior for the breakpoint case is improved, but I'm a little hesitant to put this change here in the EditorManager, since it means it will change the behavior of all callers providing positions as selection (but also not those providing ranges, for better or worse). Would it make sense to put the relevant code in the handler for the stop event, instead, to more narrowly target the case of interest? Can you think of other cases where the jumpiness of centering is inappropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In further thought, I agree. When selection search results, clicking on a breakpoint in the breakpoint list, selection an object in the call hierarchy or clicking on an error message in the terminal it might make sense to center the view, because an actual jump is expected when using these features.
I'll see, if I can add option and handle this in the stop event.

if (Position.is(selection)) {
editor.cursor = selection;
editor.revealPosition(selection, { vertical: 'auto' });
editor.revealPosition(selection, { vertical: options?.revealOption ?? 'center' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like enabling this parameter to be customized by callers. Now that it is customizable, I think it would make sense to apply the same customization to revealRange below.

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Needs merge in PR Backlog Oct 2, 2025
@colin-grant-work colin-grant-work merged commit 11aa37b into eclipse-theia:master Oct 2, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Oct 2, 2025
@github-actions github-actions bot added this to the 1.66.0 milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants