mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
* adding code in order to provide accessibility help for the hover * adding the description of the possible commands that can be used * reusing the method * joining the content and changing the text in the help view * polishing the code * removing the question mark * changing the import * removing the setting ID from imports * adding code in order to update when the hover updates * adding methods to service * adding code in order to dispose the accessible hover view * fixing bug * polishing the code * checking that action not supported for the early return * using disposable store instead * using the appropriate string * polishing the code * using instead the type help and the resolved keybindings * hiding also on the `onDidBlurEditorWidget` firing * Revert "using instead the type help and the resolved keybindings" This reverts commit1f450dd535. * use hover accessible view, provide custom help * Revert "Revert "using instead the type help and the resolved keybindings"" This reverts commit12f0cf6143. * add HoverAccessibilityHelp, BaseHoverAccessibleViewProvider * polishing the code * polishing the code * provide content at a specific index from the hover accessibility help provider * introducing method _initializeOptions * using readonly where possible * using public everywhere * using a getter for the actions --------- Co-authored-by: meganrogge <megan.rogge@microsoft.com>
47 lines
2.1 KiB
TypeScript
47 lines
2.1 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
|
|
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
|
import { AccessibleViewProviderId, AccessibleViewType } from 'vs/platform/accessibility/browser/accessibleView';
|
|
import { AccessibilityVerbositySettingId } from 'vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
|
import { IAccessibleViewImplentation } from 'vs/platform/accessibility/browser/accessibleViewRegistry';
|
|
|
|
export class InlineChatAccessibleView implements IAccessibleViewImplentation {
|
|
readonly priority = 100;
|
|
readonly name = 'inlineChat';
|
|
readonly when = ContextKeyExpr.or(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_RESPONSE_FOCUSED);
|
|
readonly type = AccessibleViewType.View;
|
|
getProvider(accessor: ServicesAccessor) {
|
|
const codeEditorService = accessor.get(ICodeEditorService);
|
|
|
|
const editor = (codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor());
|
|
if (!editor) {
|
|
return;
|
|
}
|
|
const controller = InlineChatController.get(editor);
|
|
if (!controller) {
|
|
return;
|
|
}
|
|
const responseContent = controller?.getMessage();
|
|
if (!responseContent) {
|
|
return;
|
|
}
|
|
return {
|
|
id: AccessibleViewProviderId.InlineChat,
|
|
verbositySettingKey: AccessibilityVerbositySettingId.InlineChat,
|
|
provideContent(): string { return responseContent; },
|
|
onClose() {
|
|
controller.focus();
|
|
},
|
|
options: { type: AccessibleViewType.View }
|
|
};
|
|
}
|
|
dispose() { }
|
|
}
|