未验证 提交 22316bec 编写于 作者: B Benjamin Pasero 提交者: GitHub

introduce sessionId (#83144)

...@@ -635,6 +635,7 @@ export class CodeWindow extends Disposable implements ICodeWindow { ...@@ -635,6 +635,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
// Set window ID // Set window ID
windowConfiguration.windowId = this._win.id; windowConfiguration.windowId = this._win.id;
windowConfiguration.sessionId = `window:${this._win.id}`;
windowConfiguration.logLevel = this.logService.getLevel(); windowConfiguration.logLevel = this.logService.getLevel();
// Set zoomlevel // Set zoomlevel
......
...@@ -551,8 +551,8 @@ export class Menubar { ...@@ -551,8 +551,8 @@ export class Menubar {
label: this.mnemonicLabel(nls.localize('miCheckForUpdates', "Check for &&Updates...")), click: () => setTimeout(() => { label: this.mnemonicLabel(nls.localize('miCheckForUpdates', "Check for &&Updates...")), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate'); this.reportMenuActionTelemetry('CheckForUpdate');
const focusedWindow = BrowserWindow.getFocusedWindow(); const window = this.windowsMainService.getLastActiveWindow();
const context = focusedWindow ? { windowId: focusedWindow.id } : null; const context = window?.config?.sessionId;
this.updateService.checkForUpdates(context); this.updateService.checkForUpdates(context);
}, 0) }, 0)
})]; })];
......
...@@ -220,7 +220,8 @@ export interface IAddFoldersRequest { ...@@ -220,7 +220,8 @@ export interface IAddFoldersRequest {
export interface IWindowConfiguration extends ParsedArgs { export interface IWindowConfiguration extends ParsedArgs {
machineId: string; machineId: string;
windowId: number; windowId: number; // TODO: should we deprecate this in favor of sessionId?
sessionId: string;
logLevel: LogLevel; logLevel: LogLevel;
mainPid: number; mainPid: number;
......
...@@ -293,6 +293,7 @@ export class CustomMenubarControl extends MenubarControl { ...@@ -293,6 +293,7 @@ export class CustomMenubarControl extends MenubarControl {
@IThemeService private readonly themeService: IThemeService, @IThemeService private readonly themeService: IThemeService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService, @IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IHostService protected readonly hostService: IHostService, @IHostService protected readonly hostService: IHostService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
@optional(IElectronService) private readonly electronService: IElectronService, @optional(IElectronService) private readonly electronService: IElectronService,
@optional(IElectronEnvironmentService) private readonly electronEnvironmentService: IElectronEnvironmentService @optional(IElectronEnvironmentService) private readonly electronEnvironmentService: IElectronEnvironmentService
) { ) {
...@@ -444,9 +445,8 @@ export class CustomMenubarControl extends MenubarControl { ...@@ -444,9 +445,8 @@ export class CustomMenubarControl extends MenubarControl {
return null; return null;
case StateType.Idle: case StateType.Idle:
const context = `window:${this.electronEnvironmentService ? this.electronEnvironmentService.windowId : 'any'}`;
return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () => return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () =>
this.updateService.checkForUpdates(context)); this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId));
case StateType.CheckingForUpdates: case StateType.CheckingForUpdates:
return new Action('update.checking', nls.localize('checkingForUpdates', "Checking for Updates..."), undefined, false); return new Action('update.checking', nls.localize('checkingForUpdates', "Checking for Updates..."), undefined, false);
......
...@@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions'; ...@@ -9,7 +9,7 @@ import { Action } from 'vs/base/common/actions';
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle'; import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { IActivityService, NumberBadge, IBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity'; import { IActivityService, NumberBadge, IBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity';
import { IInstantiationService, optional } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity'; import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity';
import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
...@@ -30,10 +30,6 @@ import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/com ...@@ -30,10 +30,6 @@ import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/com
import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IProductService } from 'vs/platform/product/common/productService'; import { IProductService } from 'vs/platform/product/common/productService';
// TODO@Joao layer breaker
// tslint:disable-next-line: layering
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized); const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized);
let releaseNotesManager: ReleaseNotesManager | undefined = undefined; let releaseNotesManager: ReleaseNotesManager | undefined = undefined;
...@@ -171,8 +167,6 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu ...@@ -171,8 +167,6 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
private readonly badgeDisposable = this._register(new MutableDisposable()); private readonly badgeDisposable = this._register(new MutableDisposable());
private updateStateContextKey: IContextKey<string>; private updateStateContextKey: IContextKey<string>;
private context = `window:${this.electronEnvironmentService ? this.electronEnvironmentService.windowId : 'any'}`;
constructor( constructor(
@IStorageService private readonly storageService: IStorageService, @IStorageService private readonly storageService: IStorageService,
@IInstantiationService private readonly instantiationService: IInstantiationService, @IInstantiationService private readonly instantiationService: IInstantiationService,
...@@ -182,7 +176,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu ...@@ -182,7 +176,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
@IActivityService private readonly activityService: IActivityService, @IActivityService private readonly activityService: IActivityService,
@IContextKeyService private readonly contextKeyService: IContextKeyService, @IContextKeyService private readonly contextKeyService: IContextKeyService,
@IProductService private readonly productService: IProductService, @IProductService private readonly productService: IProductService,
@optional(IElectronEnvironmentService) private readonly electronEnvironmentService: IElectronEnvironmentService @IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
) { ) {
super(); super();
this.state = updateService.state; this.state = updateService.state;
...@@ -218,7 +212,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu ...@@ -218,7 +212,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
case StateType.Idle: case StateType.Idle:
if (state.error) { if (state.error) {
this.onError(state.error); this.onError(state.error);
} else if (this.state.type === StateType.CheckingForUpdates && this.state.context === this.context) { } else if (this.state.type === StateType.CheckingForUpdates && this.state.context === this.workbenchEnvironmentService.configuration.sessionId) {
this.onUpdateNotAvailable(); this.onUpdateNotAvailable();
} }
break; break;
...@@ -401,7 +395,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu ...@@ -401,7 +395,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
} }
private registerGlobalActivityActions(): void { private registerGlobalActivityActions(): void {
CommandsRegistry.registerCommand('update.check', () => this.updateService.checkForUpdates(this.context)); CommandsRegistry.registerCommand('update.check', () => this.updateService.checkForUpdates(this.workbenchEnvironmentService.configuration.sessionId));
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, { MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '6_update', group: '6_update',
command: { command: {
......
...@@ -43,6 +43,7 @@ export class BrowserWindowConfiguration implements IWindowConfiguration { ...@@ -43,6 +43,7 @@ export class BrowserWindowConfiguration implements IWindowConfiguration {
readonly machineId = generateUuid(); readonly machineId = generateUuid();
windowId!: number; windowId!: number;
sessionId!: string;
logLevel!: LogLevel; logLevel!: LogLevel;
mainPid!: number; mainPid!: number;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册