Skip to content

Conversation

@Emt-lin
Copy link
Collaborator

@Emt-lin Emt-lin commented Feb 1, 2026

Summary

Introduces a new Quick Ask floating panel for editor selections and adds persistent selection highlighting
so selections remain visible when focus moves to Copilot UI. Also refactors highlight logic into a reusable
CodeMirror 6 factory to avoid state conflicts.

Features

Quick Ask Panel (Ask Mode Only)

  • New command Quick Ask and context menu entry
  • Opens a floating, draggable panel near the current selection
  • Multi-turn streaming conversation about selected text
  • Actions per assistant message:
    • Copy - Copy response to clipboard
    • Insert - Insert at cursor position
    • Replace - Replace original selection with response

Replace Guard

  • Tracks original selection through document edits via mapPos
  • Blocks replace operation with clear reason when:
    • Editor/file/leaf has changed
    • Selection content no longer matches original snapshot
  • Provides user-friendly feedback on replace availability

Persistent Selection Highlight

  • Generic createPersistentHighlight CM6 factory for independent highlight systems
  • Quick Ask: Highlights selected range while panel is open
  • Chat Panel: Independent highlight controller that:
    • Persists highlight when entering Chat
    • Clears on leaving Chat / clearing contexts / starting new chat

Actual Effect

CleanShot 2026-02-01 at 23 04 09

Add a new floating quick command feature that allows users to interact
with AI directly from the editor. Key features include:

- Quick Ask panel with draggable modal interface
- Multiple interaction modes: ask, edit, and edit-direct
- Selection highlight and replace guard for safe text operations
- Streaming chat session support for real-time AI responses
- Context menu integration for quick access
- Resizable and draggable UI components

# Conflicts:
#	src/commands/CustomCommandChatModal.tsx
#	src/styles/tailwind.css
- Use selection.head instead of selection.to for anchor point
- Fix line-start trap: only apply when head is selection end
- Add flip logic: show above when not enough space below
- Add horizontal visibility check
- Single-line selection: center popup horizontally
- Multi-line selection: follow head position
- Cursor mode: align near cursor instead of centering
@Emt-lin
Copy link
Collaborator Author

Emt-lin commented Feb 1, 2026

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Emt-lin Emt-lin requested a review from logancyang February 1, 2026 17:07
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