提交 a06c753e 编写于 作者: I isidor

explorer: polish focusNoScroll

上级 67bc3d78
......@@ -370,12 +370,12 @@ configurationRegistry.registerConfiguration({
},
'explorer.autoReveal': {
'type': ['boolean', 'string'],
'enum': [true, false, 'highlightNoScroll'],
'enum': [true, false, 'focusNoScroll'],
'default': true,
'enumDescriptions': [
nls.localize('autoReveal.on', 'Files will be revealed and selected.'),
nls.localize('autoReveal.off', 'Files will not be revealed and selected.'),
nls.localize('autoReveal.highlightNoScroll', 'Files will not be scrolled into view, but will still be selected.'),
nls.localize('autoReveal.focusNoScroll', 'Files will not be scrolled into view, but will still be focused.'),
],
'description': nls.localize('autoReveal', "Controls whether the explorer should automatically reveal and select files when opening them.")
},
......
......@@ -146,7 +146,7 @@ export class ExplorerView extends ViewPane {
// Refresh is needed on the initial explorer open
private shouldRefresh = true;
private dragHandler!: DelayedDragHandler;
private autoReveal: boolean | string = false;
private autoReveal: boolean | 'focusNoScroll' = false;
private actions: IAction[] | undefined;
private decorationsProvider: ExplorerDecorationsProvider | undefined;
......@@ -674,12 +674,9 @@ export class ExplorerView extends ViewPane {
}
try {
if (reveal) {
// Don't scroll to the item if it's already visible,
// or if set not to.
if (reveal !== 'highlightNoScroll' && this.tree.getRelativeTop(item) === null) {
this.tree.reveal(item, 0.5);
}
if (reveal === true && this.tree.getRelativeTop(item) === null) {
// Don't scroll to the item if it's already visible, or if set not to.
this.tree.reveal(item, 0.5);
}
this.tree.setFocus([item]);
......
......@@ -121,7 +121,7 @@ export interface IFilesConfiguration extends PlatformIFilesConfiguration, IWorkb
openEditors: {
visible: number;
};
autoReveal: boolean | string;
autoReveal: boolean | 'focusNoScroll';
enableDragAndDrop: boolean;
confirmDelete: boolean;
sortOrder: SortOrder;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册