@@ -39,8 +39,8 @@ M.setup = function(options)
3939end
4040
4141--- Toggles opening and closing neoai window
42- --- @param toggle boolean | nil If true will open GUI and false will close , nil will toggle
43- --- @param prompt string | nil If set then this prompt will be sent to the GUI if toggling on
42+ --- @param toggle boolean | nil If true will open GUI and false will close , nil will toggle.
43+ --- @param prompt string | nil If set then this prompt will be sent to the GUI if toggling on.
4444--- @return boolean true if opened and false if closed
4545M .toggle = function (toggle , prompt )
4646 local open = (toggle ~= " " and toggle ) or (toggle == " " and not ui .is_open ())
6060
6161--- Smart focus, if closed then will open on GUI, if opened and focused then it
6262--- will close GUI and if opened and not focused then it will focus on the GUI.
63- --- @param prompt string The prompt to inject , to inject no prompt just do empty string
63+ --- @param prompt string The prompt to inject , to inject no prompt just do empty string.
6464M .smart_toggle = function (prompt )
6565 local send_args = function ()
6666 if not utils .is_empty (prompt ) then
@@ -81,30 +81,30 @@ M.smart_toggle = function(prompt)
8181end
8282
8383--- Toggles the GUI in Context mode
84- --- @param toggle boolean | nil True will force open , False will force close , nil will toggle
85- --- @param prompt string The prompt to inject into the GUI if any (otherwise specify an empty string )
86- --- @param line1 integer | nil The first line number for context range otherwise will use visual selection
87- --- @param line2 integer | nil The second line number for context range otherwise will use visual selection
84+ --- @param toggle boolean | nil True will force open , False will force close , nil will toggle.
85+ --- @param prompt string The prompt to inject into the GUI if any (otherwise specify an empty string ).
86+ --- @param line1 integer | nil The first line number for context range otherwise will use visual selection.
87+ --- @param line2 integer | nil The second line number for context range otherwise will use visual selection.
8888--- @return boolean True if was opened
8989M .context_toggle = function (toggle , prompt , line1 , line2 )
9090 set_context (line1 , line2 )
9191 return M .toggle (toggle , prompt )
9292end
9393
9494--- Smart toggles context GUI
95- --- @param prompt string The prompt to inject into the GUI if any (otherwise specify an empty string )
96- --- @param line1 integer | nil The first line number for context range otherwise will use visual selection
97- --- @param line2 integer | nil The second line number for context range otherwise will use visual selection
95+ --- @param prompt string The prompt to inject into the GUI if any (otherwise specify an empty string ).
96+ --- @param line1 integer | nil The first line number for context range otherwise will use visual selection.
97+ --- @param line2 integer | nil The second line number for context range otherwise will use visual selection.
9898M .context_smart_toggle = function (prompt , line1 , line2 )
9999 set_context (line1 , line2 )
100100 M .smart_toggle (prompt )
101101end
102102
103103--- Sends prompt and injects the response straight back into the buffer without
104- --- opening the GUI
105- --- @param prompt string The prompt to send to the AI
106- --- @param strip_function (fun ( output : string ): string ) | nil A function that strips the output
107- --- @param start_line integer | nil The line to start injecting onto (After inserting 2 newlines ), nil = current selected line
104+ --- opening the GUI.
105+ --- @param prompt string The prompt to send to the AI.
106+ --- @param strip_function (fun ( output : string ): string ) | nil A function that strips the output.
107+ --- @param start_line integer | nil The line to start injecting onto (After inserting 2 newlines ), nil = current selected line.
108108M .inject = function (prompt , strip_function , start_line )
109109 chat .new_chat_history ()
110110
@@ -131,10 +131,10 @@ M.inject = function(prompt, strip_function, start_line)
131131end
132132
133133--- Same as inject except uses a context
134- --- @param prompt string The prompt to send to the AI
135- --- @param strip_function (fun ( output : string ): string ) | nil A function that strips the output
136- --- @param line1 integer | nil The first line num in the range if nil will use ' <
137- --- @param line2 integer | nil The second line num in the range if nil will use ' >
134+ --- @param prompt string The prompt to send to the AI.
135+ --- @param strip_function (fun ( output : string ): string ) | nil A function that strips the output.
136+ --- @param line1 integer | nil The first line num in the range if nil will use ' <.
137+ --- @param line2 integer | nil The second line num in the range if nil will use ' >.
138138M .context_inject = function (prompt , strip_function , line1 , line2 )
139139 line1 , line2 = set_context (line1 , line2 )
140140 M .inject (prompt , strip_function , line2 )
0 commit comments