Skip to content

Commit 4353a83

Browse files
authored
Merge branch 'master' into sandy081/supportCredentials
2 parents 32f934c + ab8a3f3 commit 4353a83

16 files changed

Lines changed: 66 additions & 42 deletions

File tree

extensions/git/src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export class CommandCenter {
460460

461461
@command('git.clone')
462462
async clone(url?: string, parentPath?: string): Promise<void> {
463-
if (!url) {
463+
if (!url || typeof url !== 'string') {
464464
url = await pickRemoteSource(this.model, {
465465
providerLabel: provider => localize('clonefrom', "Clone from {0}", provider.name),
466466
urlLabel: localize('repourl', "Clone from URL")

src/vs/code/electron-main/window.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,18 @@ export class CodeWindow extends Disposable implements ICodeWindow {
336336
return !!this.documentEdited;
337337
}
338338

339-
focus(): void {
339+
focus(options?: { force: boolean }): void {
340+
// macOS: Electron >6.x changed its behaviour to not
341+
// bring the application to the foreground when a window
342+
// is focused programmatically. Only via `app.focus` and
343+
// the option `steal: true` can you get the previous
344+
// behaviour back. The only reason to use this option is
345+
// when a window is getting focused while the application
346+
// is not in the foreground.
347+
if (isMacintosh && options?.force) {
348+
app.focus({ steal: true });
349+
}
350+
340351
if (!this._win) {
341352
return;
342353
}
@@ -719,7 +730,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
719730
this.showTimeoutHandle = setTimeout(() => {
720731
if (this._win && !this._win.isVisible() && !this._win.isMinimized()) {
721732
this._win.show();
722-
this._win.focus();
733+
this.focus({ force: true });
723734
this._win.webContents.openDevTools();
724735
}
725736
}, 10000);

src/vs/platform/electron/common/electron.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ export interface ICommonElectronService {
4444
unmaximizeWindow(): Promise<void>;
4545
minimizeWindow(): Promise<void>;
4646

47-
focusWindow(options?: { windowId?: number }): Promise<void>;
47+
/**
48+
* Make the window focused.
49+
*
50+
* @param options Pass `force: true` if you want to make the window take
51+
* focus even if the application does not have focus currently. This option
52+
* should only be used if it is necessary to steal focus from the current
53+
* focused application which may not be VSCode.
54+
*/
55+
focusWindow(options?: { windowId?: number, force?: boolean }): Promise<void>;
4856

4957
// Dialogs
5058
showMessageBox(options: MessageBoxOptions): Promise<MessageBoxReturnValue>;

src/vs/platform/electron/electron-main/electronMainService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@ export class ElectronMainService implements IElectronMainService {
172172
}
173173
}
174174

175-
async focusWindow(windowId: number | undefined, options?: { windowId?: number; }): Promise<void> {
175+
async focusWindow(windowId: number | undefined, options?: { windowId?: number; force?: boolean; }): Promise<void> {
176176
if (options && typeof options.windowId === 'number') {
177177
windowId = options.windowId;
178178
}
179179

180180
const window = this.windowById(windowId);
181181
if (window) {
182-
window.focus();
182+
window.focus({ force: options?.force ?? false });
183183
}
184184
}
185185

src/vs/platform/list/browser/listService.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ abstract class ResourceNavigator<T> extends Disposable {
452452
super();
453453

454454
this.openOnFocus = options?.openOnFocus ?? false;
455-
this.openOnSingleClick = options?.openOnSingleClick ?? true;
456455

457456
this._register(Event.filter(this.widget.onDidChangeSelection, e => e.browserEvent instanceof KeyboardEvent)(e => this.onSelectionFromKeyboard(e)));
458457
this._register(this.widget.onPointer((e: { browserEvent: MouseEvent }) => this.onPointer(e.browserEvent)));
@@ -463,9 +462,12 @@ abstract class ResourceNavigator<T> extends Disposable {
463462
}
464463

465464
if (typeof options?.openOnSingleClick !== 'boolean' && options?.configurationService) {
465+
this.openOnSingleClick = options?.configurationService!.getValue(openModeSettingKey) !== 'doubleClick';
466466
this._register(options?.configurationService.onDidChangeConfiguration(() => {
467467
this.openOnSingleClick = options?.configurationService!.getValue(openModeSettingKey) !== 'doubleClick';
468468
}));
469+
} else {
470+
this.openOnSingleClick = options?.openOnSingleClick ?? true;
469471
}
470472
}
471473

@@ -493,15 +495,19 @@ abstract class ResourceNavigator<T> extends Disposable {
493495
}
494496

495497
private onPointer(browserEvent: MouseEvent): void {
498+
if (!this.openOnSingleClick) {
499+
return;
500+
}
501+
496502
const isDoubleClick = browserEvent.detail === 2;
497503

498-
if (!this.openOnSingleClick && !isDoubleClick) {
504+
if (isDoubleClick) {
499505
return;
500506
}
501507

502508
const isMiddleClick = browserEvent.button === 1;
503-
const preserveFocus = !isDoubleClick;
504-
const pinned = isDoubleClick || isMiddleClick;
509+
const preserveFocus = true;
510+
const pinned = isMiddleClick;
505511
const sideBySide = browserEvent.ctrlKey || browserEvent.metaKey || browserEvent.altKey;
506512

507513
this._open(preserveFocus, pinned, sideBySide, browserEvent);

src/vs/platform/windows/electron-main/windows.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface ICodeWindow extends IDisposable {
6161
load(config: INativeWindowConfiguration, isReload?: boolean): void;
6262
reload(configuration?: INativeWindowConfiguration, cli?: ParsedArgs): void;
6363

64-
focus(): void;
64+
focus(options?: { force: boolean }): void;
6565
close(): void;
6666

6767
getBounds(): Rectangle;

src/vs/platform/windows/electron-main/windowsMainService.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
167167
private readonly _onWindowReady = this._register(new Emitter<ICodeWindow>());
168168
readonly onWindowReady = this._onWindowReady.event;
169169

170-
private readonly _onWindowClose = this._register(new Emitter<number>());
171-
readonly onWindowClose = this._onWindowClose.event;
172-
173170
private readonly _onWindowsCountChanged = this._register(new Emitter<IWindowsCountChangedEvent>());
174171
readonly onWindowsCountChanged = this._onWindowsCountChanged.event;
175172

@@ -1626,18 +1623,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
16261623
return state;
16271624
}
16281625

1629-
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow {
1630-
const lastActive = this.getLastActiveWindow();
1631-
if (lastActive) {
1632-
lastActive.focus();
1633-
1634-
return lastActive;
1635-
}
1636-
1637-
// No window - open new empty one
1638-
return this.open({ context, cli, forceEmpty: true })[0];
1639-
}
1640-
16411626
getLastActiveWindow(): ICodeWindow | undefined {
16421627
return getLastActiveWindow(WindowsMainService.WINDOWS);
16431628
}
@@ -1695,6 +1680,5 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
16951680

16961681
// Emit
16971682
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length + 1, newCount: WindowsMainService.WINDOWS.length });
1698-
this._onWindowClose.fire(win.id);
16991683
}
17001684
}

src/vs/workbench/browser/web.main.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,17 @@ class BrowserMain extends Disposable {
208208
const requestService = new BrowserRequestService(remoteAgentService, configurationService, logService);
209209
serviceCollection.set(IRequestService, requestService);
210210

211-
// initialize user data
211+
// Userdata Initialize Service
212212
const userDataInitializationService = new UserDataInitializationService(environmentService, fileService, storageService, productService, requestService, logService);
213213
serviceCollection.set(IUserDataInitializationService, userDataInitializationService);
214-
await userDataInitializationService.initializeRequiredResources();
214+
215+
if (await userDataInitializationService.requiresInitialization()) {
216+
// Initialize required resources - settings & global state
217+
await userDataInitializationService.initializeRequiredResources();
218+
219+
// Reload configuration after initializing
220+
await configurationService.reloadConfiguration();
221+
}
215222

216223
return { serviceCollection, logService, storageService };
217224
}

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ export class DebugSession implements IDebugSession {
813813
}
814814

815815
if (this.configurationService.getValue<IDebugConfiguration>('debug').focusWindowOnBreak) {
816-
this.hostService.focus();
816+
this.hostService.focus({ force: true /* Application may not be active */ });
817817
}
818818
}
819819
}

src/vs/workbench/contrib/debug/browser/replFilter.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ export class ReplFilter implements ITreeFilter<IReplElement> {
5151
}
5252

5353
filter(element: IReplElement, parentVisibility: TreeVisibility): TreeFilterResult<void> {
54-
if (this._parsedQueries.length === 0) {
55-
return parentVisibility;
56-
}
57-
5854
let includeQueryPresent = false;
5955
let includeQueryMatched = false;
6056

@@ -72,7 +68,7 @@ export class ReplFilter implements ITreeFilter<IReplElement> {
7268
}
7369
}
7470

75-
return includeQueryPresent ? includeQueryMatched : parentVisibility;
71+
return includeQueryPresent ? includeQueryMatched : (typeof parentVisibility !== 'undefined' ? parentVisibility : TreeVisibility.Visible);
7672
}
7773
}
7874

0 commit comments

Comments
 (0)