Skip to content

Commit a06c753

Browse files
committed
explorer: polish focusNoScroll
1 parent 67bc3d7 commit a06c753

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/vs/workbench/contrib/files/browser/files.contribution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,12 @@ configurationRegistry.registerConfiguration({
370370
},
371371
'explorer.autoReveal': {
372372
'type': ['boolean', 'string'],
373-
'enum': [true, false, 'highlightNoScroll'],
373+
'enum': [true, false, 'focusNoScroll'],
374374
'default': true,
375375
'enumDescriptions': [
376376
nls.localize('autoReveal.on', 'Files will be revealed and selected.'),
377377
nls.localize('autoReveal.off', 'Files will not be revealed and selected.'),
378-
nls.localize('autoReveal.highlightNoScroll', 'Files will not be scrolled into view, but will still be selected.'),
378+
nls.localize('autoReveal.focusNoScroll', 'Files will not be scrolled into view, but will still be focused.'),
379379
],
380380
'description': nls.localize('autoReveal', "Controls whether the explorer should automatically reveal and select files when opening them.")
381381
},

src/vs/workbench/contrib/files/browser/views/explorerView.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class ExplorerView extends ViewPane {
146146
// Refresh is needed on the initial explorer open
147147
private shouldRefresh = true;
148148
private dragHandler!: DelayedDragHandler;
149-
private autoReveal: boolean | string = false;
149+
private autoReveal: boolean | 'focusNoScroll' = false;
150150
private actions: IAction[] | undefined;
151151
private decorationsProvider: ExplorerDecorationsProvider | undefined;
152152

@@ -674,12 +674,9 @@ export class ExplorerView extends ViewPane {
674674
}
675675

676676
try {
677-
if (reveal) {
678-
// Don't scroll to the item if it's already visible,
679-
// or if set not to.
680-
if (reveal !== 'highlightNoScroll' && this.tree.getRelativeTop(item) === null) {
681-
this.tree.reveal(item, 0.5);
682-
}
677+
if (reveal === true && this.tree.getRelativeTop(item) === null) {
678+
// Don't scroll to the item if it's already visible, or if set not to.
679+
this.tree.reveal(item, 0.5);
683680
}
684681

685682
this.tree.setFocus([item]);

src/vs/workbench/contrib/files/common/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export interface IFilesConfiguration extends PlatformIFilesConfiguration, IWorkb
121121
openEditors: {
122122
visible: number;
123123
};
124-
autoReveal: boolean | string;
124+
autoReveal: boolean | 'focusNoScroll';
125125
enableDragAndDrop: boolean;
126126
confirmDelete: boolean;
127127
sortOrder: SortOrder;

0 commit comments

Comments
 (0)