@@ -47,15 +47,22 @@ sg.config *sg.config*
4747
4848
4949 Configuration Options: ~
50- {enable_cody} (boolean?) Enable/disable cody integration
51- {accept_tos} (boolean?) Accept the TOS without being prompted
52- {download_binaries} (boolean?) Default true, download latest release
53- from Github
54- {node_executable} (string?) path to node executable
55- {skip_node_check} (boolean?) Useful if using other js runtime
56- {cody_agent} (string?) path to the cody-agent js bundle
57- {on_attach} (function?) function to run when attaching to
58- sg://<file> buffers
50+ {enable_cody} (boolean?) Enable/disable cody
51+ integration
52+ {accept_tos} (boolean?) Accept the TOS without being
53+ prompted
54+ {download_binaries} (boolean?) Default true, download latest
55+ release from Github
56+ {node_executable} (string?) path to node executable
57+ {skip_node_check} (boolean?) Useful if using other js
58+ runtime
59+ {cody_agent} (string?) path to the cody-agent js
60+ bundle
61+ {on_attach} (function?) function to run when
62+ attaching to sg://<file>
63+ buffers
64+ {src_headers} (table<string, string>) Headers to be sent with each
65+ sg request
5966
6067
6168
@@ -121,6 +128,12 @@ Default commands for interacting with Cody
121128:CodyAsk ~
122129 Ask a question about the current selection.
123130
131+ Use from visual mode to pass the current selection
132+
133+ *:CodyExplain*
134+ :CodyExplain ~
135+ Ask a question about the current selection.
136+
124137 Use from visual mode to pass the current selection
125138
126139 *:CodyChat{!}*
@@ -129,6 +142,8 @@ Default commands for interacting with Cody
129142
130143 If {!} is passed, will reset the chat and start a new chat conversation.
131144
145+ For more configuation options, see: `:help sg.cody.commands.chat`
146+
132147 *:CodyToggle*
133148:CodyToggle ~
134149 Toggles the current Cody Chat window.
@@ -137,25 +152,6 @@ Default commands for interacting with Cody
137152:CodyTask {task_description} ~
138153 Instruct Cody to perform a task on selected text.
139154
140- *:CodyTaskView*
141- :CodyTaskView ~
142- Opens the last active CodyTask.
143-
144- *:CodyTaskAccept*
145- :CodyTaskAccept ~
146- Accepts the current CodyTask, removing it from the pending tasks list and
147- applying it to the selection the task was performed on. Can also be
148- triggered by pressing <CR> while a task is open.
149-
150- *:CodyTaskPrev*
151- :CodyTaskPrev ~
152- Cycles to the previous CodyTask. Navigates to the appropriate buffer
153- location.
154-
155- *:CodyTaskNext*
156- :CodyTaskNext ~
157- Cycles to the next CodyTask. Navigates to the appropriate buffer location.
158-
159155 *:CodyRestart*
160156:CodyRestart ~
161157 Restarts Cody and Sourcegraph, clearing all state.
@@ -176,15 +172,7 @@ M.setup({config}) *cody.setup()*
176172================================================================================
177173LUA-COMMANDS *cody.lua-commands*
178174
179- commands.ask({message} ) *sg.cody.commands.ask()*
180- Ask Cody a question, without any selection
181-
182-
183- Parameters: ~
184- {message} (string[])
185-
186-
187- commands.ask_range({bufnr} , {start_row}, {end_row}, {message} ) *sg.cody.commands.ask_range()*
175+ commands.ask_range({bufnr} , {start_row}, {end_row}, {message} , {opts} ) *sg.cody.commands.ask_range()*
188176 Ask Cody about the selected code
189177
190178
@@ -193,6 +181,7 @@ commands.ask_range({bufnr}, {start_row}, {end_row}, {message}) *sg.cody.commands
193181 {start_row} (number)
194182 {end_row} (number)
195183 {message} (string)
184+ {opts} (cody.ChatOpts)
196185
197186
198187commands.autocomplete({request} , {callback} ) *sg.cody.commands.autocomplete()*
@@ -204,27 +193,45 @@ commands.autocomplete({request}, {callback}) *sg.cody.commands.autocomplete()*
204193 {callback} (function(err: table, data: CodyAutocompleteResult))
205194
206195
207- commands.float( {bufnr } , {start_line}, {end_line}, {message} ) *sg.cody.commands.float ()*
208- Ask Cody about the selected code
196+ commands.chat( {new } , {opts} ) *sg.cody.commands.chat ()*
197+ Open a cody chat
209198
199+ To configure keymaps, you can do something like:
210200
211- Parameters: ~
212- {bufnr} (number)
213- {start_line} (number)
214- {end_line} (number)
215- {message} (string)
201+ This will disable <c-c> in insert mode from getting mapped by Cody.
216202
203+ >lua
204+ require("sg.cody.commands").chat(true, {
205+ keymaps = {
206+ i = {
207+ ["<c-c> "] = false,
208+ },
209+ },
210+ })
211+ <
212+
213+ Additionally, you can map more functionality like so:
214+
215+ >lua
216+ require("sg.cody.commands").chat(true, {
217+ keymaps = {
218+ i = {
219+ ["hello"] = { "Says Hello", function(chat) print("hello") end },
220+ },
221+ },
222+ })
223+ <
217224
218- commands.chat({name} , {opts} ) *sg.cody.commands.chat()*
219- Start a new CodyChat
220225
221226
222227 Parameters: ~
223- {name} (string?)
224- {opts} ({ reset: boolean }?)
228+ {new} (boolean)
229+ {opts} (cody.ChatOpts)
230+
231+
232+ commands.toggle() *sg.cody.commands.toggle()*
233+ Toggle a Cody chat
225234
226- Return: ~
227- CodyLayoutSplit
228235
229236
230237commands.do_task({bufnr} , {start_line}, {end_line}, {message} ) *sg.cody.commands.do_task()*
@@ -243,16 +250,6 @@ commands.history() *sg.cody.commands.history()*
243250
244251
245252
246- commands.add_context({start_line}, {end_line}, {state} ) *sg.cody.commands.add_context()*
247- Add context to an existing state
248-
249-
250- Parameters: ~
251- {start_line} (any)
252- {end_line} (any)
253- {state} (CodyState?)
254-
255-
256253commands.focus_history() *sg.cody.commands.focus_history()*
257254 Focus the currently active history window.
258255
@@ -319,38 +316,16 @@ Default commands for interacting with Sourcegraph
319316 Run a search. For more sourcegraph search syntax, refer to online
320317 documentation
321318
319+ *:CodyIgnoreNotification*
320+ :CodyIgnoreNotification ~
321+ Ingore particular notifications
322+
322323
323324
324325
325326================================================================================
326327RPC *sg.rpc*
327328
328- rpc.complete({snippet} , {opts} ) *sg.rpc.complete()*
329- Complete a single string snippet
330-
331-
332-
333- Parameters: ~
334- {snippet} (string) Code to send as the prompt
335- {opts} ({ prefix: string? })
336-
337- Return: ~
338- string?: The error
339- string?: The completion
340-
341-
342- rpc.repository({name} ) *sg.rpc.repository()*
343- Get the repository ID for a repo with a name
344-
345-
346- Parameters: ~
347- {name} (string)
348-
349- Return: ~
350- string?: The error, if any
351- string?: The repository ID, if found
352-
353-
354329rpc.get_entry({path} , {callback} ) *sg.rpc.get_entry()*
355330 Get an SgEntry based on a path
356331
0 commit comments