← 输入框|github.com|刷新
Skip to content

feat(comment): Hidden comments - #9052

Open
Vignesh (vicky1999) wants to merge 6 commits into
microsoft:mainfrom
vicky1999:vicky1999/7431-hidden-comments
Open

Vignesh (vicky1999) wants to merge 6 commits into
microsoft:mainfrom
vicky1999:vicky1999/7431-hidden-comments

Conversation

@vicky1999

Copy link
Copy Markdown
Contributor

Solves #7431

Summary

  • whether a comment is minimized or not and the reason for minimized is available in IssueComment and PullRequestReviewComment.
  • Added the two fields (isMinimized, minimizedReason) to gql query and used in the component to minimize with the reason open the comment on click.
  • Added fold and unfold svg files from octicons to match the UI.

Demo:

Hidden.comments.mp4

Follow ups

  • It looks like there's a button to hide the comment with reason. It could be a follow up if it need to be added on the webview.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Expanded comment interactions currently collapse the comment, keyboard toggling is unavailable, and missing reasons render as “undefined”.

2 open findings
What changed in this PR

Adds support for displaying GitHub-minimized comments as collapsible entries with their minimization reason.

Changes:

  • Fetches and propagates minimization metadata.
  • Adds collapsible comment UI, styling, and icons.
  • Adds parser and component tests.
File Description
webviews/​editorWebview/​test/​comment.test.tsx Tests minimized comment rendering.
webviews/​editorWebview/​index.css Styles minimized comments.
webviews/​components/​timeline.tsx Formatting-only change.
webviews/​components/​icon.tsx Exports fold icons.
webviews/​components/​comment.tsx Implements minimized comment UI.
src/​test/​github/​utils.test.ts Tests metadata parsing.
src/​github/​utils.ts Propagates minimization metadata.
src/​github/​queriesShared.gql Queries minimization fields.
src/​github/​graphql.ts Extends GraphQL comment types.
src/​common/​timelineEvent.ts Extends timeline comment events.
src/​common/​comment.ts Extends shared comment data.
resources/​icons/​unfold.svg Adds unfold icon.
resources/​icons/​fold.svg Adds fold icon.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread webviews/components/comment.tsx Resolved
Comment thread webviews/components/comment.tsx Resolved
Copilot AI balanced review requested due to automatic review settings October 11, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new component test targets the wrong element and fails, while enum-based reasons can render with raw underscores.

1 open finding
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Normalize enum separators in user-facing reason labels

webviews/​components/​comment.tsx:91

GraphQL returns enum values such as OFF_TOPIC; lowercasing alone renders the user-facing reason as off_topic. Normalize enum separators (or map the enum to display labels) so all supported reasons are readable.

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 11, 2026 19:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Classifier reasons containing underscores are rendered incorrectly in the user-facing message.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Normalize underscores in minimized reason

webviews/​components/​comment.tsx:91

minimizedReason can contain classifier values such as OFF_TOPIC (as represented by the new parser test), so lowercasing alone renders the user-facing reason as off_topic. Normalize underscores to hyphens so the message matches GitHub's “off-topic” wording.

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 13, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Enum reasons containing underscores are rendered incorrectly in the user-facing label.

1 open finding

🧠 Review effort: Balanced

Comment thread webviews/components/comment.tsx Resolved
Copilot AI balanced review requested due to automatic review settings October 14, 2026 07:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Expanded minimized comments currently render an unintended nested border.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Remove nested comment border in minimized issue comments

webviews/​editorWebview/​index.css:2265

The border: none rule is applied to .minimized-body, but that wrapper has no border; the nested .comment-container still receives the global card border from index.css:1334-1342. Expanded minimized issue comments therefore render a second bordered card inside the outer minimized-comment border. Keep the padding on the wrapper and remove the border from its direct comment child instead.

🧠 Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 22, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review found no blocking issues in metadata propagation, collapsible rendering, keyboard handling, or the added tests.

No open issues 🎉

Review effort: Balanced

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! I think review summaries can also be hidden on GitHub, but they are not included in the new minimized feature.

Comment thread resources/icons/fold.svg

@alexr00 Alex Ross (alexr00) Oct 28, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should use the codicons for fold and unfold for these. Codicons: https://microsoft.github.io/vscode-codicons/dist/codicon.html

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These preserves tests don't seem terribly useful.

const canEdit: boolean = !!(comment as Partial<IComment | PullRequest | CommentEvent>).canEdit;
const canDelete: boolean = !!(comment as Partial<IComment | CommentEvent>).canDelete;
const isMinimized: boolean = (comment as Partial<CommentEvent>).isMinimized ?? false;
const minimizedReason: string | undefined = (comment as Partial<CommentEvent>).minimizedReason?.toLowerCase().replace(/_/g, ' ') ?? undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does GitHub provide a human-readable value for this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems like not, but instead of doing a replace like this, we should map well known slugs to nice user-facing messages.

children?: React.ReactNode;
};

function MinimizedComment({ isMinimized, minimizedReason, children }: MinimizedCommentProps) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The isMinimized prop is redundant. MinimizedComment is only rendered when it's true.

return (
<div className="minimized-comment-container">
<div
className="minimized-comment-header"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use a native button?

const ReviewEventView = (event: ReviewEvent) => {
const comments = groupCommentsByThread(event.comments);
const reviewIsPending = event.state === 'PENDING';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants