Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/vs/editor/common/viewModel/viewModelImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,10 @@ export class ViewModel extends Disposable implements IViewModel {
* Gives a hint that a lot of requests are about to come in for these line numbers.
*/
public setViewport(startLineNumber: number, endLineNumber: number, centeredLineNumber: number): void {
if (this._lines.getViewLineCount() === 0) {
// No visible lines to set viewport on
return;
}
Comment on lines +771 to +774
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

This guard condition correctly prevents the error, but there's no test coverage for this edge case. Consider adding a test that verifies setViewport behaves correctly when called on a view model with all lines hidden (getViewLineCount() === 0), similar to the existing tests in viewModelImpl.test.ts for hidden areas.

Copilot uses AI. Check for mistakes.
this._viewportStart.update(this, startLineNumber);
}

Expand Down
Loading