SCM - add logging to track down smoke test failure (#214813)

This commit is contained in:
Ladislau Szomoru 2024-06-11 00:11:58 +02:00 committed by GitHub
parent cd55bece71
commit 878a5c8283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 4 deletions

View file

@ -27,6 +27,7 @@ import { IModelService } from 'vs/editor/common/services/model';
import { ITextModelContentProvider, ITextModelService } from 'vs/editor/common/services/resolverService';
import { Schemas } from 'vs/base/common/network';
import { ITextModel } from 'vs/editor/common/model';
import { ILogService } from 'vs/platform/log/common/log';
function getIconFromIconDto(iconDto?: UriComponents | { light: UriComponents; dark: UriComponents } | ThemeIcon): URI | { light: URI; dark: URI } | ThemeIcon | undefined {
if (iconDto === undefined) {
@ -270,7 +271,8 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
private readonly _inputBoxTextModel: ITextModel,
private readonly _quickDiffService: IQuickDiffService,
private readonly _uriIdentService: IUriIdentityService,
private readonly _workspaceContextService: IWorkspaceContextService
private readonly _workspaceContextService: IWorkspaceContextService,
private readonly _logService: ILogService
) {
if (_rootUri) {
const folder = this._workspaceContextService.getWorkspaceFolder(_rootUri);
@ -295,6 +297,7 @@ class MainThreadSCMProvider implements ISCMProvider, QuickDiffProvider {
}
if (typeof features.statusBarCommands !== 'undefined') {
this._logService.info('MainThreadSCMProvider#updateSourceControl:', features.statusBarCommands.map(c => c.title).join(', '));
this._statusBarCommands.set(features.statusBarCommands, undefined);
}
@ -475,7 +478,8 @@ export class MainThreadSCM implements MainThreadSCMShape {
@ITextModelService private readonly textModelService: ITextModelService,
@IQuickDiffService private readonly quickDiffService: IQuickDiffService,
@IUriIdentityService private readonly _uriIdentService: IUriIdentityService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@ILogService private readonly logService: ILogService
) {
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostSCM);
@ -496,7 +500,7 @@ export class MainThreadSCM implements MainThreadSCMShape {
this._repositoryBarriers.set(handle, new Barrier());
const inputBoxTextModelRef = await this.textModelService.createModelReference(URI.revive(inputBoxDocumentUri));
const provider = new MainThreadSCMProvider(this._proxy, handle, id, label, rootUri ? URI.revive(rootUri) : undefined, inputBoxTextModelRef.object.textEditorModel, this.quickDiffService, this._uriIdentService, this.workspaceContextService);
const provider = new MainThreadSCMProvider(this._proxy, handle, id, label, rootUri ? URI.revive(rootUri) : undefined, inputBoxTextModelRef.object.textEditorModel, this.quickDiffService, this._uriIdentService, this.workspaceContextService, this.logService);
const repository = this.scmService.registerSCMProvider(provider);
this._repositories.set(handle, repository);

View file

@ -647,7 +647,9 @@ class ExtHostSourceControl implements vscode.SourceControl {
}
set statusBarCommands(statusBarCommands: vscode.Command[] | undefined) {
this.logService.info('ExtHostSourceControl#statusBarCommands', (statusBarCommands ?? []).map(c => c.command).join(', '));
if (this._statusBarCommands && statusBarCommands && commandListEquals(this._statusBarCommands, statusBarCommands)) {
this.logService.info('ExtHostSourceControl#statusBarCommands are equal');
return;
}
@ -675,6 +677,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
_extHostDocuments: ExtHostDocuments,
proxy: MainThreadSCMShape,
private _commands: ExtHostCommands,
private readonly logService: ILogService,
private _id: string,
private _label: string,
private _rootUri?: vscode.Uri
@ -854,7 +857,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
});
const handle = ExtHostSCM._handlePool++;
const sourceControl = new ExtHostSourceControl(extension, this._extHostDocuments, this._proxy, this._commands, id, label, rootUri);
const sourceControl = new ExtHostSourceControl(extension, this._extHostDocuments, this._proxy, this._commands, this.logService, id, label, rootUri);
this._sourceControls.set(handle, sourceControl);
const sourceControls = this._sourceControlsByExtension.get(extension.identifier) || [];

View file

@ -27,6 +27,7 @@ import { observableConfigValue } from 'vs/platform/observable/common/platformObs
import { derivedObservableWithCache, latestChangedValue, observableFromEventOpts } from 'vs/base/common/observableInternal/utils';
import { Command } from 'vs/editor/common/languages';
import { ISCMHistoryItemGroup } from 'vs/workbench/contrib/scm/common/history';
import { ILogService } from 'vs/platform/log/common/log';
export class SCMActiveRepositoryController extends Disposable implements IWorkbenchContribution {
private readonly _countBadgeConfig = observableConfigValue<'all' | 'focused' | 'off'>('scm.countBadge', 'all', this.configurationService);
@ -99,6 +100,7 @@ export class SCMActiveRepositoryController extends Disposable implements IWorkbe
@IConfigurationService private readonly configurationService: IConfigurationService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IEditorService private readonly editorService: IEditorService,
@ILogService private readonly logService: ILogService,
@ISCMService private readonly scmService: ISCMService,
@ISCMViewService private readonly scmViewService: ISCMViewService,
@IStatusbarService private readonly statusbarService: IStatusbarService,
@ -118,9 +120,24 @@ export class SCMActiveRepositoryController extends Disposable implements IWorkbe
this._updateActivityCountBadge(this._countBadge.read(reader), store);
}));
this._register(autorun(reader => {
const repository = this._focusedRepository.read(reader);
const commands = repository?.provider.statusBarCommands.read(reader) ?? [];
this.logService.info('SCMActiveRepositoryController (focusedRepository):', commands.map(c => c.title).join(', '));
}));
this._register(autorun(reader => {
const repository = this._activeEditorRepository.read(reader);
const commands = repository?.provider.statusBarCommands.read(reader) ?? [];
this.logService.info('SCMActiveRepositoryController (activeEditorRepository):', commands.map(c => c.title).join(', '));
}));
this._register(autorunWithStore((reader, store) => {
const repository = this._activeRepository.read(reader);
const commands = repository?.provider.statusBarCommands.read(reader) ?? [];
this.logService.info('SCMActiveRepositoryController (status bar):', commands.map(c => c.title).join(', '));
this._updateStatusBar(repository, commands, store);
}));
@ -148,6 +165,7 @@ export class SCMActiveRepositoryController extends Disposable implements IWorkbe
private _updateStatusBar(repository: ISCMRepository | undefined, commands: readonly Command[], store: DisposableStore): void {
if (!repository) {
this.logService.info('SCMActiveRepositoryController (status bar): repository is undefined');
return;
}