mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-27 21:09:31 +01:00
allow provider to give their own accessible view help content (#194049)
* fix #193451 * clean up
This commit is contained in:
@@ -102,6 +102,7 @@ export interface IAccessibleViewOptions {
|
||||
language?: string;
|
||||
type: AccessibleViewType;
|
||||
positionBottom?: boolean;
|
||||
customHelp?: () => string;
|
||||
}
|
||||
|
||||
export class AccessibleView extends Disposable {
|
||||
@@ -506,9 +507,10 @@ export class AccessibleView extends Disposable {
|
||||
|
||||
}
|
||||
const currentProvider = Object.assign({}, this._currentProvider);
|
||||
currentProvider.provideContent = this._currentProvider.provideContent.bind(currentProvider);
|
||||
currentProvider.options = Object.assign({}, currentProvider.options);
|
||||
const accessibleViewHelpProvider: IAccessibleContentProvider = {
|
||||
provideContent: () => this._getAccessibleViewHelpDialogContent(this._goToSymbolsSupported()),
|
||||
provideContent: () => currentProvider.options.customHelp ? currentProvider?.options.customHelp() : this._getAccessibleViewHelpDialogContent(this._goToSymbolsSupported()),
|
||||
onClose: () => this.show(currentProvider),
|
||||
options: { type: AccessibleViewType.Help },
|
||||
verbositySettingKey: this._currentProvider.verbositySettingKey
|
||||
|
||||
+3
-1
@@ -119,7 +119,9 @@ export class TerminalAccessibleViewContribution extends Disposable implements IT
|
||||
this._bufferTracker = this._register(this._instantiationService.createInstance(BufferContentTracker, this._xterm));
|
||||
}
|
||||
if (!this._bufferProvider) {
|
||||
this._bufferProvider = this._register(this._instantiationService.createInstance(TerminalAccessibleBufferProvider, this._instance, this._bufferTracker));
|
||||
this._bufferProvider = this._register(this._instantiationService.createInstance(TerminalAccessibleBufferProvider, this._instance, this._bufferTracker, () => {
|
||||
return this._register(this._instantiationService.createInstance(TerminalAccessibleContentProvider, this._instance, this._xterm!)).provideContent();
|
||||
}));
|
||||
}
|
||||
this._accessibleViewService.show(this._bufferProvider);
|
||||
}
|
||||
|
||||
+2
@@ -22,12 +22,14 @@ export class TerminalAccessibleBufferProvider extends DisposableStore implements
|
||||
constructor(
|
||||
private readonly _instance: Pick<ITerminalInstance, 'onDidRunText' | 'focus' | 'shellType' | 'capabilities' | 'onDidRequestFocus' | 'resource'>,
|
||||
private _bufferTracker: BufferContentTracker,
|
||||
customHelp: () => string,
|
||||
@IModelService _modelService: IModelService,
|
||||
@IConfigurationService _configurationService: IConfigurationService,
|
||||
@IContextKeyService _contextKeyService: IContextKeyService,
|
||||
@ITerminalService _terminalService: ITerminalService
|
||||
) {
|
||||
super();
|
||||
this.options.customHelp = customHelp;
|
||||
}
|
||||
|
||||
onClose() {
|
||||
|
||||
Reference in New Issue
Block a user