mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-08 23:32:36 -05:00
fixes #93493
This commit is contained in:
@@ -290,7 +290,7 @@ export class CommandCenter {
|
||||
}
|
||||
|
||||
@command('git.openResource')
|
||||
async openResource(resource: Resource): Promise<void> {
|
||||
async openResource(resource: Resource, preserveFocus: boolean): Promise<void> {
|
||||
const repository = this.model.getRepository(resource.resourceUri);
|
||||
|
||||
if (!repository) {
|
||||
@@ -301,7 +301,7 @@ export class CommandCenter {
|
||||
const openDiffOnClick = config.get<boolean>('openDiffOnClick');
|
||||
|
||||
if (openDiffOnClick) {
|
||||
await this._openResource(resource, undefined, true, false);
|
||||
await this._openResource(resource, undefined, preserveFocus, false);
|
||||
} else {
|
||||
await this.openFile(resource);
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ class MainThreadSCMResource implements ISCMResource {
|
||||
public decorations: ISCMResourceDecorations
|
||||
) { }
|
||||
|
||||
open(): Promise<void> {
|
||||
return this.proxy.$executeResourceCommand(this.sourceControlHandle, this.groupHandle, this.handle);
|
||||
open(preserveFocus: boolean): Promise<void> {
|
||||
return this.proxy.$executeResourceCommand(this.sourceControlHandle, this.groupHandle, this.handle, preserveFocus);
|
||||
}
|
||||
|
||||
toJSON(): any {
|
||||
|
||||
@@ -1388,7 +1388,7 @@ export interface ExtHostTerminalServiceShape {
|
||||
export interface ExtHostSCMShape {
|
||||
$provideOriginalResource(sourceControlHandle: number, uri: UriComponents, token: CancellationToken): Promise<UriComponents | null>;
|
||||
$onInputBoxValueChange(sourceControlHandle: number, value: string): void;
|
||||
$executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number): Promise<void>;
|
||||
$executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number, preserveFocus: boolean): Promise<void>;
|
||||
$validateInput(sourceControlHandle: number, value: string, cursorPosition: number): Promise<[string, number] | undefined>;
|
||||
$setSelectedSourceControls(selectedSourceControlHandles: number[]): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -266,14 +266,14 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
|
||||
return this._resourceStatesMap.get(handle);
|
||||
}
|
||||
|
||||
$executeResourceCommand(handle: number): Promise<void> {
|
||||
$executeResourceCommand(handle: number, preserveFocus: boolean): Promise<void> {
|
||||
const command = this._resourceStatesCommandsMap.get(handle);
|
||||
|
||||
if (!command) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return asPromise(() => this._commands.executeCommand(command.command, ...(command.arguments || [])));
|
||||
return asPromise(() => this._commands.executeCommand(command.command, ...(command.arguments || []), preserveFocus));
|
||||
}
|
||||
|
||||
_takeResourceStateSnapshot(): SCMRawResourceSplice[] {
|
||||
@@ -628,7 +628,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
$executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number): Promise<void> {
|
||||
$executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number, preserveFocus: boolean): Promise<void> {
|
||||
this.logService.trace('ExtHostSCM#$executeResourceCommand', sourceControlHandle, groupHandle, handle);
|
||||
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
@@ -643,7 +643,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
return group.$executeResourceCommand(handle);
|
||||
return group.$executeResourceCommand(handle, preserveFocus);
|
||||
}
|
||||
|
||||
$validateInput(sourceControlHandle: number, value: string, cursorPosition: number): Promise<[string, number] | undefined> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import { ActionBar, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar
|
||||
import { IThemeService, LIGHT, registerThemingParticipant, IFileIconTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { isSCMResource, isSCMResourceGroup, connectPrimaryMenuToInlineActionBar } from './util';
|
||||
import { attachBadgeStyler } from 'vs/platform/theme/common/styler';
|
||||
import { WorkbenchCompressibleObjectTree } from 'vs/platform/list/browser/listService';
|
||||
import { WorkbenchCompressibleObjectTree, TreeResourceNavigator, IOpenEvent } from 'vs/platform/list/browser/listService';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { disposableTimeout, ThrottledDelayer } from 'vs/base/common/async';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -877,10 +877,8 @@ export class RepositoryPane extends ViewPane {
|
||||
accessibilityProvider: new SCMAccessibilityProvider()
|
||||
}) as WorkbenchCompressibleObjectTree<TreeElement, FuzzyScore>;
|
||||
|
||||
this._register(Event.chain(this.tree.onDidOpen)
|
||||
.map(e => e.elements[0])
|
||||
.filter<ISCMResource>((e): e is ISCMResource => !!e && !isSCMResourceGroup(e) && !ResourceTree.isResourceNode(e))
|
||||
.on(this.open, this));
|
||||
const navigator = this._register(new TreeResourceNavigator(this.tree, { openOnSelection: false }));
|
||||
this._register(navigator.onDidOpenResource(this.open, this));
|
||||
|
||||
this._register(Event.chain(this.tree.onDidPin)
|
||||
.map(e => e.elements[0])
|
||||
@@ -1020,8 +1018,12 @@ export class RepositoryPane extends ViewPane {
|
||||
return this.repository.provider;
|
||||
}
|
||||
|
||||
private open(e: ISCMResource): void {
|
||||
e.open();
|
||||
private open(e: IOpenEvent<TreeElement | null>): void {
|
||||
if (!e.element || isSCMResourceGroup(e.element) || ResourceTree.isResourceNode(e.element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.element.open(!!e.editorOptions.preserveFocus);
|
||||
}
|
||||
|
||||
private pin(): void {
|
||||
|
||||
@@ -30,7 +30,7 @@ export interface ISCMResource {
|
||||
readonly resourceGroup: ISCMResourceGroup;
|
||||
readonly sourceUri: URI;
|
||||
readonly decorations: ISCMResourceDecorations;
|
||||
open(): Promise<void>;
|
||||
open(preserveFocus: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ISCMResourceGroup extends ISequence<ISCMResource> {
|
||||
|
||||
Reference in New Issue
Block a user