Feature: Line selection in file view to reference in prompts #7196

Closed
opened 2026-02-16 18:06:26 -05:00 by yindo · 2 comments
Owner

Originally created by @kyashrathore on GitHub (Jan 22, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Summary

Add the ability to select lines in the file view panel and reference them in prompts. When lines are selected, show an indicator in the prompt area displaying "selected lines X-Y from filename" which gets included as context when sending a message.

Motivation

When discussing code changes or asking questions about specific parts of a file, it's currently necessary to manually type file paths and line numbers or copy-paste code snippets. Line selection would allow users to:

  • Precisely reference code sections when requesting edits
  • Ask clarifying questions about specific lines
  • Provide targeted context without copying code into the prompt

Proposed UX

  1. Selection: Click and drag in the file view to select a line range (single file only, new selection replaces previous)

  2. Indicator: Show a dismissible indicator in the prompt area:

    [file icon] lines 13-14 from config.ts [x]
    
  3. Submit behavior: When sending a message with a selection, prepend context like:

    > selected lines 13-14 from config.ts
    
    [user's message]
    
  4. Clear selection:

    • Click the X on the indicator
    • Press Escape
    • Auto-clear after submitting a message

Current State

The infrastructure partially exists:

  • Code component already has enableLineSelection and selectedLines props
  • FileProvider tracks selectedLines per file
  • session.tsx passes onLineSelected callback to Code

The gap is surfacing the selection state in the prompt area.

Implementation Notes

Main files to modify:

  • New SelectionIndicator component
  • prompt-input.tsx - display indicator, include selection in submit
  • session.tsx - Escape key handler

See spec: specs/08-doc-editing-experience.md

Originally created by @kyashrathore on GitHub (Jan 22, 2026). Originally assigned to: @adamdotdevin on GitHub. ## Summary Add the ability to select lines in the file view panel and reference them in prompts. When lines are selected, show an indicator in the prompt area displaying "selected lines X-Y from filename" which gets included as context when sending a message. ## Motivation When discussing code changes or asking questions about specific parts of a file, it's currently necessary to manually type file paths and line numbers or copy-paste code snippets. Line selection would allow users to: - Precisely reference code sections when requesting edits - Ask clarifying questions about specific lines - Provide targeted context without copying code into the prompt ## Proposed UX 1. **Selection**: Click and drag in the file view to select a line range (single file only, new selection replaces previous) 2. **Indicator**: Show a dismissible indicator in the prompt area: ``` [file icon] lines 13-14 from config.ts [x] ``` 3. **Submit behavior**: When sending a message with a selection, prepend context like: ``` > selected lines 13-14 from config.ts [user's message] ``` 4. **Clear selection**: - Click the X on the indicator - Press Escape - Auto-clear after submitting a message ## Current State The infrastructure partially exists: - `Code` component already has `enableLineSelection` and `selectedLines` props - `FileProvider` tracks `selectedLines` per file - `session.tsx` passes `onLineSelected` callback to `Code` The gap is surfacing the selection state in the prompt area. ## Implementation Notes Main files to modify: - New `SelectionIndicator` component - `prompt-input.tsx` - display indicator, include selection in submit - `session.tsx` - Escape key handler See spec: `specs/08-doc-editing-experience.md`
yindo added the web label 2026-02-16 18:06:26 -05:00
yindo closed this issue 2026-02-16 18:06:26 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 22, 2026):

For keybind-related issues, please also check our pinned keybinds documentation: #4997

@github-actions[bot] commented on GitHub (Jan 22, 2026): For keybind-related issues, please also check our pinned keybinds documentation: #4997
Author
Owner

@kyashrathore commented on GitHub (Jan 23, 2026):

WIP in https://github.com/anomalyco/opencode/pull/7008 so closing.

@kyashrathore commented on GitHub (Jan 23, 2026): WIP in https://github.com/anomalyco/opencode/pull/7008 so closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7196