@@ -199,33 +199,35 @@ def run(self, view_id: int | None = None) -> None:
199199
200200
201201class CopilotConversationChatShimCommand (LspWindowCommand ):
202- def run (self , window_id : int , follow_up : str = "" ) -> None :
202+ def run (self , window_id : int , message : str = "" ) -> None :
203203 if not (window := find_window_by_id (window_id )):
204204 return
205205
206206 conversation_manager = WindowConversationManager (window )
207207 if not (view := find_view_by_id (conversation_manager .last_active_view_id )):
208208 return
209209
210- view .run_command ("copilot_conversation_chat" , {"follow_up " : follow_up })
210+ view .run_command ("copilot_conversation_chat" , {"message " : message })
211211
212212
213213class CopilotConversationChatCommand (LspTextCommand ):
214214 @_provide_plugin_session ()
215- def run (self , plugin : CopilotPlugin , session : Session , _ : sublime .Edit , follow_up : str = "" ) -> None :
215+ def run (self , plugin : CopilotPlugin , session : Session , _ : sublime .Edit , message : str = "" ) -> None :
216216 if not (window := self .view .window ()):
217217 return
218+
218219 manager = WindowConversationManager (window )
219220 if manager .conversation_id :
220221 manager .open ()
221- manager .prompt (callback = lambda x : self ._on_prompt (plugin , session , x ), initial_text = follow_up )
222+ manager .prompt (callback = lambda msg : self ._on_prompt (plugin , session , msg ), initial_text = message )
222223 return
224+
223225 session .send_request (
224226 Request (
225227 REQ_CONVERSATION_PRECONDITIONS ,
226228 {},
227229 ),
228- lambda x : self ._on_result_conversation_preconditions (plugin , session , x ),
230+ lambda msg : self ._on_result_conversation_preconditions (plugin , session , msg ),
229231 )
230232
231233 def _on_result_conversation_preconditions (self , plugin : CopilotPlugin , session : Session , payload ) -> None :
@@ -248,7 +250,7 @@ def _on_result_conversation_preconditions(self, plugin: CopilotPlugin, session:
248250 # "workspaceFolder": Ji.Type.Optional(Ji.Type.String()),
249251 },
250252 ),
251- lambda x : self ._on_result_conversation_create (plugin , session , x ),
253+ lambda msg : self ._on_result_conversation_create (plugin , session , msg ),
252254 )
253255
254256 def _on_result_conversation_create (self , plugin : CopilotPlugin , session : Session , payload ) -> None :
@@ -272,6 +274,14 @@ def _on_prompt(self, plugin: CopilotPlugin, session: Session, msg: str):
272274 manager .prompt (callback = lambda x : self ._on_prompt (plugin , session , x ), initial_text = msg )
273275 return
274276
277+ if msg in (
278+ "/fix" ,
279+ "/tests" ,
280+ "/doc" ,
281+ "/explain" ,
282+ "/simplify" ,
283+ ):
284+ msg = msg + "\n \n {{ sel[0] }}"
275285 template = load_string_template (msg )
276286 sel = []
277287 if not (view := find_view_by_id (manager .last_active_view_id )):
@@ -505,7 +515,7 @@ def _on_result_coversation_agents(self, payload: list[CopilotRequestCoversationA
505515 window = self .view .window ()
506516 if not window :
507517 return
508- window .show_quick_panel ([( item ["id " ], item ["description" ]) for item in payload ], lambda _ : None )
518+ window .show_quick_panel ([[ item ["slug " ], item ["description" ]] for item in payload ], lambda _ : None )
509519
510520
511521class CopilotConversationTemplatesCommand (LspTextCommand ):
0 commit comments