Skip to content

Commit

Permalink
bulk - add tree keyboard navigation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jan 20, 2020
1 parent 973dab0 commit 7cfac76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import 'vs/css!./bulkEdit';
import { WorkbenchAsyncDataTree, TreeResourceNavigator2, IOpenEvent } from 'vs/platform/list/browser/listService';
import { WorkspaceEdit } from 'vs/editor/common/modes';
import { BulkEditElement, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, BulkEditDataSource, BulkEditIdentityProvider, FileElement, TextEditElement, BulkEditAccessibilityProvider, BulkEditAriaProvider, CategoryElementRenderer } from 'vs/workbench/contrib/bulkEdit/browser/bulkEditTree';
import { BulkEditElement, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, BulkEditDataSource, BulkEditIdentityProvider, FileElement, TextEditElement, BulkEditAccessibilityProvider, BulkEditAriaProvider, CategoryElementRenderer, BulkEditNaviLabelProvider } from 'vs/workbench/contrib/bulkEdit/browser/bulkEditTree';
import { FuzzyScore } from 'vs/base/common/filters';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
Expand Down Expand Up @@ -119,7 +119,8 @@ export class BulkEditPane extends ViewPane {
ariaProvider: new BulkEditAriaProvider(),
identityProvider: new BulkEditIdentityProvider(),
expandOnlyOnTwistieClick: true,
multipleSelectionSupport: false
multipleSelectionSupport: false,
keyboardNavigationLabelProvider: new BulkEditNaviLabelProvider(),
}
);

Expand Down
16 changes: 15 additions & 1 deletion src/vs/workbench/contrib/bulkEdit/browser/bulkEditTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { IResourceLabel, ResourceLabels } from 'vs/workbench/browser/labels';
import { URI } from 'vs/base/common/uri';
import { HighlightedLabel, IHighlight } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { IIdentityProvider, IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { IIdentityProvider, IListVirtualDelegate, IKeyboardNavigationLabelProvider } from 'vs/base/browser/ui/list/list';
import { Range } from 'vs/editor/common/core/range';
import * as dom from 'vs/base/browser/dom';
import { ITextModel } from 'vs/editor/common/model';
Expand All @@ -22,6 +22,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
import type { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import type { IAriaProvider } from 'vs/base/browser/ui/list/listView';
import { IconLabel } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { basename } from 'vs/base/common/resources';

// --- VIEW MODEL

Expand Down Expand Up @@ -422,3 +423,16 @@ export class BulkEditDelegate implements IListVirtualDelegate<BulkEditElement> {
}
}
}


export class BulkEditNaviLabelProvider implements IKeyboardNavigationLabelProvider<BulkEditElement> {

getKeyboardNavigationLabel(element: BulkEditElement) {
if (element instanceof FileElement) {
return basename(element.uri);
} else if (element instanceof BulkCategory) {
return element.label;
}
return undefined;
}
}

0 comments on commit 7cfac76

Please sign in to comment.