Merge from vscode 4f85c3c94c15457e1d4c9e67da6800630394ea54 (#8757)

* Merge from vscode 4f85c3c94c15457e1d4c9e67da6800630394ea54

* disable failing tests
This commit is contained in:
Anthony Dresser
2019-12-19 23:41:55 -08:00
committed by GitHub
parent 778a34a9d2
commit 74caccdfe6
40 changed files with 2058 additions and 1299 deletions

View File

@@ -32,6 +32,7 @@ import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/f
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { onUnexpectedError } from 'vs/base/common/errors';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
const CONTEXT_FOLDING_ENABLED = new RawContextKey<boolean>('foldingEnabled', false);
@@ -421,8 +422,12 @@ export class FoldingController extends Disposable implements IEditorContribution
if (region && region.startLineNumber === lineNumber) {
let isCollapsed = region.isCollapsed;
if (iconClicked || isCollapsed) {
let toToggle = [region];
if (e.event.middleButton || e.event.shiftKey) {
let toToggle = [];
let considerRegionsInside = this.shouldConsiderRegionsInside(e.event);
if (isCollapsed || (!isCollapsed && !considerRegionsInside)) {
toToggle.push(region);
}
if (considerRegionsInside) {
toToggle.push(...foldingModel.getRegionsInside(region, (r: FoldingRegion) => r.isCollapsed === isCollapsed));
}
foldingModel.toggleCollapseState(toToggle);
@@ -433,6 +438,10 @@ export class FoldingController extends Disposable implements IEditorContribution
}).then(undefined, onUnexpectedError);
}
private shouldConsiderRegionsInside(event: IMouseEvent): boolean {
return event.middleButton || event.shiftKey;
}
public reveal(position: IPosition): void {
this.editor.revealPositionInCenterIfOutsideViewport(position, ScrollType.Smooth);
}