Skip to content

Commit 2c3baec

Browse files
committed
feat: Major UI improvements and enhanced streaming display
- Refactored UI module with better separation of concerns - Improved streaming message display with proper newline handling - Enhanced progress message formatting in bottom-right corner - Fixed issues with progress notifications and UI updates - Removed startup notifications to reduce noise - Better error handling and display formatting - Improved overall UX with cleaner visual feedback
1 parent 87dc91e commit 2c3baec

File tree

8 files changed

+344
-249
lines changed

8 files changed

+344
-249
lines changed

lua/claucode/bridge.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ local function parse_streaming_json(line)
8282
-- Only log non-standard tool use for debugging
8383
if content.name and not content.name:match("^(Edit|Write|Read|Bash)$") then
8484
vim.schedule(function()
85-
vim.notify("Tool use: " .. content.name, vim.log.levels.DEBUG)
85+
vim.notify("Tool use: " .. content.name, vim.log.levels.INFO)
8686
end)
8787
end
8888

@@ -135,6 +135,11 @@ function M.send_to_claude(prompt, opts)
135135
-- Build command arguments
136136
local args = {}
137137

138+
-- Check if -c flag is provided in opts
139+
if opts.continue_conversation then
140+
table.insert(args, "-c")
141+
end
142+
138143
-- Use -p flag for prompt mode (required for non-interactive streaming)
139144
table.insert(args, "-p")
140145

@@ -150,13 +155,13 @@ function M.send_to_claude(prompt, opts)
150155
-- Check if CLAUDE.md has diff instructions
151156
local claude_md = require("claucode.claude_md")
152157
if not claude_md.has_diff_instructions() then
153-
vim.notify("Adding diff instructions to CLAUDE.md...", vim.log.levels.DEBUG)
158+
vim.notify("Adding diff instructions to CLAUDE.md...", vim.log.levels.INFO)
154159
claude_md.add_diff_instructions()
155160
end
156161

157162
-- Note: We don't use --mcp-config anymore as it overrides user's MCP servers
158163
-- Instead, we use `claude mcp add` to add our server to their configuration
159-
vim.notify("Using Claucode MCP server for diff preview", vim.log.levels.DEBUG)
164+
vim.notify("Using Claucode MCP server for diff preview", vim.log.levels.INFO)
160165
end
161166

162167
-- Only use acceptEdits if MCP is not handling diffs

lua/claucode/claude_md.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function M.add_diff_instructions()
9292
file:write(new_content)
9393
file:close()
9494

95-
vim.notify("Added Neovim diff preview instructions to CLAUDE.md", vim.log.levels.DEBUG)
95+
vim.notify("Added Neovim diff preview instructions to CLAUDE.md", vim.log.levels.INFO)
9696
return true
9797
end
9898

@@ -130,7 +130,7 @@ function M.remove_diff_instructions()
130130
file:write(new_content)
131131
file:close()
132132

133-
vim.notify("Removed Neovim diff preview instructions from CLAUDE.md", vim.log.levels.DEBUG)
133+
vim.notify("Removed Neovim diff preview instructions from CLAUDE.md", vim.log.levels.INFO)
134134
return true
135135
end
136136

lua/claucode/commands.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,22 @@ function M.claude(args, from_visual)
4545

4646
-- Check if we should include current file context
4747
local include_file = false
48+
local continue_conversation = false
4849
local prompt = args
4950

51+
-- Parse -c flag for continuing conversation
52+
if args:match("^%-c%s+") then
53+
continue_conversation = true
54+
prompt = args:gsub("^%-c%s+", "")
55+
end
56+
5057
-- Parse --file flag
51-
if args:match("^%-%-file%s+") then
58+
if prompt:match("^%-%-file%s+") then
5259
include_file = true
53-
prompt = args:gsub("^%-%-file%s+", "")
54-
elseif args:match("^%-f%s+") then
60+
prompt = prompt:gsub("^%-%-file%s+", "")
61+
elseif prompt:match("^%-f%s+") then
5562
include_file = true
56-
prompt = args:gsub("^%-f%s+", "")
63+
prompt = prompt:gsub("^%-f%s+", "")
5764
end
5865

5966
-- If called from visual mode or we have a stored selection, include it
@@ -106,6 +113,7 @@ function M.claude(args, from_visual)
106113
-- Send to Claude
107114
local success = bridge.send_to_claude(prompt, {
108115
include_current_file = include_file,
116+
continue_conversation = continue_conversation,
109117
})
110118

111119
if not success then

lua/claucode/mcp.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,7 @@ end
353353

354354
-- Setup MCP integration
355355
function M.setup(config)
356-
-- Debug: Show plugin root
357356
local root = get_plugin_root()
358-
-- vim.notify("MCP setup - Plugin root: " .. root, vim.log.levels.DEBUG)
359357

360358
-- Check if MCP server is available
361359
local mcp_server = get_mcp_server_path()

lua/claucode/mcp_manager.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function M._continue_add_mcp_server(callback)
8080
-- Try to build it
8181
local mcp = require("claucode.mcp")
8282
if mcp.build_async then
83-
vim.notify("MCP server not found, attempting to build...", vim.log.levels.DEBUG)
83+
vim.notify("MCP server not found, attempting to build...", vim.log.levels.INFO)
8484
mcp.build_async(require("claucode").get_config(), function(success)
8585
if success and vim.fn.filereadable(mcp_server) == 1 then
8686
-- Continue with adding the server
@@ -97,7 +97,7 @@ function M._continue_add_mcp_server(callback)
9797
return
9898
end
9999
else
100-
vim.notify("Found MCP server at: " .. mcp_server, vim.log.levels.DEBUG)
100+
vim.notify("Found MCP server at: " .. mcp_server, vim.log.levels.INFO)
101101
end
102102

103103
-- Continue with adding the server

lua/claucode/terminal.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function M.open_claude_terminal(cli_args)
4040
-- Check if user provided their own permission mode or MCP config
4141
local has_permission_mode = cli_args and cli_args:match("%-%-permission%-mode")
4242
local has_mcp_config = cli_args and cli_args:match("%-%-mcp%-config")
43+
local has_continue_flag = cli_args and cli_args:match("%-c")
4344

4445
-- Check if CLAUDE.md has diff instructions
4546
if config.mcp and config.mcp.enabled and config.bridge and config.bridge.show_diff then

0 commit comments

Comments
 (0)