Przeglądaj źródła

Stops showing compare view on Select for Compare

Fixes focus issues with compare picker
main
Eric Amodio 5 lat temu
rodzic
commit
2d060628e2
3 zmienionych plików z 25 dodań i 12 usunięć
  1. +2
    -2
      src/views/compareView.ts
  2. +21
    -6
      src/views/nodes/compareNode.ts
  3. +2
    -4
      src/views/viewBase.ts

+ 2
- 2
src/views/compareView.ts Wyświetl plik

@ -149,13 +149,13 @@ export class CompareView extends ViewBase {
private async addResults(results: ViewNode) {
if (!this.visible) {
void (await this.show());
await this.show();
}
const root = this.ensureRoot();
root.addOrReplace(results, !this.keepResults);
setImmediate(() => this.reveal(results, { select: true, expand: true }));
setImmediate(() => this.reveal(results, { expand: true, focus: true, select: true }));
}
private setFilesLayout(layout: ViewFilesLayout) {

+ 21
- 6
src/views/nodes/compareNode.ts Wyświetl plik

@ -3,7 +3,7 @@ import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { getRepoPathOrPrompt } from '../../commands';
import { CommandContext, GlyphChars, NamedRef, setCommandContext } from '../../constants';
import { GitService } from '../../git/gitService';
import { CommandQuickPickItem, ReferencesQuickPick } from '../../quickpicks';
import { ReferencesQuickPick } from '../../quickpicks';
import { debug, gate, Iterables, log, Promises } from '../../system';
import { CompareView } from '../compareView';
import { MessageNode } from './common';
@ -135,6 +135,7 @@ export class CompareNode extends ViewNode {
else if (repoPath !== this._selectedRef.repoPath) {
// If we don't have a matching repoPath, then start over
void this.selectForCompare(repoPath, ref);
return;
}
@ -148,7 +149,12 @@ export class CompareNode extends ViewNode {
checkmarks: true
}
);
if (pick === undefined || pick instanceof CommandQuickPickItem) return;
if (pick === undefined) {
await this.view.show();
await this.view.reveal(this._comparePickerNode!, { focus: true, select: true });
return;
}
ref = pick.ref;
}
@ -165,7 +171,12 @@ export class CompareNode extends ViewNode {
if (repoPath === undefined) {
repoPath = await getRepoPathOrPrompt(`Compare in which repository${GlyphChars.Ellipsis}`);
}
if (repoPath === undefined) return;
if (repoPath === undefined) {
await this.view.show();
await this.view.reveal(this._comparePickerNode!, { focus: true, select: true });
return;
}
let autoCompare = false;
if (ref === undefined) {
@ -173,7 +184,12 @@ export class CompareNode extends ViewNode {
allowEnteringRefs: true,
checkmarks: false
});
if (pick === undefined || pick instanceof CommandQuickPickItem) return;
if (pick === undefined) {
await this.view.show();
await this.view.reveal(this._comparePickerNode!, { focus: true, select: true });
return;
}
ref = pick.ref;
@ -183,9 +199,8 @@ export class CompareNode extends ViewNode {
this._selectedRef = { label: this.getRefName(ref), repoPath: repoPath, ref: ref };
setCommandContext(CommandContext.ViewsCanCompare, true);
await this.view.show();
void (await this.triggerChange());
await this.view.reveal(this._comparePickerNode!, { focus: true, select: true });
if (autoCompare) {
void (await this.compareWithSelected());

+ 2
- 4
src/views/viewBase.ts Wyświetl plik

@ -201,7 +201,7 @@ export abstract class ViewBase> implements TreeData
const location = this.location;
try {
return await commands.executeCommand(`${this.id}${location ? `:${location}` : ''}.focus`);
void (await commands.executeCommand(`${this.id}${location ? `:${location}` : ''}.focus`));
}
catch (ex) {
Logger.error(ex);
@ -218,11 +218,9 @@ export abstract class ViewBase> implements TreeData
if (result === actions[0]) {
await configuration.update(setting, true, ConfigurationTarget.Global);
return commands.executeCommand(`${this.id}${location ? `:${location}` : ''}.focus`);
void (await commands.executeCommand(`${this.id}${location ? `:${location}` : ''}.focus`));
}
}
return undefined;
}
}

Ładowanie…
Anuluj
Zapisz