提交 7c91227a 编写于 作者: J Joao Moreno

tree.select should watch for expandOnlyOnTwistieClick

上级 13915bab
......@@ -326,6 +326,14 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
get filterOnType(): boolean { return this.tree.filterOnType; }
get openOnSingleClick(): boolean { return this.tree.openOnSingleClick; }
get expandOnlyOnTwistieClick(): boolean | ((e: T) => boolean) {
if (typeof this.tree.expandOnlyOnTwistieClick === 'boolean') {
return this.tree.expandOnlyOnTwistieClick;
}
const fn = this.tree.expandOnlyOnTwistieClick;
return element => fn(this.nodes.get((element === this.root.element ? null : element) as T) || null);
}
get onDidDispose(): Event<void> { return this.tree.onDidDispose; }
......
......@@ -603,7 +603,17 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focus = list.getFocus();
if (focus.length > 0) {
list.toggleCollapsed(focus[0]);
let toggleCollapsed = true;
if (list.expandOnlyOnTwistieClick === true) {
toggleCollapsed = false;
} else if (typeof list.expandOnlyOnTwistieClick !== 'boolean' && list.expandOnlyOnTwistieClick(focus[0])) {
toggleCollapsed = false;
}
if (toggleCollapsed) {
list.toggleCollapsed(focus[0]);
}
}
list.setSelection(focus, fakeKeyboardEvent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册