@@ -28,25 +28,21 @@ class ActionRegistrar {
2828 val flow = _messages .asSharedFlow()
2929
3030 fun reportMessageClick (command : EditorContextCommand , project : Project ) {
31- if (command == EditorContextCommand .GenerateUnitTests ) {
32- AsyncChatUiListener .notifyPartialMessageUpdate(project, Gson ().toJson(TestCommandMessage ()))
33- } else {
34- // new agentic chat route
35- ApplicationManager .getApplication().executeOnPooledThread {
36- runBlocking {
37- val contextExtractor = ActiveFileContextExtractor .create(fqnWebviewAdapter = null , project = project)
38- val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType .ContextMenu )
39- val codeSelection = " \n ```\n ${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()} \n ```\n "
40- var uiMessage: FlareUiMessage ? = null
41- if (command.verb != SEND_TO_PROMPT ) {
42- val params = GenericCommandParams (selection = codeSelection, triggerType = TriggerType .CONTEXT_MENU , genericCommand = command.name)
43- uiMessage = FlareUiMessage (command = GENERIC_COMMAND , params = params)
44- } else {
45- val params = SendToPromptParams (selection = codeSelection, triggerType = TriggerType .CONTEXT_MENU )
46- uiMessage = FlareUiMessage (command = SEND_TO_PROMPT , params = params)
47- }
48- AsyncChatUiListener .notifyPartialMessageUpdate(project, uiMessage)
31+ // new agentic chat route
32+ ApplicationManager .getApplication().executeOnPooledThread {
33+ runBlocking {
34+ val contextExtractor = ActiveFileContextExtractor .create(fqnWebviewAdapter = null , project = project)
35+ val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType .ContextMenu )
36+ val codeSelection = " \n ```\n ${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()} \n ```\n "
37+ var uiMessage: FlareUiMessage ? = null
38+ if (command.verb != SEND_TO_PROMPT ) {
39+ val params = GenericCommandParams (selection = codeSelection, triggerType = TriggerType .CONTEXT_MENU , genericCommand = command.name)
40+ uiMessage = FlareUiMessage (command = GENERIC_COMMAND , params = params)
41+ } else {
42+ val params = SendToPromptParams (selection = codeSelection, triggerType = TriggerType .CONTEXT_MENU )
43+ uiMessage = FlareUiMessage (command = SEND_TO_PROMPT , params = params)
4944 }
45+ AsyncChatUiListener .notifyPartialMessageUpdate(project, uiMessage)
5046 }
5147 }
5248 }
0 commit comments