3dyuval / 3dyuval/nvim

Enhancement: Improve code navigation with path copying and structural navigation

未关闭
#20 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Fennel
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

# Navigation Workflow Enhancement: Unified Breadcrumb System

## User Story

As a developer working with complex codebases, I need a **unified navigation system** that works seamlessly across file exploration and code structure navigation, so I can efficiently copy paths, jump between contexts, and maintain my workflow momentum.

## Current Navigation Workflow Gaps

### Context Switching Friction
Currently, our navigation involves multiple disconnected systems:
- **File navigation**: Snacks explorer with `` context menu (copy file paths)
- **Code navigation**: nvim-navic breadcrumbs (display only, no interaction)
- **Symbol discovery**: Separate pickers with different keybindings

This creates **cognitive overhead** when switching between file-level and symbol-level navigation tasks.

## Desired Unified Experience

### Single Keybinding Philosophy: ``
Extend the existing **Snacks explorer `` pattern** to work context-aware across all navigation scenarios:

**In Snacks Explorer** → Copy file paths (current behavior)
**In Editor Window** → Smart breadcrumb actions based on cursor context

### Enhanced Use Cases

#### Use Case 1: Symbol Path Copying
**Story**: Working on a complex object hierarchy and need to reference the current symbol path
- **Given**: Cursor on code symbol (e.g., `foo.bar.baz`)
- **When**: Press ``
- **Then**: Show path copy menu with multiple formats (dot notation, bracket notation, etc.)
- **Integration**: Reuse Snacks picker-extensions menu system

#### Use Case 2: File Breadcrumb Navigation
**Story**: Using VSCode-style breadcrumb to quickly jump to file context
- **Given**: Cursor not on parsable code object
- **When**: Press ``
- **Then**: Jump to file breadcrumb navigation in winbar
- **Integration**: Leverage existing navic winbar infrastructure

#### Use Case 3: Breadcrumb Context Menu
**Story**: Right-click style interaction with breadcrumb items
- **Given**: Cursor on breadcrumb item in winbar
- **When**: Press ``
- **Then**: Show context menu for that breadcrumb segment
- **Integration**: Extend picker-extensions context system

## Implementation Strategy

### Phase 1: Unified Keybinding System
- **Extend existing `` behavior** used in Snacks explorers
- **Smart context detection**: Picker vs. editor vs. breadcrumb contexts
- **Zero breaking changes**: Preserve all current Snacks functionality

### Phase 2: Enhanced Path Copying
- **Leverage tree-sitter breadcrumbs**: Use discovered `nvim_treesitter#statusline()`
- **Extend picker-extensions formats**: Add symbol-specific path formats
- **LSP fallback**: Use navic when tree-sitter unavailable

### Phase 3: Breadcrumb Interaction
- **Navic winbar integration**: Use existing breadcrumb display
- **Custom click detection**: Workaround missing winbar APIs
- **Context menu reuse**: Extend picker-extensions for breadcrumb items

## Connection to Navigation Issues

This enhancement directly supports the **sticky explorer workflow** by:
- **Reducing context switching** between file and symbol navigation
- **Unifying path copying** across different navigation contexts
- **Maintaining consistent UX** with existing Snacks explorer patterns

## Technical Integration Points

### Reuse Existing Systems
- **Snacks picker `` binding**: Extend with context detection
- **Picker-extensions menu**: 8 path formats already implemented
- **Navic winbar display**: Breadcrumb visualization infrastructure
- **Tree-sitter statusline**: Hidden breadcrumb functionality discovered

### Zero Breaking Changes
- **Backward compatibility**: All existing Snacks explorer behavior preserved
- **Additive enhancement**: New functionality only activates in editor contexts
- **Consistent UX**: Same `` mental model across all navigation

## Success Metrics

✅ **Unified Experience**: Single `` keybinding works across all navigation contexts
✅ **Path Copy Efficiency**: 4+ symbol path formats available instantly
✅ **Context Awareness**: Smart detection between file/symbol/breadcrumb scenarios
✅ **Performance**: <50ms response time using cached tree-sitter data
✅ **Compatibility**: Zero impact on existing Snacks explorer workflows

## Files Affected

- `lua/plugins/navic.lua` - Extend with tree-sitter fallback
- `lua/utils/picker-extensions.lua` - Add symbol path formats
- `lua/config/keymaps.lua` - Unified `` context detection
- New: `lua/utils/breadcrumb-navigation.lua` - Context detection logic

## Priority: High
Critical for unified navigation workflow and developer productivity.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。