Skip to content

Conversation

@jnahian
Copy link
Owner

@jnahian jnahian commented Oct 19, 2025

  • Implement complete note thread disposal in closeAllCommentEditors()
  • Fully hide all comment threads when opening a new editor
  • Add Ctrl+Enter (Cmd+Enter) keyboard shortcut for saving notes
  • Update comment thread management to ensure clean, focused editing experience
  • Improve UX by removing visual clutter from collapsed notes
    Closes #ISSUE_NUMBER (if applicable)

Summary by CodeRabbit

  • New Features

    • Added keyboard shortcut (Ctrl+Enter / Cmd+Enter) to save notes directly in the comment editor
    • Auto-collapse behavior ensures only one note editor is active at a time
  • Bug Fixes

    • Improved document resolution during note save operations
    • History now displays inline within comment threads
    • Enhanced comment labels and editor prompts for clarity

- Replace single-line input box with modern comment editor
- Improve user experience for adding notes via keyboard shortcut
- Ensure consistent behavior between CodeLens and keyboard shortcut note creation
- Open comment editor with proper markdown support and formatting options
- Remove manual content input in favor of comment editor workflow
- Update command handler in `src/extension.ts` to use `openCommentEditor()`
Resolves keyboard shortcut note creation UX inconsistency, providing a more robust and user-friendly method for adding contextual notes to code selections.
- Update `addNote` command to use comment editor UI instead of input box
- Refactor `viewHistory` command to show history in comment thread
- Ensure consistent user experience across all note interaction methods
- Add support for markdown formatting in comment editor
- Improve error handling for commands when no workspace is open
Keyboard shortcuts now provide a more modern and integrated experience:
- Ctrl+Alt+N opens comment editor for adding notes
- Ctrl+Alt+H shows note history inline in comment thread
- Preserves context and provides better markdown editing capabilities
- Aligns with CodeLens and button interaction patterns
Fixes inconsistent UI behavior introduced in previous versions of the extension.
…icon

- Updated `handleSaveNewNote` method to support threads created by VSCode's + icon
- Added fallback mechanism to find document by URI when custom properties are missing
- Implemented robust document retrieval strategy:
1. Check custom `sourceDocument` property first
2. Find document by matching thread URI in workspace documents
3. Attempt to open document via `vscode.workspace.openTextDocument()`
- Added error handling for scenarios where document cannot be found
- Ensures comment saving works consistently across different thread creation methods
- Provides clear error messages when document retrieval fails
Resolves issue with comment editor not saving notes when using VSCode's native + icon in editor gutter
…agement

- Add comprehensive documentation for comment editor architecture and lifecycle
- Implement auto-collapse of other notes when working on a single note
- Fix keyboard shortcuts to use modern comment UI with markdown support
- Resolve issue with + icon comment editor saving notes
- Update nyc test coverage configuration after esbuild migration
- Improve comment thread state tracking and management
- Add new helper method `closeAllCommentEditors()` in CommentController
- Enhance user experience with more informative labels and clearer actions
- Ensure better handling of temporary, editing, and viewing thread states
Addresses complex comment editor interaction challenges and provides a more focused, user-friendly note-taking experience in the extension.
- Implement complete note thread disposal in `closeAllCommentEditors()`
- Fully hide all comment threads when opening a new editor
- Add Ctrl+Enter (Cmd+Enter) keyboard shortcut for saving notes
- Update comment thread management to ensure clean, focused editing experience
- Improve UX by removing visual clutter from collapsed notes
Closes #ISSUE_NUMBER (if applicable)
@vercel
Copy link

vercel bot commented Oct 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
code-context-notes Ready Ready Preview Comment Oct 19, 2025 9:30am

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Release v0.1.5 introduces auto-collapse behavior for notes with single-editor focus enforcement, adds keyboard shortcut (Ctrl+Enter) for saving, improves document resolution in save workflows, updates UI labels and history rendering, and includes extensive documentation for the comment editor system.

Changes

