@@ -109,12 +109,35 @@ function M.select_history()
109109end
110110
111111function M .quick_chat (message , range )
112- local options = {}
112+ if not range then
113+ if vim .fn .mode ():match (' [vV\022 ]' ) then
114+ local visual_range = util .get_visual_range ()
115+ if visual_range then
116+ range = {
117+ start_line = visual_range .start_line ,
118+ end_line = visual_range .end_line ,
119+ }
120+ end
121+ end
122+ end
123+
113124 if type (message ) == ' table' then
114125 message = table.concat (message , ' ' )
115126 end
116127
117- return quick_chat .quick_chat (message , options , range )
128+ -- If no message, prompt for input (range is captured above)
129+ if not message or # message == 0 then
130+ vim .ui .input ({ prompt = ' Quick Chat Message: ' }, function (input )
131+ local prompt , ctx = util .parse_quick_context_args (input )
132+ if input and input ~= ' ' then
133+ quick_chat .quick_chat (prompt , { context_config = ctx }, range )
134+ end
135+ end )
136+ return
137+ end
138+
139+ local prompt , ctx = util .parse_quick_context_args (message )
140+ quick_chat .quick_chat (prompt , { context_config = ctx }, range )
118141end
119142
120143function M .toggle_pane ()
@@ -977,7 +1000,7 @@ M.commands = {
9771000 },
9781001
9791002 quick_chat = {
980- desc = ' Quick chat with current context ' ,
1003+ desc = ' Quick chat with current buffer or visual selection ' ,
9811004 fn = M .quick_chat ,
9821005 range = true , -- Enable range support for visual selections
9831006 nargs = ' +' , -- Allow multiple arguments
0 commit comments