44 *--------------------------------------------------------------------------------------------*/
55
66import { renderMarkdown } from 'vs/base/browser/markdownRenderer' ;
7+ import * as aria from 'vs/base/browser/ui/aria/aria' ;
78import { Barrier , raceCancellationError } from 'vs/base/common/async' ;
89import { CancellationTokenSource } from 'vs/base/common/cancellation' ;
910import { toErrorMessage } from 'vs/base/common/errorMessage' ;
@@ -32,7 +33,7 @@ import { EditResponse, EmptyResponse, ErrorResponse, ExpansionState, IInlineChat
3233import { EditModeStrategy , LivePreviewStrategy , LiveStrategy , PreviewStrategy } from 'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies' ;
3334import { InlineChatZoneWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget' ;
3435import { CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST , CTX_INLINE_CHAT_LAST_FEEDBACK , IInlineChatRequest , IInlineChatResponse , INLINE_CHAT_ID , EditMode , InlineChatResponseFeedbackKind , CTX_INLINE_CHAT_LAST_RESPONSE_TYPE , InlineChatResponseType , CTX_INLINE_CHAT_DID_EDIT , CTX_INLINE_CHAT_HAS_STASHED_SESSION , InlineChateResponseTypes , CTX_INLINE_CHAT_RESPONSE_TYPES } from 'vs/workbench/contrib/inlineChat/common/inlineChat' ;
35- import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat' ;
36+ import { IChatAccessibilityService , IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat' ;
3637import { IChatService } from 'vs/workbench/contrib/chat/common/chatService' ;
3738import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService' ;
3839import { CellUri } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
@@ -115,6 +116,7 @@ export class InlineChatController implements IEditorContribution {
115116 @IContextKeyService contextKeyService : IContextKeyService ,
116117 @IAccessibilityService private readonly _accessibilityService : IAccessibilityService ,
117118 @IKeybindingService private readonly _keybindingService : IKeybindingService ,
119+ @IChatAccessibilityService private readonly _chatAccessibilityService : IChatAccessibilityService
118120 ) {
119121 this . _ctxHasActiveRequest = CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST . bindTo ( contextKeyService ) ;
120122 this . _ctxDidEdit = CTX_INLINE_CHAT_DID_EDIT . bindTo ( contextKeyService ) ;
@@ -412,6 +414,7 @@ export class InlineChatController implements IEditorContribution {
412414 if ( options . message ) {
413415 this . _zone . value . widget . value = options . message ;
414416 this . _zone . value . widget . selectAll ( ) ;
417+ aria . alert ( options . message ) ;
415418 delete options . message ;
416419 }
417420
@@ -506,6 +509,7 @@ export class InlineChatController implements IEditorContribution {
506509 selection : this . _editor . getSelection ( ) ,
507510 wholeRange : this . _activeSession . wholeRange . value ,
508511 } ;
512+ this . _chatAccessibilityService . acceptRequest ( ) ;
509513 const task = this . _activeSession . provider . provideResponse ( this . _activeSession . session , request , requestCts . token ) ;
510514 this . _log ( 'request started' , this . _activeSession . provider . debugName , this . _activeSession . session , request ) ;
511515
@@ -596,6 +600,8 @@ export class InlineChatController implements IEditorContribution {
596600 const { response } = this . _activeSession . lastExchange ! ;
597601 this . _showWidget ( false ) ;
598602
603+ let status : string | undefined ;
604+
599605 this . _ctxLastResponseType . set ( response instanceof EditResponse || response instanceof MarkdownResponse
600606 ? response . raw . type
601607 : undefined ) ;
@@ -618,13 +624,15 @@ export class InlineChatController implements IEditorContribution {
618624
619625 if ( response instanceof EmptyResponse ) {
620626 // show status message
621- this . _zone . value . widget . updateStatus ( localize ( 'empty' , "No results, please refine your input and try again" ) , { classes : [ 'warn' ] } ) ;
627+ status = localize ( 'empty' , "No results, please refine your input and try again" ) ;
628+ this . _zone . value . widget . updateStatus ( status , { classes : [ 'warn' ] } ) ;
622629 return State . WAIT_FOR_INPUT ;
623630
624631 } else if ( response instanceof ErrorResponse ) {
625632 // show error
626633 if ( ! response . isCancellation ) {
627- this . _zone . value . widget . updateStatus ( response . message , { classes : [ 'error' ] } ) ;
634+ status = response . message ;
635+ this . _zone . value . widget . updateStatus ( status , { classes : [ 'error' ] } ) ;
628636 }
629637
630638 } else if ( response instanceof MarkdownResponse ) {
@@ -633,6 +641,10 @@ export class InlineChatController implements IEditorContribution {
633641 this . _zone . value . widget . updateStatus ( '' ) ;
634642 this . _zone . value . widget . updateMarkdownMessage ( renderedMarkdown . element ) ;
635643 this . _zone . value . widget . updateToolbar ( true ) ;
644+ const content = renderedMarkdown . element . textContent ;
645+ if ( content ) {
646+ status = localize ( 'markdownResponseMessage' , "{0}" , content ) ;
647+ }
636648 this . _activeSession . lastExpansionState = this . _zone . value . widget . expansionState ;
637649
638650 } else if ( response instanceof EditResponse ) {
@@ -644,9 +656,10 @@ export class InlineChatController implements IEditorContribution {
644656 if ( ! canContinue ) {
645657 return State . ACCEPT ;
646658 }
647-
659+ status = localize ( 'editResponseMessage' , "Navigate to the diff editor to review proposed changes." ) ;
648660 await this . _strategy . renderChanges ( response ) ;
649661 }
662+ this . _chatAccessibilityService . acceptResponse ( status ) ;
650663
651664 return State . WAIT_FOR_INPUT ;
652665 }
0 commit comments