Skip to content

feat: Toggle category annotations visibility#7

Closed
jellydn wants to merge 6 commits into
mainfrom
ralph/toggle-category-annotations
Closed

feat: Toggle category annotations visibility#7
jellydn wants to merge 6 commits into
mainfrom
ralph/toggle-category-annotations

Conversation

@jellydn

@jellydn jellydn commented Jan 11, 2026

Copy link
Copy Markdown
Owner

What

Adds the ability to toggle inline annotation visibility by category (TODOs, FIXMEs, etc.) in the Code Notes extension.

Why

Users often want to focus on specific types of annotations rather than seeing all of them at once. This feature allows selective visibility control per category, improving the editing experience.

How

  • US-001: Added category visibility state tracking in src/commands.ts
  • US-002: Implemented decoration filtering based on category visibility in src/decorations.ts
  • US-003: Added toggleCategoryAnnotations command with quick pick UI for category selection

Changes

  • New command: codeNotes.toggleCategoryAnnotations
  • Category state persists during the session
  • All 3 user stories implemented and passing tests

@changeset-bot

changeset-bot Bot commented Jan 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c16df85

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jan 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ralph/toggle-category-annotations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @jellydn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience of the Code Notes extension by introducing granular control over inline annotation visibility. Users can now selectively display or hide annotation categories like 'bug' or 'question', reducing visual clutter and allowing them to focus on specific types of feedback without disabling all annotations. This feature is accessible via a new command palette entry and maintains visibility state throughout the current session.

Highlights

  • Category Visibility Toggle: Introduced a new feature allowing users to toggle the visibility of inline annotations by category (e.g., 'bug', 'question', 'todo').
  • Quick Pick UI: A new command codeReview.toggleCategoryAnnotations provides an interactive quick pick menu to select and toggle individual categories, or show/hide all.
  • Session-based State: The visibility state of categories is maintained for the current session, resetting upon extension reload.
  • Decoration Filtering: The annotation rendering logic (updateDecorations) now respects the visibility settings, dynamically showing or hiding decorations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request successfully introduces a valuable feature for toggling the visibility of category annotations, which will improve the user experience by reducing visual clutter. The implementation is logical and covers all the requirements outlined in the PR description. My review includes a significant suggestion to refactor the way comment categories are defined. Currently, they are duplicated in several places, which could lead to maintenance issues. By centralizing the category definitions, the code will become more robust and easier to update in the future.

Comment thread src/decorations.ts
const inlineDecorationTypes: Map<CommentCategory, TextEditorDecorationType> = new Map()
const backgroundDecorationTypes: Map<CommentCategory, TextEditorDecorationType> = new Map()

const ALL_CATEGORIES: CommentCategory[] = ['bug', 'question', 'suggestion', 'nitpick', 'note']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This new ALL_CATEGORIES constant duplicates the list of categories that already exists in src/commands.ts (in CATEGORY_ITEMS and the new TOGGLE_CATEGORY_ITEMS). This makes the code harder to maintain, as any changes to categories must be manually synchronized across multiple files.

To create a single source of truth, I suggest defining a more comprehensive category structure here and exporting it. This file is a good location for it since commands.ts already depends on decorations.ts, avoiding circular dependencies.

You could then use this structure to derive ALL_CATEGORIES and also refactor src/commands.ts to use it, eliminating duplication.

Suggested change
const ALL_CATEGORIES: CommentCategory[] = ['bug', 'question', 'suggestion', 'nitpick', 'note']
export const CATEGORIES = [
{ value: 'bug', label: 'Bug' },
{ value: 'question', label: 'Question' },
{ value: 'suggestion', label: 'Suggestion' },
{ value: 'nitpick', label: 'Nitpick' },
{ value: 'note', label: 'Note' },
] as const;
const ALL_CATEGORIES: CommentCategory[] = CATEGORIES.map(c => c.value);

Comment thread src/commands.ts
Comment on lines +900 to +906
const TOGGLE_CATEGORY_ITEMS: { label: string, value: CommentCategory, description: string }[] = [
{ label: 'Bug', value: 'bug', description: '' },
{ label: 'Question', value: 'question', description: '' },
{ label: 'Suggestion', value: 'suggestion', description: '' },
{ label: 'Nitpick', value: 'nitpick', description: '' },
{ label: 'Note', value: 'note', description: '' },
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This TOGGLE_CATEGORY_ITEMS constant is another duplication of the category list.

Following my suggestion in src/decorations.ts to create a central CATEGORIES constant, you could import it here and generate the quick pick items dynamically inside toggleCategoryAnnotations, removing the need for this constant.

For example:

// import { CATEGORIES } from './decorations';

// ... inside toggleCategoryAnnotations()
const items = [
  // ... 'Show All' and 'Hide All' items
  ...CATEGORIES.map(item => ({
    label: isCategoryVisible(item.value) ? `$(check) ${item.label}` : item.label,
    value: item.value,
    description: isCategoryVisible(item.value) ? 'Visible' : 'Hidden',
  })),
];

This would remove this duplicated constant and make the code more maintainable. You could then apply a similar pattern to the CATEGORY_ITEMS constant in this file to eliminate all category duplication.

@jellydn jellydn force-pushed the ralph/toggle-category-annotations branch from c08a828 to c16df85 Compare January 12, 2026 03:10
@jellydn jellydn closed this May 25, 2026
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.

1 participant