From d7ee56c4a5436eed4fb3c8520896ae79ae8c2c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 9 Nov 2021 13:27:29 +0100 Subject: [PATCH 1/8] style: :lipstick: --- src/vs/base/browser/ui/table/tableWidget.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/vs/base/browser/ui/table/tableWidget.ts b/src/vs/base/browser/ui/table/tableWidget.ts index c6c174c0d4b..0bb72ca5e6b 100644 --- a/src/vs/base/browser/ui/table/tableWidget.ts +++ b/src/vs/base/browser/ui/table/tableWidget.ts @@ -9,7 +9,7 @@ import { IListOptions, IListOptionsUpdate, IListStyles, List } from 'vs/base/bro import { ISplitViewDescriptor, IView, Orientation, SplitView } from 'vs/base/browser/ui/splitview/splitview'; import { ITableColumn, ITableContextMenuEvent, ITableEvent, ITableGestureEvent, ITableMouseEvent, ITableRenderer, ITableTouchEvent, ITableVirtualDelegate } from 'vs/base/browser/ui/table/table'; import { Emitter, Event } from 'vs/base/common/event'; -import { IDisposable } from 'vs/base/common/lifecycle'; +import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle'; import { ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable'; import { ISpliceable } from 'vs/base/common/sequence'; import { IThemable } from 'vs/base/common/styler'; @@ -148,9 +148,9 @@ export class Table implements ISpliceable, IThemable, IDisposable { readonly domNode: HTMLElement; private splitview: SplitView; private list: List; - private columnLayoutDisposable: IDisposable; private cachedHeight: number = 0; private styleElement: HTMLStyleElement; + private disposables = new DisposableStore(); get onDidChangeFocus(): Event> { return this.list.onDidChangeFocus; } get onDidChangeSelection(): Event> { return this.list.onDidChangeSelection; } @@ -196,21 +196,21 @@ export class Table implements ISpliceable, IThemable, IDisposable { views: headers.map(view => ({ size: view.column.weight, view })) }; - this.splitview = new SplitView(this.domNode, { + this.splitview = this.disposables.add(new SplitView(this.domNode, { orientation: Orientation.HORIZONTAL, scrollbarVisibility: ScrollbarVisibility.Hidden, getSashOrthogonalSize: () => this.cachedHeight, descriptor - }); + })); this.splitview.el.style.height = `${virtualDelegate.headerRowHeight}px`; this.splitview.el.style.lineHeight = `${virtualDelegate.headerRowHeight}px`; const renderer = new TableListRenderer(columns, renderers, i => this.splitview.getViewSize(i)); - this.list = new List(user, this.domNode, asListVirtualDelegate(virtualDelegate), [renderer], _options); + this.list = this.disposables.add(new List(user, this.domNode, asListVirtualDelegate(virtualDelegate), [renderer], _options)); - this.columnLayoutDisposable = Event.any(...headers.map(h => h.onDidLayout)) - (([index, size]) => renderer.layoutColumn(index, size)); + Event.any(...headers.map(h => h.onDidLayout)) + (([index, size]) => renderer.layoutColumn(index, size), null, this.disposables); this.styleElement = createStyleSheet(this.domNode); this.style({}); @@ -337,8 +337,6 @@ export class Table implements ISpliceable, IThemable, IDisposable { } dispose(): void { - this.splitview.dispose(); - this.list.dispose(); - this.columnLayoutDisposable.dispose(); + this.disposables.dispose(); } } From 1c230ef1e3985ece7b1bf9b1e3d37bae437b9732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 9 Nov 2021 15:01:30 +0100 Subject: [PATCH 2/8] fix(table): :bug: double clicking sashes should restore column's size Closes: #117398 --- src/vs/base/browser/ui/table/tableWidget.ts | 13 +++++++++++-- src/vs/platform/list/browser/listService.ts | 2 -- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/vs/base/browser/ui/table/tableWidget.ts b/src/vs/base/browser/ui/table/tableWidget.ts index 0bb72ca5e6b..eb298a582c7 100644 --- a/src/vs/base/browser/ui/table/tableWidget.ts +++ b/src/vs/base/browser/ui/table/tableWidget.ts @@ -148,9 +148,11 @@ export class Table implements ISpliceable, IThemable, IDisposable { readonly domNode: HTMLElement; private splitview: SplitView; private list: List; - private cachedHeight: number = 0; private styleElement: HTMLStyleElement; - private disposables = new DisposableStore(); + protected readonly disposables = new DisposableStore(); + + private cachedWidth: number = 0; + private cachedHeight: number = 0; get onDidChangeFocus(): Event> { return this.list.onDidChangeFocus; } get onDidChangeSelection(): Event> { return this.list.onDidChangeSelection; } @@ -212,6 +214,12 @@ export class Table implements ISpliceable, IThemable, IDisposable { Event.any(...headers.map(h => h.onDidLayout)) (([index, size]) => renderer.layoutColumn(index, size), null, this.disposables); + this.splitview.onDidSashReset(index => { + const totalWeight = columns.reduce((r, c) => r + c.weight, 0); + const size = columns[index].weight / totalWeight * this.cachedWidth; + this.splitview.resizeView(index, size); + }, null, this.disposables); + this.styleElement = createStyleSheet(this.domNode); this.style({}); } @@ -248,6 +256,7 @@ export class Table implements ISpliceable, IThemable, IDisposable { height = height ?? getContentHeight(this.domNode); width = width ?? getContentWidth(this.domNode); + this.cachedWidth = width; this.cachedHeight = height; this.splitview.layout(width); diff --git a/src/vs/platform/list/browser/listService.ts b/src/vs/platform/list/browser/listService.ts index 875f8dc075f..3c14449399f 100644 --- a/src/vs/platform/list/browser/listService.ts +++ b/src/vs/platform/list/browser/listService.ts @@ -484,7 +484,6 @@ export class WorkbenchTable extends Table { private horizontalScrolling: boolean | undefined; private _styler: IDisposable | undefined; private _useAltAsMultipleSelectionModifier: boolean; - private readonly disposables: DisposableStore; private navigator: TableResourceNavigator; get onDidOpen(): Event> { return this.navigator.onDidOpen; } @@ -513,7 +512,6 @@ export class WorkbenchTable extends Table { } ); - this.disposables = new DisposableStore(); this.disposables.add(workbenchListOptionsDisposable); this.contextKeyService = createScopedContextKeyService(contextKeyService, this); From f18b29e132039246caebd4c6b52fcff06265c04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 9 Nov 2021 15:11:11 +0100 Subject: [PATCH 3/8] fix(scm): :bug: do not await git repo status, just give the repo straight up to scm on repo discovery, the git extension would run `git status` and wait for that to finish before handing out the repository to scm. this was problematic since the scm default repo selection depends on repos being discovered in a timely fashion. there's no reason not to just hand out the repo to scm and let `git status` finish afterwards Closes: #120089 Closes: #113803 --- extensions/git/src/model.ts | 2 +- .../workbench/contrib/scm/browser/scmViewService.ts | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index 9a2f9197378..a57e5f73fac 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -300,7 +300,7 @@ export class Model implements IRemoteSourceProviderRegistry, IPushErrorHandlerRe const repository = new Repository(this.git.open(repositoryRoot, dotGit), this, this, this.globalState, this.outputChannel); this.open(repository); - await repository.status(); + repository.status(); // do not await this, we want SCM to know about the repo asap } catch (ex) { // noop this.outputChannel.appendLine(`Opening repository for path='${repoPath}' failed; ex=${ex}`); diff --git a/src/vs/workbench/contrib/scm/browser/scmViewService.ts b/src/vs/workbench/contrib/scm/browser/scmViewService.ts index f157881dc8c..6b4f6b471ad 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewService.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewService.ts @@ -100,8 +100,7 @@ export class SCMViewService implements ISCMViewService { constructor( @ISCMService private readonly scmService: ISCMService, @IInstantiationService instantiationService: IInstantiationService, - @IStorageService private readonly storageService: IStorageService, - @ILogService private readonly logService: ILogService + @IStorageService private readonly storageService: IStorageService ) { this.menus = instantiationService.createInstance(SCMMenus); @@ -123,8 +122,6 @@ export class SCMViewService implements ISCMViewService { } private onDidAddRepository(repository: ISCMRepository): void { - this.logService.trace('SCMViewService#onDidAddRepository', getProviderStorageKey(repository.provider)); - if (!this.didFinishLoading) { this.eventuallyFinishLoading(); } @@ -135,8 +132,6 @@ export class SCMViewService implements ISCMViewService { const index = this.previousState.all.indexOf(getProviderStorageKey(repository.provider)); if (index === -1) { // saw a repo we did not expect - this.logService.trace('SCMViewService#onDidAddRepository', 'This is a new repository, so we stop the heuristics'); - const added: ISCMRepository[] = []; for (const repo of this.scmService.repositories) { // all should be visible if (!this._visibleRepositoriesSet.has(repo)) { @@ -179,8 +174,6 @@ export class SCMViewService implements ISCMViewService { } private onDidRemoveRepository(repository: ISCMRepository): void { - this.logService.trace('SCMViewService#onDidRemoveRepository', getProviderStorageKey(repository.provider)); - if (!this.didFinishLoading) { this.eventuallyFinishLoading(); } @@ -257,7 +250,6 @@ export class SCMViewService implements ISCMViewService { @debounce(2000) private eventuallyFinishLoading(): void { - this.logService.trace('SCMViewService#eventuallyFinishLoading'); this.finishLoading(); } @@ -266,7 +258,6 @@ export class SCMViewService implements ISCMViewService { return; } - this.logService.trace('SCMViewService#finishLoading'); this.didFinishLoading = true; this.previousState = undefined; } From bf14040d7f81af2b4d0936682cc2416b492b7678 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Tue, 9 Nov 2021 15:11:56 +0100 Subject: [PATCH 4/8] Fix #136732 --- .../contrib/logs/common/logs.contribution.ts | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/logs/common/logs.contribution.ts b/src/vs/workbench/contrib/logs/common/logs.contribution.ts index 20eabfbdff4..aef0c3f87a1 100644 --- a/src/vs/workbench/contrib/logs/common/logs.contribution.ts +++ b/src/vs/workbench/contrib/logs/common/logs.contribution.ts @@ -15,7 +15,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/ import { IFileService, whenProviderRegistered } from 'vs/platform/files/common/files'; import { URI } from 'vs/base/common/uri'; import { IOutputChannelRegistry, Extensions as OutputExt } from 'vs/workbench/services/output/common/output'; -import { Disposable } from 'vs/base/common/lifecycle'; +import { Disposable, toDisposable } from 'vs/base/common/lifecycle'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { isWeb } from 'vs/base/common/platform'; @@ -24,8 +24,9 @@ import { LogsDataCleaner } from 'vs/workbench/contrib/logs/common/logsDataCleane import { IOutputService } from 'vs/workbench/contrib/output/common/output'; import { supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; import { IProductService } from 'vs/platform/product/common/productService'; -import { timeout } from 'vs/base/common/async'; -import { getErrorMessage } from 'vs/base/common/errors'; +import { createCancelablePromise, timeout } from 'vs/base/common/async'; +import { canceled, getErrorMessage, isPromiseCanceledError } from 'vs/base/common/errors'; +import { CancellationToken } from 'vs/base/common/cancellation'; const workbenchActionsRegistry = Registry.as(WorkbenchActionExtensions.WorkbenchActions); workbenchActionsRegistry.registerWorkbenchAction(SyncActionDescriptor.from(SetLogLevelAction), 'Developer: Set Log Level...', CATEGORIES.Developer.value); @@ -99,24 +100,31 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution { await whenProviderRegistered(file, this.fileService); const outputChannelRegistry = Registry.as(OutputExt.OutputChannels); try { - await this.whenFileExists(file, 1); + const promise = createCancelablePromise(token => this.whenFileExists(file, 1, token)); + this._register(toDisposable(() => promise.cancel())); + await promise; outputChannelRegistry.registerChannel({ id, label, file, log: true }); } catch (error) { - this.logService.error('Error while registering log channel', file.toString(), getErrorMessage(error)); + if (!isPromiseCanceledError(error)) { + this.logService.error('Error while registering log channel', file.toString(), getErrorMessage(error)); + } } } - private async whenFileExists(file: URI, trial: number): Promise { + private async whenFileExists(file: URI, trial: number, token: CancellationToken): Promise { const exists = await this.fileService.exists(file); if (exists) { return; } + if (token.isCancellationRequested) { + throw canceled(); + } if (trial > 10) { throw new Error(`Timed out while waiting for file to be created`); } this.logService.debug(`[Registering Log Channel] File does not exist. Waiting for 1s to retry.`, file.toString()); - await timeout(1000); - await this.whenFileExists(file, trial + 1); + await timeout(1000, token); + await this.whenFileExists(file, trial + 1, token); } } From 7a938550cf6a975ba3975dc7e932557b601252c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 9 Nov 2021 15:34:19 +0100 Subject: [PATCH 5/8] refactor: :coffin: remove dead code --- src/vs/base/browser/ui/sash/sash.ts | 18 ------------------ src/vs/editor/contrib/zoneWidget/zoneWidget.ts | 1 - 2 files changed, 19 deletions(-) diff --git a/src/vs/base/browser/ui/sash/sash.ts b/src/vs/base/browser/ui/sash/sash.ts index 334b238ed94..aa9bcfffc0a 100644 --- a/src/vs/base/browser/ui/sash/sash.ts +++ b/src/vs/base/browser/ui/sash/sash.ts @@ -163,7 +163,6 @@ export class Sash extends Disposable { private el: HTMLElement; private layoutProvider: ISashLayoutProvider; - private hidden: boolean; private orientation!: Orientation; private size: number; private hoverDelay = globalHoverDelay; @@ -317,7 +316,6 @@ export class Sash extends Disposable { this._register(onDidChangeHoverDelay.event(delay => this.hoverDelay = delay)); - this.hidden = false; this.layoutProvider = layoutProvider; this.orthogonalStartSash = options.orthogonalStartSash; @@ -504,22 +502,6 @@ export class Sash extends Disposable { } } - show(): void { - this.hidden = false; - this.el.style.removeProperty('display'); - this.el.setAttribute('aria-hidden', 'false'); - } - - hide(): void { - this.hidden = true; - this.el.style.display = 'none'; - this.el.setAttribute('aria-hidden', 'true'); - } - - isHidden(): boolean { - return this.hidden; - } - private getOrthogonalSash(e: PointerEvent): Sash | undefined { if (!e.target || !(e.target instanceof HTMLElement)) { return undefined; diff --git a/src/vs/editor/contrib/zoneWidget/zoneWidget.ts b/src/vs/editor/contrib/zoneWidget/zoneWidget.ts index cf1a2e73370..671f8e39ad3 100644 --- a/src/vs/editor/contrib/zoneWidget/zoneWidget.ts +++ b/src/vs/editor/contrib/zoneWidget/zoneWidget.ts @@ -491,7 +491,6 @@ export abstract class ZoneWidget implements IHorizontalSashLayoutProvider { this._resizeSash = this._disposables.add(new Sash(this.domNode, this, { orientation: Orientation.HORIZONTAL })); if (!this.options.isResizeable) { - this._resizeSash.hide(); this._resizeSash.state = SashState.Disabled; } From 5417e2aea2cd107054784e5c85a544c8be53c650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Tue, 9 Nov 2021 15:37:02 +0100 Subject: [PATCH 6/8] remove unused import --- src/vs/workbench/contrib/scm/browser/scmViewService.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/vs/workbench/contrib/scm/browser/scmViewService.ts b/src/vs/workbench/contrib/scm/browser/scmViewService.ts index 6b4f6b471ad..78ac23a1588 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewService.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewService.ts @@ -11,7 +11,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { SCMMenus } from 'vs/workbench/contrib/scm/browser/menus'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { debounce } from 'vs/base/common/decorators'; -import { ILogService } from 'vs/platform/log/common/log'; function getProviderStorageKey(provider: ISCMProvider): string { return `${provider.contextValue}:${provider.label}${provider.rootUri ? `:${provider.rootUri.toString()}` : ''}`; From 4b5611b433460a6e2735c8d50756045de127fb5b Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 9 Nov 2021 15:40:23 +0100 Subject: [PATCH 7/8] fix #136734 --- .../workbench/electron-sandbox/parts/dialogs/dialogHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts b/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts index 40094f38189..a4728e73b7d 100644 --- a/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts +++ b/src/vs/workbench/electron-sandbox/parts/dialogs/dialogHandler.ts @@ -166,8 +166,8 @@ export class NativeDialogHandler implements IDialogHandler { const osProps = await this.nativeHostService.getOSProperties(); const detailString = (useAgo: boolean): string => { - return localize({ key: 'aboutDetail', comment: ['Electron, Chrome, Node.js and V8 are product names that need no translation'] }, - "Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChrome: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}", + return localize({ key: 'aboutDetail', comment: ['Electron, Chromium, Node.js and V8 are product names that need no translation'] }, + "Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChromium: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}", version, this.productService.commit || 'Unknown', this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown', From 93ce4397a2cbc88707c3ed8b34a813b87457568c Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Tue, 9 Nov 2021 15:47:17 +0100 Subject: [PATCH 8/8] Bump distro --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e0c2e6edd8..ea5df190b60 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.63.0", - "distro": "f4a21145f5ec390f681f48c7140bf4f60d2987ac", + "distro": "58644f0352f74eff29f9d920573b8e6fffb1cfac", "author": { "name": "Microsoft Corporation" },