use weaker type-to-find from tree logic

This commit is contained in:
Johannes Rieken
2018-07-13 11:46:15 +02:00
parent d767a9f94c
commit 5086e87954

View File

@@ -31,6 +31,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { TPromise } from 'vs/base/common/winjs.base';
import { onUnexpectedError } from 'vs/base/common/errors';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
export type ListWidget = List<any> | PagedList<any> | ITree;
@@ -565,48 +566,40 @@ export interface IHighlightingTreeConfiguration extends ITreeConfiguration {
renderer: IHighlightingRenderer & ITreeRenderer;
}
// export class HighlightingTreeController extends WorkbenchTreeController {
export class HighlightingTreeController extends WorkbenchTreeController {
// private readonly mapper = KeyboardMapperFactory.INSTANCE;
constructor(
options: IControllerOptions,
private readonly onType: () => any,
@IConfigurationService configurationService: IConfigurationService
) {
super(options, configurationService);
}
// constructor(
// options: IControllerOptions,
// private readonly onType: () => any,
// @IConfigurationService configurationService: IConfigurationService
// ) {
// super(options, configurationService);
// }
// onKeyDown(tree: ITree, event: IKeyboardEvent) {
// let handled = super.onKeyDown(tree, event);
// if (handled) {
// return true;
// }
// if (this.upKeyBindingDispatcher.has(event.keyCode)) {
// return false;
// }
// if (event.ctrlKey || event.metaKey) {
// // ignore ctrl/cmd-combination but not shift/alt-combinatios
// return false;
// }
// // crazy -> during keydown focus moves to the input box
// // and because of that the keyup event is handled by the
// // input field
// const mapping = this.mapper.getRawKeyboardMapping();
// if (!mapping) {
// return false;
// }
// const keyInfo = mapping[event.code];
// if (!keyInfo) {
// return false;
// }
// if (keyInfo.value) {
// this.onType();
// return true;
// }
// return false;
// }
// }
onKeyDown(tree: ITree, event: IKeyboardEvent) {
let handled = super.onKeyDown(tree, event);
if (handled) {
return true;
}
if (this.upKeyBindingDispatcher.has(event.keyCode)) {
return false;
}
if (event.ctrlKey || event.metaKey) {
// ignore ctrl/cmd-combination but not shift/alt-combinatios
return false;
}
// crazy -> during keydown focus moves to the input box
// and because of that the keyup event is handled by the
// input field
if (event.keyCode >= KeyCode.KEY_A && event.keyCode <= KeyCode.KEY_Z) {
// todo@joh this is much weaker than using the KeyboardMapperFactory
// but due to layering-challanges that's not available here...
this.onType();
return true;
}
return false;
}
}
export class HighlightingWorkbenchTree extends WorkbenchTree {
@@ -638,7 +631,7 @@ export class HighlightingWorkbenchTree extends WorkbenchTree {
parent.appendChild(container);
// create tree
// treeConfiguration.controller = treeConfiguration.controller || instantiationService.createInstance(HighlightingTreeController, {}, () => this.input.focus());
treeConfiguration.controller = treeConfiguration.controller || instantiationService.createInstance(HighlightingTreeController, {}, () => this.input.focus());
super(treeContainer, treeConfiguration, treeOptions, contextKeyService, listService, themeService, instantiationService, configurationService);
this.renderer = treeConfiguration.renderer;