mirror of
https://github.com/Microsoft/vscode
synced 2024-10-13 14:57:14 +00:00
fixes #26184
This commit is contained in:
parent
2a5abbaeeb
commit
04c6d43247
|
@ -132,7 +132,7 @@ export class CommandCenter {
|
|||
return await commands.executeCommand<void>('vscode.open', right);
|
||||
}
|
||||
|
||||
return await commands.executeCommand<void>('vscode.diff', left, right, title);
|
||||
return await commands.executeCommand<void>('vscode.diff', left, right, title, { preview: true });
|
||||
}
|
||||
|
||||
private getLeftResource(resource: Resource): Uri | undefined {
|
||||
|
|
|
@ -321,6 +321,7 @@ class MouseController<T> implements IDisposable {
|
|||
this.disposables = [];
|
||||
this.disposables.push(view.addListener('mousedown', e => this.onMouseDown(e)));
|
||||
this.disposables.push(view.addListener('click', e => this.onPointer(e)));
|
||||
this.disposables.push(view.addListener('dblclick', e => this.onDoubleClick(e)));
|
||||
this.disposables.push(view.addListener(TouchEventType.Tap, e => this.onPointer(e)));
|
||||
}
|
||||
|
||||
|
@ -362,6 +363,19 @@ class MouseController<T> implements IDisposable {
|
|||
this.list.open(focus);
|
||||
}
|
||||
|
||||
private onDoubleClick(e: IListMouseEvent<T>): void {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (isSelectionChangeEvent(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const focus = this.list.getFocus();
|
||||
this.list.setSelection(focus);
|
||||
this.list.pin(focus);
|
||||
}
|
||||
|
||||
private changeSelection(e: IListMouseEvent<T>, reference: number | undefined): void {
|
||||
const focus = e.index;
|
||||
|
||||
|
@ -574,6 +588,11 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||
return mapEvent(this._onOpen.event, indexes => this.toListEvent({ indexes }));
|
||||
}
|
||||
|
||||
private _onPin = new Emitter<number[]>();
|
||||
@memoize get onPin(): Event<IListEvent<T>> {
|
||||
return mapEvent(this._onPin.event, indexes => this.toListEvent({ indexes }));
|
||||
}
|
||||
|
||||
private _onDOMFocus = new Emitter<void>();
|
||||
get onDOMFocus(): Event<void> { return this._onDOMFocus.event; }
|
||||
|
||||
|
@ -813,6 +832,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
|||
this._onOpen.fire(indexes);
|
||||
}
|
||||
|
||||
pin(indexes: number[]): void {
|
||||
this._onPin.fire(indexes);
|
||||
}
|
||||
|
||||
style(styles: IListStyles): void {
|
||||
const content: string[] = [];
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ import { VIEWLET_ID } from 'vs/workbench/parts/scm/common/scm';
|
|||
import { FileLabel } from 'vs/workbench/browser/labels';
|
||||
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
||||
import { ISCMService, ISCMProvider, ISCMResourceGroup, ISCMResource } from 'vs/workbench/services/scm/common/scm';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
@ -243,7 +245,9 @@ export class SCMViewlet extends Viewlet {
|
|||
@IThemeService protected themeService: IThemeService,
|
||||
@IMenuService private menuService: IMenuService,
|
||||
@IModelService private modelService: IModelService,
|
||||
@ICommandService private commandService: ICommandService
|
||||
@ICommandService private commandService: ICommandService,
|
||||
@IEditorGroupService private groupService: IEditorGroupService,
|
||||
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
|
||||
) {
|
||||
super(VIEWLET_ID, telemetryService, themeService);
|
||||
|
||||
|
@ -320,6 +324,11 @@ export class SCMViewlet extends Viewlet {
|
|||
.filter(e => !!e && isSCMResource(e))
|
||||
.on(this.open, this, this.disposables);
|
||||
|
||||
chain(this.list.onPin)
|
||||
.map(e => e.elements[0])
|
||||
.filter(e => !!e && isSCMResource(e))
|
||||
.on(this.pin, this, this.disposables);
|
||||
|
||||
this.list.onContextMenu(this.onListContextMenu, this, this.disposables);
|
||||
this.disposables.push(this.list);
|
||||
|
||||
|
@ -406,6 +415,12 @@ export class SCMViewlet extends Viewlet {
|
|||
.done(undefined, onUnexpectedError);
|
||||
}
|
||||
|
||||
private pin(): void {
|
||||
const activeEditor = this.editorService.getActiveEditor();
|
||||
const activeEditorInput = this.editorService.getActiveEditorInput();
|
||||
this.groupService.pinEditor(activeEditor.position, activeEditorInput);
|
||||
}
|
||||
|
||||
getTitle(): string {
|
||||
const title = localize('source control', "Source Control");
|
||||
const providerLabel = this.scmService.activeProvider && this.scmService.activeProvider.label;
|
||||
|
|
Loading…
Reference in a new issue