Skip to content

Editing a comment freezes VS Code#274708

Merged
alexr00 merged 1 commit intomainfrom
alexr00/issue274455
Nov 3, 2025
Merged

Editing a comment freezes VS Code#274708
alexr00 merged 1 commit intomainfrom
alexr00/issue274455

Conversation

@alexr00
Copy link
Member

@alexr00 alexr00 commented Nov 3, 2025

Fixes #274455

Copilot AI review requested due to automatic review settings November 3, 2025 09:48
@alexr00 alexr00 enabled auto-merge (squash) November 3, 2025 09:48
@alexr00 alexr00 self-assigned this Nov 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the _refresh method in CommentThreadBody to prevent unnecessary resize events by caching the previous container dimensions and only firing the resize event when dimensions actually change.

  • Adds dimension caching to avoid redundant resize events
  • Updates the early return condition to check both zero dimensions and unchanged dimensions

private _refresh() {
const dimensions = dom.getClientArea(this.container);
if (dimensions.height === 0 && dimensions.width === 0) {
if ((dimensions.height === 0 && dimensions.width === 0) || (this._containerClientArea && this._containerClientArea.height === dimensions.height && this._containerClientArea.width === dimensions.width)) {
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

The condition is overly complex and difficult to read. Consider using Dimension.equals() helper method which already exists in the codebase for dimension comparison. This would simplify the condition to: if ((dimensions.height === 0 && dimensions.width === 0) || Dimension.equals(this._containerClientArea, dimensions))

Suggested change
if ((dimensions.height === 0 && dimensions.width === 0) || (this._containerClientArea && this._containerClientArea.height === dimensions.height && this._containerClientArea.width === dimensions.width)) {
if ((dimensions.height === 0 && dimensions.width === 0) || dom.Dimension.equals(this._containerClientArea, dimensions)) {

Copilot uses AI. Check for mistakes.
});
}

private _containerClientArea: dom.Dimension | null = null;
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

The field _containerClientArea is not cleaned up in the dispose() method. While not strictly required for primitive values, for consistency with the class's disposal pattern and to allow potential garbage collection, consider setting it to null in the dispose() method.

Copilot uses AI. Check for mistakes.
@alexr00 alexr00 merged commit 81ce677 into main Nov 3, 2025
33 of 34 checks passed
@alexr00 alexr00 deleted the alexr00/issue274455 branch November 3, 2025 10:16
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Dec 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing a comment freezes VS Code

3 participants