mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)
* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 * disable strict null check
This commit is contained in:
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
|
||||
|
||||
import 'vs/css!./media/dirtydiffDecorator';
|
||||
import { ThrottledDelayer, first } from 'vs/base/common/async';
|
||||
import { IDisposable, dispose, toDisposable, Disposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, toDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as ext from 'vs/workbench/common/contributions';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
@@ -39,7 +39,7 @@ import { IActionBarOptions, ActionsOrientation, IActionViewItem } from 'vs/base/
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { MenuId, IMenuService, IMenu, MenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { fillInActionBarActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { createAndFillInActionBarActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { IChange, IEditorModel, ScrollType, IEditorContribution, IDiffEditorModel } from 'vs/editor/common/editorCommon';
|
||||
import { OverviewRulerLane, ITextModel, IModelDecorationOptions } from 'vs/editor/common/model';
|
||||
import { sortedDiff, firstIndex } from 'vs/base/common/arrays';
|
||||
@@ -184,7 +184,7 @@ class DirtyDiffWidget extends PeekViewWidget {
|
||||
) {
|
||||
super(editor, { isResizeable: true, frameWidth: 1, keepEditorSelection: true });
|
||||
|
||||
themeService.onThemeChange(this._applyTheme, this, this._disposables);
|
||||
this._disposables.add(themeService.onThemeChange(this._applyTheme, this));
|
||||
this._applyTheme(themeService.getTheme());
|
||||
|
||||
this.contextKeyService = contextKeyService.createScoped();
|
||||
@@ -199,7 +199,7 @@ class DirtyDiffWidget extends PeekViewWidget {
|
||||
}
|
||||
this.setTitle(this.title);
|
||||
|
||||
model.onDidChange(this.renderTitle, this, this._disposables);
|
||||
this._disposables.add(model.onDidChange(this.renderTitle, this));
|
||||
}
|
||||
|
||||
showChange(index: number): void {
|
||||
@@ -253,12 +253,12 @@ class DirtyDiffWidget extends PeekViewWidget {
|
||||
const previous = this.instantiationService.createInstance(UIEditorAction, this.editor, new ShowPreviousChangeAction(), 'show-previous-change chevron-up');
|
||||
const next = this.instantiationService.createInstance(UIEditorAction, this.editor, new ShowNextChangeAction(), 'show-next-change chevron-down');
|
||||
|
||||
this._disposables.push(previous);
|
||||
this._disposables.push(next);
|
||||
this._disposables.add(previous);
|
||||
this._disposables.add(next);
|
||||
this._actionbarWidget.push([previous, next], { label: false, icon: true });
|
||||
|
||||
const actions: IAction[] = [];
|
||||
fillInActionBarActions(this.menu, { shouldForwardArgs: true }, actions);
|
||||
this._disposables.add(createAndFillInActionBarActions(this.menu, { shouldForwardArgs: true }, actions));
|
||||
this._actionbarWidget.push(actions, { label: false, icon: true });
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
}
|
||||
});
|
||||
|
||||
export class DirtyDiffController implements IEditorContribution {
|
||||
export class DirtyDiffController extends Disposable implements IEditorContribution {
|
||||
|
||||
private static readonly ID = 'editor.contrib.dirtydiff';
|
||||
|
||||
@@ -571,20 +571,20 @@ export class DirtyDiffController implements IEditorContribution {
|
||||
private session: IDisposable = Disposable.None;
|
||||
private mouseDownInfo: { lineNumber: number } | null = null;
|
||||
private enabled = false;
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(
|
||||
private editor: ICodeEditor,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService
|
||||
) {
|
||||
super();
|
||||
this.enabled = !contextKeyService.getContextKeyValue('isInDiffEditor');
|
||||
|
||||
if (this.enabled) {
|
||||
this.isDirtyDiffVisible = isDirtyDiffVisible.bindTo(contextKeyService);
|
||||
this.disposables.push(editor.onMouseDown(e => this.onEditorMouseDown(e)));
|
||||
this.disposables.push(editor.onMouseUp(e => this.onEditorMouseUp(e)));
|
||||
this.disposables.push(editor.onDidChangeModel(() => this.close()));
|
||||
this._register(editor.onMouseDown(e => this.onEditorMouseDown(e)));
|
||||
this._register(editor.onMouseUp(e => this.onEditorMouseUp(e)));
|
||||
this._register(editor.onDidChangeModel(() => this.close()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,22 +674,20 @@ export class DirtyDiffController implements IEditorContribution {
|
||||
this.widget = this.instantiationService.createInstance(DirtyDiffWidget, this.editor, model);
|
||||
this.isDirtyDiffVisible.set(true);
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
Event.once(this.widget.onDidClose)(this.close, this, disposables);
|
||||
model.onDidChange(this.onDidModelChange, this, disposables);
|
||||
const disposables = new DisposableStore();
|
||||
disposables.add(Event.once(this.widget.onDidClose)(this.close, this));
|
||||
disposables.add(model.onDidChange(this.onDidModelChange, this));
|
||||
|
||||
disposables.push(
|
||||
this.widget,
|
||||
toDisposable(() => {
|
||||
this.model = null;
|
||||
this.widget = null;
|
||||
this.currentIndex = -1;
|
||||
this.isDirtyDiffVisible.set(false);
|
||||
this.editor.focus();
|
||||
})
|
||||
);
|
||||
disposables.add(this.widget);
|
||||
disposables.add(toDisposable(() => {
|
||||
this.model = null;
|
||||
this.widget = null;
|
||||
this.currentIndex = -1;
|
||||
this.isDirtyDiffVisible.set(false);
|
||||
this.editor.focus();
|
||||
}));
|
||||
|
||||
this.session = combinedDisposable(disposables);
|
||||
this.session = disposables;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -808,10 +806,6 @@ export class DirtyDiffController implements IEditorContribution {
|
||||
|
||||
return model.changes;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
}
|
||||
}
|
||||
|
||||
export const editorGutterModifiedBackground = registerColor('editorGutter.modifiedBackground', {
|
||||
@@ -837,7 +831,7 @@ export const overviewRulerModifiedForeground = registerColor('editorOverviewRule
|
||||
export const overviewRulerAddedForeground = registerColor('editorOverviewRuler.addedForeground', { dark: overviewRulerDefault, light: overviewRulerDefault, hc: overviewRulerDefault }, nls.localize('overviewRulerAddedForeground', 'Overview ruler marker color for added content.'));
|
||||
export const overviewRulerDeletedForeground = registerColor('editorOverviewRuler.deletedForeground', { dark: overviewRulerDefault, light: overviewRulerDefault, hc: overviewRulerDefault }, nls.localize('overviewRulerDeletedForeground', 'Overview ruler marker color for deleted content.'));
|
||||
|
||||
class DirtyDiffDecorator {
|
||||
class DirtyDiffDecorator extends Disposable {
|
||||
|
||||
static createDecoration(className: string, foregroundColor: string, options: { gutter: boolean, overview: boolean, isWholeLine: boolean }): ModelDecorationOptions {
|
||||
const decorationOptions: IModelDecorationOptions = {
|
||||
@@ -862,7 +856,6 @@ class DirtyDiffDecorator {
|
||||
private addedOptions: ModelDecorationOptions;
|
||||
private deletedOptions: ModelDecorationOptions;
|
||||
private decorations: string[] = [];
|
||||
private disposables: IDisposable[] = [];
|
||||
private editorModel: ITextModel | null;
|
||||
|
||||
constructor(
|
||||
@@ -870,6 +863,7 @@ class DirtyDiffDecorator {
|
||||
private model: DirtyDiffModel,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
this.editorModel = editorModel;
|
||||
const decorations = configurationService.getValue<string>('scm.diffDecorations');
|
||||
const gutter = decorations === 'all' || decorations === 'gutter';
|
||||
@@ -880,7 +874,7 @@ class DirtyDiffDecorator {
|
||||
this.addedOptions = DirtyDiffDecorator.createDecoration('dirty-diff-added', overviewRulerAddedForeground, options);
|
||||
this.deletedOptions = DirtyDiffDecorator.createDecoration('dirty-diff-deleted', overviewRulerDeletedForeground, { ...options, isWholeLine: false });
|
||||
|
||||
model.onDidChange(this.onDidChange, this, this.disposables);
|
||||
this._register(model.onDidChange(this.onDidChange, this));
|
||||
}
|
||||
|
||||
private onDidChange(): void {
|
||||
@@ -924,7 +918,7 @@ class DirtyDiffDecorator {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
|
||||
if (this.editorModel && !this.editorModel.isDisposed()) {
|
||||
this.editorModel.deltaDecorations(this.decorations, []);
|
||||
@@ -957,7 +951,7 @@ function compareChanges(a: IChange, b: IChange): number {
|
||||
return a.originalEndLineNumber - b.originalEndLineNumber;
|
||||
}
|
||||
|
||||
export class DirtyDiffModel {
|
||||
export class DirtyDiffModel extends Disposable {
|
||||
|
||||
private _originalModel: ITextModel | null;
|
||||
get original(): ITextModel | null { return this._originalModel; }
|
||||
@@ -965,9 +959,8 @@ export class DirtyDiffModel {
|
||||
|
||||
private diffDelayer: ThrottledDelayer<IChange[] | null> | null;
|
||||
private _originalURIPromise?: Promise<URI | null>;
|
||||
private repositoryDisposables = new Set<IDisposable[]>();
|
||||
private originalModelDisposables: IDisposable[] = [];
|
||||
private disposables: IDisposable[] = [];
|
||||
private repositoryDisposables = new Set<IDisposable>();
|
||||
private readonly originalModelDisposables = this._register(new DisposableStore());
|
||||
|
||||
private _onDidChange = new Emitter<ISplice<IChange>[]>();
|
||||
readonly onDidChange: Event<ISplice<IChange>[]> = this._onDidChange.event;
|
||||
@@ -985,27 +978,28 @@ export class DirtyDiffModel {
|
||||
@IEditorWorkerService private readonly editorWorkerService: IEditorWorkerService,
|
||||
@ITextModelService private readonly textModelResolverService: ITextModelService
|
||||
) {
|
||||
super();
|
||||
this._editorModel = editorModel;
|
||||
this.diffDelayer = new ThrottledDelayer<IChange[]>(200);
|
||||
|
||||
this.disposables.push(editorModel.onDidChangeContent(() => this.triggerDiff()));
|
||||
scmService.onDidAddRepository(this.onDidAddRepository, this, this.disposables);
|
||||
this._register(editorModel.onDidChangeContent(() => this.triggerDiff()));
|
||||
this._register(scmService.onDidAddRepository(this.onDidAddRepository, this));
|
||||
scmService.repositories.forEach(r => this.onDidAddRepository(r));
|
||||
|
||||
this.triggerDiff();
|
||||
}
|
||||
|
||||
private onDidAddRepository(repository: ISCMRepository): void {
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
this.repositoryDisposables.add(disposables);
|
||||
disposables.push(toDisposable(() => this.repositoryDisposables.delete(disposables)));
|
||||
disposables.add(toDisposable(() => this.repositoryDisposables.delete(disposables)));
|
||||
|
||||
const onDidChange = Event.any(repository.provider.onDidChange, repository.provider.onDidChangeResources);
|
||||
onDidChange(this.triggerDiff, this, disposables);
|
||||
disposables.add(onDidChange(this.triggerDiff, this));
|
||||
|
||||
const onDidRemoveThis = Event.filter(this.scmService.onDidRemoveRepository, r => r === repository);
|
||||
onDidRemoveThis(() => dispose(disposables), null, disposables);
|
||||
disposables.add(onDidRemoveThis(() => dispose(disposables), null));
|
||||
|
||||
this.triggerDiff();
|
||||
}
|
||||
@@ -1075,12 +1069,9 @@ export class DirtyDiffModel {
|
||||
|
||||
this._originalModel = ref.object.textEditorModel;
|
||||
|
||||
const originalModelDisposables: IDisposable[] = [];
|
||||
originalModelDisposables.push(ref);
|
||||
originalModelDisposables.push(ref.object.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
||||
|
||||
dispose(this.originalModelDisposables);
|
||||
this.originalModelDisposables = originalModelDisposables;
|
||||
this.originalModelDisposables.clear();
|
||||
this.originalModelDisposables.add(ref);
|
||||
this.originalModelDisposables.add(ref.object.textEditorModel.onDidChangeContent(() => this.triggerDiff()));
|
||||
|
||||
return originalUri;
|
||||
});
|
||||
@@ -1137,8 +1128,7 @@ export class DirtyDiffModel {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.originalModelDisposables = dispose(this.originalModelDisposables);
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
|
||||
this._editorModel = null;
|
||||
this._originalModel = null;
|
||||
@@ -1163,25 +1153,25 @@ class DirtyDiffItem {
|
||||
}
|
||||
}
|
||||
|
||||
export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution, IModelRegistry {
|
||||
export class DirtyDiffWorkbenchController extends Disposable implements ext.IWorkbenchContribution, IModelRegistry {
|
||||
|
||||
private enabled = false;
|
||||
private models: ITextModel[] = [];
|
||||
private items: { [modelId: string]: DirtyDiffItem; } = Object.create(null);
|
||||
private transientDisposables: IDisposable[] = [];
|
||||
private readonly transientDisposables = this._register(new DisposableStore());
|
||||
private stylesheet: HTMLStyleElement;
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
this.stylesheet = createStyleSheet();
|
||||
this.disposables.push(toDisposable(() => this.stylesheet.parentElement!.removeChild(this.stylesheet)));
|
||||
this._register(toDisposable(() => this.stylesheet.parentElement!.removeChild(this.stylesheet)));
|
||||
|
||||
const onDidChangeConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorations'));
|
||||
onDidChangeConfiguration(this.onDidChangeConfiguration, this, this.disposables);
|
||||
this._register(onDidChangeConfiguration(this.onDidChangeConfiguration, this));
|
||||
this.onDidChangeConfiguration();
|
||||
|
||||
const onDidChangeDiffWidthConfiguration = Event.filter(configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.diffDecorationsGutterWidth'));
|
||||
@@ -1214,7 +1204,7 @@ export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution,
|
||||
this.disable();
|
||||
}
|
||||
|
||||
this.transientDisposables.push(this.editorService.onDidVisibleEditorsChange(() => this.onEditorsChanged()));
|
||||
this.transientDisposables.add(this.editorService.onDidVisibleEditorsChange(() => this.onEditorsChanged()));
|
||||
this.onEditorsChanged();
|
||||
this.enabled = true;
|
||||
}
|
||||
@@ -1224,7 +1214,7 @@ export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution,
|
||||
return;
|
||||
}
|
||||
|
||||
this.transientDisposables = dispose(this.transientDisposables);
|
||||
this.transientDisposables.clear();
|
||||
this.models.forEach(m => this.items[m.id].dispose());
|
||||
this.models = [];
|
||||
this.items = Object.create(null);
|
||||
@@ -1284,7 +1274,7 @@ export class DirtyDiffWorkbenchController implements ext.IWorkbenchContribution,
|
||||
|
||||
dispose(): void {
|
||||
this.disable();
|
||||
this.disposables = dispose(this.disposables);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg fill="none" height="28" viewBox="0 0 28 28" width="28" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="m20 0c-2.22 0-4 1.78-4 4 0 1.46.82 2.76 2 3.44v2.56l-4 4-4-4v-2.56c1.18-.68 2-1.96 2-3.44 0-2.22-1.78-4-4-4s-4 1.78-4 4c0 1.46.82 2.76 2 3.44v3.56l6 6v3.56c-1.18.68-2 1.96-2 3.44 0 2.22 1.78 4 4 4s4-1.78 4-4c0-1.46-.82-2.76-2-3.44v-3.56l6-6v-3.56c1.18-.68 2-1.96 2-3.44 0-2.22-1.78-4-4-4zm-12 6.4c-1.32 0-2.4-1.1-2.4-2.4s1.1-2.4 2.4-2.4 2.4 1.1 2.4 2.4-1.1 2.4-2.4 2.4zm6 20c-1.32 0-2.4-1.1-2.4-2.4s1.1-2.4 2.4-2.4 2.4 1.1 2.4 2.4-1.1 2.4-2.4 2.4zm6-20c-1.32 0-2.4-1.1-2.4-2.4s1.1-2.4 2.4-2.4 2.4 1.1 2.4 2.4-1.1 2.4-2.4 2.4z" fill="#fff" fill-rule="evenodd"/></svg>
|
||||
|
Before Width: | Height: | Size: 690 B |
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="10px" height="16px" viewBox="0 0 10 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<!-- Generator: Sketch 40.3 (33839) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>repo-forked</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Octicons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="repo-forked" fill="#424242">
|
||||
<path d="M8,1 C6.89,1 6,1.89 6,3 C6,3.73 6.41,4.38 7,4.72 L7,6 L5,8 L3,6 L3,4.72 C3.59,4.38 4,3.74 4,3 C4,1.89 3.11,1 2,1 C0.89,1 0,1.89 0,3 C0,3.73 0.41,4.38 1,4.72 L1,6.5 L4,9.5 L4,11.28 C3.41,11.62 3,12.26 3,13 C3,14.11 3.89,15 5,15 C6.11,15 7,14.11 7,13 C7,12.27 6.59,11.62 6,11.28 L6,9.5 L9,6.5 L9,4.72 C9.59,4.38 10,3.74 10,3 C10,1.89 9.11,1 8,1 L8,1 Z M2,4.2 C1.34,4.2 0.8,3.65 0.8,3 C0.8,2.35 1.35,1.8 2,1.8 C2.65,1.8 3.2,2.35 3.2,3 C3.2,3.65 2.65,4.2 2,4.2 L2,4.2 Z M5,14.2 C4.34,14.2 3.8,13.65 3.8,13 C3.8,12.35 4.35,11.8 5,11.8 C5.65,11.8 6.2,12.35 6.2,13 C6.2,13.65 5.65,14.2 5,14.2 L5,14.2 Z M8,4.2 C7.34,4.2 6.8,3.65 6.8,3 C6.8,2.35 7.35,1.8 8,1.8 C8.65,1.8 9.2,2.35 9.2,3 C9.2,3.65 8.65,4.2 8,4.2 L8,4.2 Z" id="Shape"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 8.25C21.0035 7.55379 20.8131 6.87035 20.4502 6.27622C20.0872 5.68209 19.566 5.20073 18.945 4.88605C18.3239 4.57137 17.6275 4.4358 16.9338 4.49451C16.24 4.55323 15.5764 4.80392 15.017 5.2185C14.4577 5.63308 14.0248 6.19518 13.7669 6.84186C13.509 7.48854 13.4361 8.19426 13.5566 8.87998C13.6771 9.5657 13.986 10.2044 14.4489 10.7244C14.9118 11.2445 15.5104 11.6254 16.1775 11.8245C15.9312 12.3251 15.5501 12.7472 15.0771 13.0432C14.6041 13.3391 14.058 13.4973 13.5 13.5H10.5C9.3894 13.5039 8.32 13.921 7.5 14.67V7.4235C8.41053 7.23764 9.21962 6.72031 9.7704 5.97181C10.3212 5.22331 10.5744 4.29696 10.481 3.37236C10.3876 2.44776 9.95422 1.59077 9.26486 0.96755C8.57551 0.344328 7.67931 -0.000732422 6.75 -0.000732422C5.82069 -0.000732422 4.92449 0.344328 4.23513 0.96755C3.54578 1.59077 3.11239 2.44776 3.01899 3.37236C2.92558 4.29696 3.17882 5.22331 3.7296 5.97181C4.28038 6.72031 5.08947 7.23764 6 7.4235V16.5735C5.09118 16.7473 4.27737 17.2477 3.71208 17.9802C3.14679 18.7128 2.8691 19.6269 2.93137 20.5501C2.99365 21.4733 3.39159 22.3418 4.05014 22.9917C4.70869 23.6417 5.58233 24.0283 6.50626 24.0785C7.4302 24.1287 8.34056 23.839 9.06564 23.2642C9.79073 22.6894 10.2804 21.8691 10.4423 20.9581C10.6042 20.047 10.4272 19.1083 9.94457 18.3188C9.46196 17.5293 8.70715 16.9437 7.8225 16.6725C8.06925 16.1724 8.4505 15.751 8.92346 15.4556C9.39642 15.1601 9.94236 15.0024 10.5 15H13.5C14.436 14.9957 15.3473 14.6996 16.1071 14.153C16.8669 13.6064 17.4373 12.8365 17.739 11.9505C18.6381 11.8323 19.4639 11.3922 20.0635 10.7118C20.6631 10.0314 20.9958 9.15685 21 8.25V8.25ZM4.5 3.75C4.5 3.30499 4.63196 2.86998 4.87919 2.49997C5.12643 2.12996 5.47783 1.84157 5.88896 1.67127C6.3001 1.50098 6.7525 1.45642 7.18895 1.54324C7.62541 1.63005 8.02632 1.84434 8.34099 2.15901C8.65566 2.47368 8.86995 2.87459 8.95677 3.31105C9.04358 3.74751 8.99903 4.19991 8.82873 4.61104C8.65843 5.02217 8.37004 5.37358 8.00003 5.62081C7.63002 5.86804 7.19501 6 6.75 6C6.15326 6 5.58097 5.76295 5.15901 5.34099C4.73705 4.91904 4.5 4.34674 4.5 3.75V3.75ZM9 20.25C9 20.695 8.86804 21.13 8.62081 21.5C8.37357 21.87 8.02217 22.1584 7.61104 22.3287C7.1999 22.499 6.7475 22.5436 6.31105 22.4568C5.87459 22.37 5.47368 22.1557 5.15901 21.841C4.84434 21.5263 4.63005 21.1254 4.54323 20.689C4.45642 20.2525 4.50097 19.8001 4.67127 19.389C4.84157 18.9778 5.12996 18.6264 5.49997 18.3792C5.86998 18.132 6.30499 18 6.75 18C7.34674 18 7.91903 18.2371 8.34099 18.659C8.76295 19.081 9 19.6533 9 20.25ZM17.25 10.5C16.805 10.5 16.37 10.368 16 10.1208C15.63 9.87358 15.3416 9.52217 15.1713 9.11104C15.001 8.69991 14.9564 8.24751 15.0432 7.81105C15.13 7.37459 15.3443 6.97368 15.659 6.65901C15.9737 6.34434 16.3746 6.13005 16.811 6.04324C17.2475 5.95642 17.6999 6.00098 18.111 6.17127C18.5222 6.34157 18.8736 6.62996 19.1208 6.99997C19.368 7.36998 19.5 7.80499 19.5 8.25C19.5 8.84674 19.2629 9.41904 18.841 9.84099C18.419 10.2629 17.8467 10.5 17.25 10.5V10.5Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-workbench .activitybar > .content .monaco-action-bar .action-label.scm {
|
||||
-webkit-mask: url('icon-dark.svg') no-repeat 50% 50%;
|
||||
-webkit-mask: url('scm-activity-bar.svg') no-repeat 50% 50%;
|
||||
}
|
||||
|
||||
.monaco-workbench .viewlet.scm-viewlet .collapsible.header .actions {
|
||||
@@ -73,7 +73,6 @@
|
||||
flex: 1;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { IDisposable, dispose, Disposable, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable, DisposableStore, combinedDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { VIEWLET_ID, ISCMService, ISCMRepository } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
@@ -18,7 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class StatusUpdater implements IWorkbenchContribution {
|
||||
|
||||
private badgeDisposable: IDisposable = Disposable.None;
|
||||
private readonly badgeDisposable = new MutableDisposable<IDisposable>();
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(
|
||||
@@ -46,12 +46,12 @@ export class StatusUpdater implements IWorkbenchContribution {
|
||||
this.render();
|
||||
});
|
||||
|
||||
const disposable = combinedDisposable([changeDisposable, removeDisposable]);
|
||||
const disposable = combinedDisposable(changeDisposable, removeDisposable);
|
||||
this.disposables.push(disposable);
|
||||
}
|
||||
|
||||
private render(): void {
|
||||
this.badgeDisposable.dispose();
|
||||
this.badgeDisposable.clear();
|
||||
|
||||
const count = this.scmService.repositories.reduce((r, repository) => {
|
||||
if (typeof repository.provider.count === 'number') {
|
||||
@@ -66,9 +66,9 @@ export class StatusUpdater implements IWorkbenchContribution {
|
||||
|
||||
if (count > 0) {
|
||||
const badge = new NumberBadge(count, num => localize('scmPendingChangesBadge', '{0} pending changes', num));
|
||||
this.badgeDisposable = this.activityService.showActivity(VIEWLET_ID, badge, 'scm-viewlet-label');
|
||||
this.badgeDisposable.value = this.activityService.showActivity(VIEWLET_ID, badge, 'scm-viewlet-label');
|
||||
} else {
|
||||
this.badgeDisposable = Disposable.None;
|
||||
this.badgeDisposable.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ export class StatusBarController implements IWorkbenchContribution {
|
||||
}
|
||||
});
|
||||
|
||||
const disposable = combinedDisposable([changeDisposable, removeDisposable]);
|
||||
const disposable = combinedDisposable(changeDisposable, removeDisposable);
|
||||
this.disposables.push(disposable);
|
||||
|
||||
if (!this.focusedRepository) {
|
||||
@@ -187,14 +187,17 @@ export class StatusBarController implements IWorkbenchContribution {
|
||||
? `${basename(repository.provider.rootUri)} (${repository.provider.label})`
|
||||
: repository.provider.label;
|
||||
|
||||
const disposables = commands.map(c => this.statusbarService.addEntry({
|
||||
text: c.title,
|
||||
tooltip: `${label} - ${c.tooltip}`,
|
||||
command: c.id,
|
||||
arguments: c.arguments
|
||||
}, MainThreadStatusBarAlignment.LEFT, 10000));
|
||||
const disposables = new DisposableStore();
|
||||
for (const c of commands) {
|
||||
disposables.add(this.statusbarService.addEntry({
|
||||
text: c.title,
|
||||
tooltip: `${label} - ${c.tooltip}`,
|
||||
command: c.id,
|
||||
arguments: c.arguments
|
||||
}, 'status.scm', localize('status.scm', "Source Control"), MainThreadStatusBarAlignment.LEFT, 10000));
|
||||
}
|
||||
|
||||
this.statusBarDisposable = combinedDisposable(disposables);
|
||||
this.statusBarDisposable = disposables;
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
import 'vs/css!./media/scmViewlet';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { fillInContextMenuActions, fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { createAndFillInContextMenuActions, createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { ISCMProvider, ISCMResource, ISCMResourceGroup } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { isSCMResource } from './scmUtil';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -37,6 +37,8 @@ export class SCMMenus implements IDisposable {
|
||||
|
||||
private contextKeyService: IContextKeyService;
|
||||
private titleMenu: IMenu;
|
||||
|
||||
private titleActionDisposable: IDisposable = Disposable.None;
|
||||
private titleActions: IAction[] = [];
|
||||
private titleSecondaryActions: IAction[] = [];
|
||||
|
||||
@@ -76,12 +78,15 @@ export class SCMMenus implements IDisposable {
|
||||
const primary: IAction[] = [];
|
||||
const secondary: IAction[] = [];
|
||||
|
||||
fillInActionBarActions(this.titleMenu, { shouldForwardArgs: true }, { primary, secondary });
|
||||
const disposable = createAndFillInActionBarActions(this.titleMenu, { shouldForwardArgs: true }, { primary, secondary });
|
||||
|
||||
if (equals(primary, this.titleActions, actionEquals) && equals(secondary, this.titleSecondaryActions, actionEquals)) {
|
||||
disposable.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
this.titleActionDisposable.dispose();
|
||||
this.titleActionDisposable = disposable;
|
||||
this.titleActions = primary;
|
||||
this.titleSecondaryActions = secondary;
|
||||
|
||||
@@ -112,7 +117,7 @@ export class SCMMenus implements IDisposable {
|
||||
const primary: IAction[] = [];
|
||||
const secondary: IAction[] = [];
|
||||
const result = { primary, secondary };
|
||||
fillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => /^inline/.test(g));
|
||||
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => /^inline/.test(g));
|
||||
|
||||
menu.dispose();
|
||||
contextKeyService.dispose();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { IDisposable, dispose, combinedDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IDisposable, dispose, Disposable, DisposableStore, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { append, $, addClass, toggleClass, trackFocus, removeClass, addClasses } from 'vs/base/browser/dom';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -25,7 +25,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { MenuItemAction, IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions';
|
||||
import { IAction, Action, IActionViewItem, ActionRunner } from 'vs/base/common/actions';
|
||||
import { fillInContextMenuActions, ContextAwareMenuEntryActionViewItem, fillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { createAndFillInContextMenuActions, ContextAwareMenuEntryActionViewItem, createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { SCMMenus } from './scmMenus';
|
||||
import { ActionBar, IActionViewItemProvider, ActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IThemeService, LIGHT } from 'vs/platform/theme/common/themeService';
|
||||
@@ -108,26 +108,32 @@ class StatusBarActionViewItem extends ActionViewItem {
|
||||
}
|
||||
|
||||
function connectPrimaryMenuToInlineActionBar(menu: IMenu, actionBar: ActionBar): IDisposable {
|
||||
let cachedDisposable: IDisposable = Disposable.None;
|
||||
let cachedPrimary: IAction[] = [];
|
||||
|
||||
const updateActions = () => {
|
||||
const primary: IAction[] = [];
|
||||
const secondary: IAction[] = [];
|
||||
const result = { primary, secondary };
|
||||
|
||||
fillInActionBarActions(menu, { shouldForwardArgs: true }, result, g => /^inline/.test(g));
|
||||
const disposable = createAndFillInActionBarActions(menu, { shouldForwardArgs: true }, { primary, secondary }, g => /^inline/.test(g));
|
||||
|
||||
if (equals(cachedPrimary, primary, (a, b) => a.id === b.id)) {
|
||||
disposable.dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
cachedDisposable = disposable;
|
||||
cachedPrimary = primary;
|
||||
|
||||
actionBar.clear();
|
||||
actionBar.push(primary, { icon: true, label: false });
|
||||
};
|
||||
|
||||
updateActions();
|
||||
return menu.onDidChange(updateActions);
|
||||
|
||||
return combinedDisposable(menu.onDidChange(updateActions), toDisposable(() => {
|
||||
cachedDisposable.dispose();
|
||||
}));
|
||||
}
|
||||
|
||||
interface RepositoryTemplateData {
|
||||
@@ -162,14 +168,14 @@ class ProviderRenderer implements IListRenderer<ISCMRepository, RepositoryTempla
|
||||
const badgeStyler = attachBadgeStyler(count, this.themeService);
|
||||
const actionBar = new ActionBar(provider, { actionViewItemProvider: a => new StatusBarActionViewItem(a as StatusBarAction) });
|
||||
const disposable = Disposable.None;
|
||||
const templateDisposable = combinedDisposable([actionBar, badgeStyler]);
|
||||
const templateDisposable = combinedDisposable(actionBar, badgeStyler);
|
||||
|
||||
return { title, type, countContainer, count, actionBar, disposable, templateDisposable };
|
||||
}
|
||||
|
||||
renderElement(repository: ISCMRepository, index: number, templateData: RepositoryTemplateData): void {
|
||||
templateData.disposable.dispose();
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
|
||||
if (repository.provider.rootUri) {
|
||||
templateData.title.textContent = basename(repository.provider.rootUri);
|
||||
@@ -181,7 +187,7 @@ class ProviderRenderer implements IListRenderer<ISCMRepository, RepositoryTempla
|
||||
|
||||
const actions: IAction[] = [];
|
||||
const disposeActions = () => dispose(actions);
|
||||
disposables.push({ dispose: disposeActions });
|
||||
disposables.add({ dispose: disposeActions });
|
||||
|
||||
const update = () => {
|
||||
disposeActions();
|
||||
@@ -198,10 +204,10 @@ class ProviderRenderer implements IListRenderer<ISCMRepository, RepositoryTempla
|
||||
this._onDidRenderElement.fire(repository);
|
||||
};
|
||||
|
||||
repository.provider.onDidChange(update, null, disposables);
|
||||
disposables.add(repository.provider.onDidChange(update, null));
|
||||
update();
|
||||
|
||||
templateData.disposable = combinedDisposable(disposables);
|
||||
templateData.disposable = disposables;
|
||||
}
|
||||
|
||||
disposeTemplate(templateData: RepositoryTemplateData): void {
|
||||
@@ -241,23 +247,23 @@ export class MainPanel extends ViewletPanel {
|
||||
horizontalScrolling: false
|
||||
}) as WorkbenchList<ISCMRepository>;
|
||||
|
||||
renderer.onDidRenderElement(e => this.list.updateWidth(this.viewModel.repositories.indexOf(e)), null, this.disposables);
|
||||
this.list.onSelectionChange(this.onListSelectionChange, this, this.disposables);
|
||||
this.list.onFocusChange(this.onListFocusChange, this, this.disposables);
|
||||
this.list.onContextMenu(this.onListContextMenu, this, this.disposables);
|
||||
this._register(renderer.onDidRenderElement(e => this.list.updateWidth(this.viewModel.repositories.indexOf(e)), null));
|
||||
this._register(this.list.onSelectionChange(this.onListSelectionChange, this));
|
||||
this._register(this.list.onFocusChange(this.onListFocusChange, this));
|
||||
this._register(this.list.onContextMenu(this.onListContextMenu, this));
|
||||
|
||||
this.viewModel.onDidChangeVisibleRepositories(this.updateListSelection, this, this.disposables);
|
||||
this._register(this.viewModel.onDidChangeVisibleRepositories(this.updateListSelection, this));
|
||||
|
||||
this.viewModel.onDidSplice(({ index, deleteCount, elements }) => this.splice(index, deleteCount, elements), null, this.disposables);
|
||||
this._register(this.viewModel.onDidSplice(({ index, deleteCount, elements }) => this.splice(index, deleteCount, elements), null));
|
||||
this.splice(0, 0, this.viewModel.repositories);
|
||||
|
||||
this.disposables.push(this.list);
|
||||
this._register(this.list);
|
||||
|
||||
this.configurationService.onDidChangeConfiguration(e => {
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('scm.providers.visible')) {
|
||||
this.updateBodySize();
|
||||
}
|
||||
}, this.disposables);
|
||||
}));
|
||||
|
||||
this.updateListSelection();
|
||||
}
|
||||
@@ -299,7 +305,7 @@ export class MainPanel extends ViewletPanel {
|
||||
const secondary: IAction[] = [];
|
||||
const result = { primary, secondary };
|
||||
|
||||
fillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => g === 'inline');
|
||||
const disposable = createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => g === 'inline');
|
||||
|
||||
menu.dispose();
|
||||
contextKeyService.dispose();
|
||||
@@ -313,6 +319,8 @@ export class MainPanel extends ViewletPanel {
|
||||
getActions: () => secondary,
|
||||
getActionsContext: () => repository.provider
|
||||
});
|
||||
|
||||
disposable.dispose();
|
||||
}
|
||||
|
||||
private onListSelectionChange(e: IListEvent<ISCMRepository>): void {
|
||||
@@ -396,14 +404,14 @@ class ResourceGroupRenderer implements IListRenderer<ISCMResourceGroup, Resource
|
||||
template.actionBar.clear();
|
||||
template.actionBar.context = group;
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
disposables.push(connectPrimaryMenuToInlineActionBar(this.menus.getResourceGroupMenu(group), template.actionBar));
|
||||
const disposables = new DisposableStore();
|
||||
disposables.add(connectPrimaryMenuToInlineActionBar(this.menus.getResourceGroupMenu(group), template.actionBar));
|
||||
|
||||
const updateCount = () => template.count.setCount(group.elements.length);
|
||||
group.onDidSplice(updateCount, null, disposables);
|
||||
disposables.add(group.onDidSplice(updateCount, null));
|
||||
updateCount();
|
||||
|
||||
template.elementDisposable = combinedDisposable(disposables);
|
||||
template.elementDisposable = disposables;
|
||||
}
|
||||
|
||||
disposeElement(group: ISCMResourceGroup, index: number, template: ResourceGroupTemplate): void {
|
||||
@@ -489,8 +497,8 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
|
||||
template.fileLabel.setFile(resource.sourceUri, { fileDecorations: { colors: false, badges: !icon, data: resource.decorations } });
|
||||
template.actionBar.context = resource;
|
||||
|
||||
const disposables: IDisposable[] = [];
|
||||
disposables.push(connectPrimaryMenuToInlineActionBar(this.menus.getResourceMenu(resource.resourceGroup), template.actionBar));
|
||||
const disposables = new DisposableStore();
|
||||
disposables.add(connectPrimaryMenuToInlineActionBar(this.menus.getResourceMenu(resource.resourceGroup), template.actionBar));
|
||||
|
||||
toggleClass(template.name, 'strike-through', resource.decorations.strikeThrough);
|
||||
toggleClass(template.element, 'faded', resource.decorations.faded);
|
||||
@@ -505,7 +513,7 @@ class ResourceRenderer implements IListRenderer<ISCMResource, ResourceTemplate>
|
||||
}
|
||||
|
||||
template.element.setAttribute('data-tooltip', resource.decorations.tooltip || '');
|
||||
template.elementDisposable = combinedDisposable(disposables);
|
||||
template.elementDisposable = disposables;
|
||||
}
|
||||
|
||||
disposeElement(resource: ISCMResource, index: number, template: ResourceTemplate): void {
|
||||
@@ -602,10 +610,10 @@ class ResourceGroupSplicer {
|
||||
absoluteToInsert.push(element);
|
||||
}
|
||||
|
||||
const disposable = combinedDisposable([
|
||||
const disposable = combinedDisposable(
|
||||
group.onDidChange(() => this.onDidChangeGroup(group)),
|
||||
group.onDidSplice(splice => this.onDidSpliceGroup(group, splice))
|
||||
]);
|
||||
);
|
||||
|
||||
itemsToInsert.push({ group, visible, disposable });
|
||||
}
|
||||
@@ -699,6 +707,7 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
|
||||
private cachedHeight: number | undefined = undefined;
|
||||
private cachedWidth: number | undefined = undefined;
|
||||
private cachedScrollTop: number | undefined = undefined;
|
||||
private inputBoxContainer: HTMLElement;
|
||||
private inputBox: InputBox;
|
||||
private listContainer: HTMLElement;
|
||||
@@ -727,8 +736,8 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
super(options, keybindingService, contextMenuService, configurationService);
|
||||
|
||||
this.menus = instantiationService.createInstance(SCMMenus, this.repository.provider);
|
||||
this.disposables.push(this.menus);
|
||||
this.menus.onDidChangeTitle(this._onDidChangeTitleArea.fire, this._onDidChangeTitleArea, this.disposables);
|
||||
this._register(this.menus);
|
||||
this._register(this.menus.onDidChangeTitle(this._onDidChangeTitleArea.fire, this._onDidChangeTitleArea));
|
||||
|
||||
this.contextKeyService = contextKeyService.createScoped(this.element);
|
||||
this.contextKeyService.createKey('scmRepository', this.repository);
|
||||
@@ -736,7 +745,7 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
|
||||
render(): void {
|
||||
super.render();
|
||||
this.menus.onDidChangeTitle(this.updateActions, this, this.disposables);
|
||||
this._register(this.menus.onDidChangeTitle(this.updateActions, this));
|
||||
}
|
||||
|
||||
protected renderHeaderTitle(container: HTMLElement): void {
|
||||
@@ -758,8 +767,8 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
|
||||
protected renderBody(container: HTMLElement): void {
|
||||
const focusTracker = trackFocus(container);
|
||||
this.disposables.push(focusTracker.onDidFocus(() => this.repository.focus()));
|
||||
this.disposables.push(focusTracker);
|
||||
this._register(focusTracker.onDidFocus(() => this.repository.focus()));
|
||||
this._register(focusTracker);
|
||||
|
||||
// Input
|
||||
this.inputBoxContainer = append(container, $('.scm-editor'));
|
||||
@@ -789,33 +798,33 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
|
||||
this.inputBox = new InputBox(this.inputBoxContainer, this.contextViewService, { flexibleHeight: true });
|
||||
this.inputBox.setEnabled(this.isBodyVisible());
|
||||
this.disposables.push(attachInputBoxStyler(this.inputBox, this.themeService));
|
||||
this.disposables.push(this.inputBox);
|
||||
this._register(attachInputBoxStyler(this.inputBox, this.themeService));
|
||||
this._register(this.inputBox);
|
||||
|
||||
this.inputBox.onDidChange(triggerValidation, null, this.disposables);
|
||||
this._register(this.inputBox.onDidChange(triggerValidation, null));
|
||||
|
||||
const onKeyUp = domEvent(this.inputBox.inputElement, 'keyup');
|
||||
const onMouseUp = domEvent(this.inputBox.inputElement, 'mouseup');
|
||||
Event.any<any>(onKeyUp, onMouseUp)(triggerValidation, null, this.disposables);
|
||||
this._register(Event.any<any>(onKeyUp, onMouseUp)(triggerValidation, null));
|
||||
|
||||
this.inputBox.value = this.repository.input.value;
|
||||
this.inputBox.onDidChange(value => this.repository.input.value = value, null, this.disposables);
|
||||
this.repository.input.onDidChange(value => this.inputBox.value = value, null, this.disposables);
|
||||
this._register(this.inputBox.onDidChange(value => this.repository.input.value = value, null));
|
||||
this._register(this.repository.input.onDidChange(value => this.inputBox.value = value, null));
|
||||
|
||||
updatePlaceholder();
|
||||
this.repository.input.onDidChangePlaceholder(updatePlaceholder, null, this.disposables);
|
||||
this.keybindingService.onDidUpdateKeybindings(updatePlaceholder, null, this.disposables);
|
||||
this._register(this.repository.input.onDidChangePlaceholder(updatePlaceholder, null));
|
||||
this._register(this.keybindingService.onDidUpdateKeybindings(updatePlaceholder, null));
|
||||
|
||||
this.disposables.push(this.inputBox.onDidHeightChange(() => this.layoutBody()));
|
||||
this._register(this.inputBox.onDidHeightChange(() => this.layoutBody()));
|
||||
|
||||
if (this.repository.provider.onDidChangeCommitTemplate) {
|
||||
this.repository.provider.onDidChangeCommitTemplate(this.updateInputBox, this, this.disposables);
|
||||
this._register(this.repository.provider.onDidChangeCommitTemplate(this.updateInputBox, this));
|
||||
}
|
||||
|
||||
this.updateInputBox();
|
||||
|
||||
// Input box visibility
|
||||
this.repository.input.onDidChangeVisibility(this.updateInputBoxVisibility, this, this.disposables);
|
||||
this._register(this.repository.input.onDidChangeVisibility(this.updateInputBoxVisibility, this));
|
||||
this.updateInputBoxVisibility();
|
||||
|
||||
// List
|
||||
@@ -830,7 +839,7 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
const actionViewItemProvider = (action: IAction) => this.getActionViewItem(action);
|
||||
|
||||
this.listLabels = this.instantiationService.createInstance(ResourceLabels, { onDidChangeVisibility: this.onDidChangeBodyVisibility });
|
||||
this.disposables.push(this.listLabels);
|
||||
this._register(this.listLabels);
|
||||
|
||||
const renderers = [
|
||||
new ResourceGroupRenderer(actionViewItemProvider, this.themeService, this.menus),
|
||||
@@ -843,20 +852,20 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
horizontalScrolling: false
|
||||
}) as WorkbenchList<ISCMResourceGroup | ISCMResource>;
|
||||
|
||||
Event.chain(this.list.onDidOpen)
|
||||
this._register(Event.chain(this.list.onDidOpen)
|
||||
.map(e => e.elements[0])
|
||||
.filter(e => !!e && isSCMResource(e))
|
||||
.on(this.open, this, this.disposables);
|
||||
.on(this.open, this));
|
||||
|
||||
Event.chain(this.list.onPin)
|
||||
this._register(Event.chain(this.list.onPin)
|
||||
.map(e => e.elements[0])
|
||||
.filter(e => !!e && isSCMResource(e))
|
||||
.on(this.pin, this, this.disposables);
|
||||
.on(this.pin, this));
|
||||
|
||||
this.list.onContextMenu(this.onListContextMenu, this, this.disposables);
|
||||
this.disposables.push(this.list);
|
||||
this._register(this.list.onContextMenu(this.onListContextMenu, this));
|
||||
this._register(this.list);
|
||||
|
||||
this.viewModel.onDidChangeVisibility(this.onDidChangeVisibility, this, this.disposables);
|
||||
this._register(this.viewModel.onDidChangeVisibility(this.onDidChangeVisibility, this));
|
||||
this.onDidChangeVisibility(this.viewModel.isVisible());
|
||||
this.onDidChangeBodyVisibility(visible => this.inputBox.setEnabled(visible));
|
||||
}
|
||||
@@ -866,6 +875,7 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
const listSplicer = new ResourceGroupSplicer(this.repository.provider.groups, this.list);
|
||||
this.visibilityDisposables.push(listSplicer);
|
||||
} else {
|
||||
this.cachedScrollTop = this.list.scrollTop;
|
||||
this.visibilityDisposables = dispose(this.visibilityDisposables);
|
||||
}
|
||||
}
|
||||
@@ -894,6 +904,13 @@ export class RepositoryPanel extends ViewletPanel {
|
||||
this.listContainer.style.height = `${height}px`;
|
||||
this.list.layout(height, width);
|
||||
}
|
||||
|
||||
if (this.cachedScrollTop !== undefined && this.list.scrollTop !== this.cachedScrollTop) {
|
||||
this.list.scrollTop = Math.min(this.cachedScrollTop, this.list.scrollHeight);
|
||||
// Applying the cached scroll position just once until the next leave.
|
||||
// This, also, avoids the scrollbar to flicker when resizing the sidebar.
|
||||
this.cachedScrollTop = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
@@ -1106,15 +1123,15 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
|
||||
super(VIEWLET_ID, SCMViewlet.STATE_KEY, true, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
|
||||
|
||||
this.menus = instantiationService.createInstance(SCMMenus, undefined);
|
||||
this.menus.onDidChangeTitle(this.updateTitleArea, this, this.toDispose);
|
||||
this._register(this.menus.onDidChangeTitle(this.updateTitleArea, this));
|
||||
|
||||
this.message = $('.empty-message', { tabIndex: 0 }, localize('no open repo', "No source control providers registered."));
|
||||
|
||||
configurationService.onDidChangeConfiguration(e => {
|
||||
this._register(configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('scm.alwaysShowProviders')) {
|
||||
this.onDidChangeRepositories();
|
||||
}
|
||||
}, this.toDispose);
|
||||
}));
|
||||
}
|
||||
|
||||
create(parent: HTMLElement): void {
|
||||
@@ -1124,8 +1141,8 @@ export class SCMViewlet extends ViewContainerViewlet implements IViewModel {
|
||||
addClasses(parent, 'scm-viewlet', 'empty');
|
||||
append(parent, this.message);
|
||||
|
||||
this.scmService.onDidAddRepository(this.onDidAddRepository, this, this.toDispose);
|
||||
this.scmService.onDidRemoveRepository(this.onDidRemoveRepository, this, this.toDispose);
|
||||
this._register(this.scmService.onDidAddRepository(this.onDidAddRepository, this));
|
||||
this._register(this.scmService.onDidRemoveRepository(this.onDidRemoveRepository, this));
|
||||
this.scmService.repositories.forEach(r => this.onDidAddRepository(r));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user