Cohort / File(s) Summary
Configuration & Metadata
.gitignore, .vscodeignore, package.json
Updated .gitignore to ignore .claude and .vscode directories; consolidated .vscodeignore doc exclusions into single docs/ pattern and added .github; bumped version to 0.1.5 and added Ctrl+Enter/Cmd+Enter keyboard shortcut for save command.
Release & Feature Documentation
CHANGELOG.md, docs/TODO.md
Added v0.1.5 release notes documenting auto-collapse, focus improvements, lifecycle disposal, keyboard shortcut enhancements, and test coverage updates; extended TODO.md with new feature/fix documentation sections.
Comment Editor System Documentation
docs/COMMENT_EDITOR_ANALYSIS.md, docs/COMMENT_EDITOR_CODE_REFERENCE.md, docs/COMMENT_EDITOR_INDEX.md, docs/COMMENT_EDITOR_SUMMARY.md
Added four comprehensive documentation files covering comment editor lifecycle, internal workflow, code references with file/line details, tracking structures, state transitions, debugging tips, and architectural design rationale.
Core Functionality
src/commentController.ts
Introduced closeAllCommentEditors() helper to enforce single-editor focus; updated openCommentEditor() to close prior editors; enhanced handleSaveNewNote() with robust document resolution and fallback opening logic; improved UI labels and timestamps; updated history rendering with formatted labels; refactored editor focus/navigation flows to maintain single-thread state.
Command Integration
src/extension.ts
Transitioned note creation from direct prompt-based input to comment editor UI via openCommentEditor(); changed history display from markdown document generation to inline thread rendering via showHistoryInThread(); simplified command registration logic.

Sequence Diagram

sequenceDiagram
    actor User
    participant UI as Comment Editor UI
    participant Controller as commentController
    participant Storage as NoteManager
    participant VSCode as VSCode API

    rect rgb(220, 240, 255)
    Note over Controller: New Save-focused Flow (v0.1.5)
    end

    User->>UI: Opens editor (Keyboard/CodeLens/+ icon)
    UI->>Controller: openCommentEditor()
    Controller->>Controller: closeAllCommentEditors()
    Controller->>VSCode: Create temp thread (tempId, sourceDocument)
    VSCode->>UI: Display input thread

    User->>UI: Types note, presses Ctrl+Enter
    UI->>Controller: handleSaveNewNote()
    
    rect rgb(240, 255, 240)
    Note over Controller: Enhanced Document Resolution
    end
    
    Controller->>Controller: Resolve target document<br/>(from sourceDocument or search)
    alt Document not found
        Controller->>VSCode: Open document
    end
    
    Controller->>Storage: Save note via NoteManager
    Storage-->>Controller: Note with UUID
    
    rect rgb(255, 240, 240)
    Note over Controller: Lifecycle Transition
    end
    
    Controller->>VSCode: Dispose temp thread
    Controller->>VSCode: Create permanent thread (note UUID)
    Controller->>Controller: closeAllCommentEditors()
    VSCode->>UI: Display saved note in collapsed state
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Mixed complexity: multiple documentation files follow repetitive structure (lower effort), but functional changes in commentController.ts and extension.ts involve state coordination logic, document resolution handling, and UI lifecycle management that require careful verification. Key focus areas: single-editor enforcement, save document resolution fallback chain, and transition from prompt-based to editor-based input paradigm.

Poem

🐰 With editors now collapsing with grace,
One note holds the focused space,
Ctrl+Enter saves with a hop,
No more prompts, just open-on-top!
History threads dance inline so neat,
Our comment system now complete!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/keybindings-not-opening-the-comment-editor

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f63c5aa and a9c124a.

📒 Files selected for processing (11)
  • .gitignore (1 hunks)
  • .vscodeignore (1 hunks)
  • CHANGELOG.md (1 hunks)
  • docs/COMMENT_EDITOR_ANALYSIS.md (1 hunks)
  • docs/COMMENT_EDITOR_CODE_REFERENCE.md (1 hunks)
  • docs/COMMENT_EDITOR_INDEX.md (1 hunks)
  • docs/COMMENT_EDITOR_SUMMARY.md (1 hunks)
  • docs/TODO.md (1 hunks)
  • package.json (2 hunks)
  • src/commentController.ts (9 hunks)
  • src/extension.ts (4 hunks)

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.

@jnahian jnahian self-assigned this Oct 19, 2025
@jnahian jnahian merged commit 377a7fa into main Oct 19, 2025
2 checks passed
@jnahian jnahian deleted the fix/keybindings-not-opening-the-comment-editor branch October 19, 2025 09:31
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.

2 participants