Skip to content

[FEATURE] Support multiple notes on a single line #6

@jnahian

Description

@jnahian

Feature Description

Add the ability to attach multiple context notes to a single line of code, allowing developers to add different types of annotations, comments, or references to the same line without conflicts.

Problem/Motivation

Currently, the extension only supports one note per line. When working on complex code, developers often need to add multiple types of annotations to the same line:

  • A TODO comment
  • A reference to related code
  • A bug note
  • Documentation or explanation
  • A link to an issue or PR

Having to choose which note to attach or spreading them across adjacent lines reduces the effectiveness of the note-taking system.

Proposed Solution

Allow multiple notes to be attached to a single line with the following features:

  1. Visual Indicators: Show a count badge or stacked icon in the gutter when multiple notes exist
  2. Note List View: When clicking on a line with multiple notes, display all notes in a list or panel
  3. Note Types/Categories: Optionally allow categorizing notes (TODO, BUG, REFERENCE, NOTE, etc.)
  4. Individual Management: Each note can be edited or deleted independently
  5. Quick Add: Provide a quick way to add another note to a line that already has one

Alternative Solutions

  1. Adjacent Lines: Continue using adjacent lines for multiple notes (current workaround)
  2. Combined Notes: Merge all notes into a single text field with manual formatting
  3. Linked Notes: Create a primary note with links to secondary notes stored elsewhere
  4. Hierarchical Notes: Support nested/child notes under a parent note

Use Cases

  1. Code Review: Add both a question and a suggested improvement to the same line
  2. Bug Tracking: Attach a bug description and a link to the issue tracker on the problematic line
  3. Learning: Add both an explanation and a reference link when studying unfamiliar code
  4. Refactoring: Mark a line with both a TODO and a note about why the change is needed
  5. Collaboration: Multiple team members can add their own notes to the same line without overwriting each other's comments

Examples

Similar features in other tools:

  • Google Docs: Multiple comments can be attached to the same text selection
  • GitHub PR Reviews: Multiple review comments can target the same line
  • Notion: Multiple comments can be added to the same block
  • JetBrains IDEs: Bookmarks and breakpoints can coexist on the same line

Additional Context

Possible UI approaches:

  1. Gutter Badge: Show "2" or "3" badge when multiple notes exist
  2. Stacked Icons: Display slightly offset icons in the gutter
  3. Expandable Panel: Click to expand a list of all notes for that line
  4. Hover Preview: Show all notes in a tooltip on hover
  5. Side Panel List: Display all notes for the current line in the sidebar

Data Structure Consideration:
The storage format would need to change from:

line -> note

to:

line -> [note1, note2, note3, ...]

Implementation Considerations

Technical approach:

  1. Storage Layer: Modify storageManager.ts to store an array of notes per line instead of a single note
  2. Decoration System: Update gutter decorations to show count or stacked indicators
  3. UI Components: Create a note list component for viewing/managing multiple notes
  4. Migration: Provide backward compatibility for existing single-note data
  5. Performance: Ensure efficient rendering when lines have many notes

Potential challenges:

  • Maintaining backward compatibility with existing notes
  • UI/UX design for managing multiple notes without cluttering the interface
  • Performance with large numbers of notes per line

Willing to Contribute?

Would you be willing to submit a pull request for this feature?

  • Yes, I'd like to implement this
  • I can help with testing
  • I'd like to help with documentation
  • No, just suggesting the idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions