You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+79-10Lines changed: 79 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,14 +70,27 @@ The lock file system enables Claude CLI to discover the Neovim integration:
70
70
}
71
71
```
72
72
73
-
### 3. MCP Tool Implementation
73
+
### 3. MCP Tool System
74
74
75
-
The plugin implements tools that Claude can invoke:
75
+
The plugin implements a dynamic tool system following the Model Context Protocol 2025-03-26 specification. Tools are registered with both handlers and JSON schemas:
76
76
77
-
- File operations (open, save, check status)
78
-
- Editor information (diagnostics, open editors)
79
-
- Selection management
80
-
- Diff viewing
77
+
**MCP-Exposed Tools:**
78
+
79
+
-`openFile` - Opens files with optional line/text selection
80
+
-`getCurrentSelection` - Gets current text selection
81
+
-`getOpenEditors` - Lists currently open files
82
+
-`openDiff` - Opens native Neovim diff views for file comparisons
83
+
84
+
**Internal Tools** (not exposed via MCP):
85
+
86
+
-`getDiagnostics`, `getWorkspaceFolders`, `saveDocument`, etc.
87
+
88
+
**Tool Architecture:**
89
+
90
+
- Centralized registration with `M.register(name, schema, handler)`
91
+
- Dynamic tool list generation via `M.get_tool_list()`
92
+
- Schema validation and JSON-RPC parameter handling
93
+
- Automatic MCP exposure based on schema presence
81
94
82
95
Each tool follows a request/response pattern:
83
96
@@ -95,7 +108,62 @@ Claude CLI Neovim Plugin
95
108
│ │
96
109
```
97
110
98
-
### 4. Selection Tracking
111
+
### 4. Diff Integration System
112
+
113
+
The plugin provides a configurable diff system that Claude can use to show file changes:
114
+
115
+
**Diff Providers:**
116
+
117
+
-`native` - Uses Neovim's built-in diff mode with `diffthis`
118
+
-`auto` - Automatically selects the best available provider
119
+
-`diffview` - (Future) Integration with diffview.nvim plugin
120
+
121
+
**Diff Configuration:**
122
+
123
+
```lua
124
+
diff_opts= {
125
+
auto_close_on_accept=true, -- Auto-close when accepting changes
126
+
show_diff_stats=true, -- Show diff statistics
127
+
vertical_split=true, -- Use vertical split for diff view
128
+
open_in_current_tab=true, -- Open in current tab (reduces clutter)
129
+
}
130
+
```
131
+
132
+
**Native Diff Features:**
133
+
134
+
- Current-tab mode (default) - opens diff in current tab to reduce clutter
135
+
- Helpful keymaps in current-tab mode:
136
+
-`<leader>dq` - Exit diff mode and cleanup
137
+
-`<leader>da` - Accept all changes
138
+
-`]c` / `[c` - Navigate between changes (standard Neovim)
0 commit comments