mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5
This commit is contained in:
@@ -11,7 +11,7 @@ import { IDisposable, dispose, Disposable, DisposableStore, combinedDisposable }
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { append, $, toggleClass } from 'vs/base/browser/dom';
|
||||
import { IListVirtualDelegate, IListRenderer, IListContextMenuEvent, IListEvent } from 'vs/base/browser/ui/list/list';
|
||||
import { ISCMService, ISCMRepository } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { ISCMRepository } from 'vs/workbench/contrib/scm/common/scm';
|
||||
import { CountBadge } from 'vs/base/browser/ui/countBadge/countBadge';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -182,7 +182,6 @@ export class MainPane extends ViewPane {
|
||||
options: IViewPaneOptions,
|
||||
@IKeybindingService protected keybindingService: IKeybindingService,
|
||||
@IContextMenuService protected contextMenuService: IContextMenuService,
|
||||
@ISCMService protected scmService: ISCMService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
|
||||
@@ -63,8 +63,6 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { format } from 'vs/base/common/strings';
|
||||
import { inputPlaceholderForeground, inputValidationInfoBorder, inputValidationWarningBorder, inputValidationErrorBorder, inputValidationInfoBackground, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningForeground, inputValidationErrorBackground, inputValidationErrorForeground, inputBackground, inputForeground, inputBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { SuggestController } from 'vs/editor/contrib/suggest/suggestController';
|
||||
import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
|
||||
@@ -566,6 +564,12 @@ class ViewModel {
|
||||
dispose(): void {
|
||||
this.visibilityDisposables.dispose();
|
||||
this.disposables.dispose();
|
||||
|
||||
for (const item of this.items) {
|
||||
item.disposable.dispose();
|
||||
}
|
||||
|
||||
this.items = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,18 +719,18 @@ export class RepositoryPane extends ViewPane {
|
||||
fontSize: 13,
|
||||
lineHeight: 20,
|
||||
fontFamily: ' -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif',
|
||||
wrappingAlgorithm: 'dom',
|
||||
wrappingStrategy: 'advanced',
|
||||
wrappingIndent: 'none',
|
||||
suggest: {
|
||||
showWords: false
|
||||
}
|
||||
// suggest: {
|
||||
// showWords: false
|
||||
// }
|
||||
};
|
||||
|
||||
const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {
|
||||
isSimpleWidget: true,
|
||||
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
|
||||
SuggestController.ID,
|
||||
SnippetController2.ID,
|
||||
// SuggestController.ID,
|
||||
// SnippetController2.ID,
|
||||
MenuPreventer.ID,
|
||||
SelectionClipboardContributionID,
|
||||
ContextMenuController.ID,
|
||||
@@ -765,7 +769,12 @@ export class RepositoryPane extends ViewPane {
|
||||
|
||||
// Keep model in sync with API
|
||||
this.inputModel.setValue(this.repository.input.value);
|
||||
this._register(this.repository.input.onDidChange(value => this.inputModel.setValue(value)));
|
||||
this._register(this.repository.input.onDidChange(value => {
|
||||
if (value === this.inputModel.getValue()) {
|
||||
return;
|
||||
}
|
||||
this.inputModel.setValue(value);
|
||||
}));
|
||||
|
||||
// Keep API in sync with model and update placeholder and validation
|
||||
toggleClass(placeholderTextContainer, 'hidden', this.inputModel.getValueLength() > 0);
|
||||
|
||||
@@ -27,10 +27,11 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IViewsRegistry, Extensions, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { nextTick } from 'vs/base/common/process';
|
||||
import { RepositoryPane, RepositoryViewDescriptor } from 'vs/workbench/contrib/scm/browser/repositoryPane';
|
||||
import { MainPaneDescriptor, MainPane } from 'vs/workbench/contrib/scm/browser/mainPane';
|
||||
import { MainPaneDescriptor, MainPane, IViewModel } from 'vs/workbench/contrib/scm/browser/mainPane';
|
||||
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import type { IAddedViewDescriptorRef } from 'vs/workbench/browser/parts/views/views';
|
||||
import { debounce } from 'vs/base/common/decorators';
|
||||
|
||||
export interface ISpliceEvent<T> {
|
||||
index: number;
|
||||
@@ -38,18 +39,6 @@ export interface ISpliceEvent<T> {
|
||||
elements: T[];
|
||||
}
|
||||
|
||||
export interface IViewModel {
|
||||
readonly repositories: ISCMRepository[];
|
||||
readonly onDidSplice: Event<ISpliceEvent<ISCMRepository>>;
|
||||
|
||||
readonly visibleRepositories: ISCMRepository[];
|
||||
readonly onDidChangeVisibleRepositories: Event<ISCMRepository[]>;
|
||||
setVisibleRepositories(repositories: ISCMRepository[]): void;
|
||||
|
||||
isVisible(): boolean;
|
||||
readonly onDidChangeVisibility: Event<boolean>;
|
||||
}
|
||||
|
||||
export class SCMViewPaneContainer extends ViewPaneContainer implements IViewModel {
|
||||
|
||||
private static readonly STATE_KEY = 'workbench.scm.views.state';
|
||||
@@ -117,6 +106,8 @@ export class SCMViewPaneContainer extends ViewPaneContainer implements IViewMode
|
||||
}));
|
||||
|
||||
this.repositoryCountKey = contextKeyService.createKey('scm.providerCount', 0);
|
||||
|
||||
this._register(this.viewsModel.onDidAdd(this.onDidShowView, this));
|
||||
this._register(this.viewsModel.onDidRemove(this.onDidHideView, this));
|
||||
}
|
||||
|
||||
@@ -170,12 +161,29 @@ export class SCMViewPaneContainer extends ViewPaneContainer implements IViewMode
|
||||
this.repositoryCountKey.set(repositoryCount);
|
||||
}
|
||||
|
||||
private onDidHideView(): void {
|
||||
nextTick(() => {
|
||||
if (this.repositoryCountKey.get()! > 0 && this.viewDescriptors.every(d => !this.viewsModel.isVisible(d.id))) {
|
||||
this.viewsModel.setVisible(this.viewDescriptors[0].id, true);
|
||||
private onDidShowView(e: IAddedViewDescriptorRef[]): void {
|
||||
for (const ref of e) {
|
||||
if (ref.viewDescriptor instanceof RepositoryViewDescriptor) {
|
||||
ref.viewDescriptor.repository.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private onDidHideView(e: IAddedViewDescriptorRef[]): void {
|
||||
for (const ref of e) {
|
||||
if (ref.viewDescriptor instanceof RepositoryViewDescriptor) {
|
||||
ref.viewDescriptor.repository.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.afterOnDidHideView();
|
||||
}
|
||||
|
||||
@debounce(0)
|
||||
private afterOnDidHideView(): void {
|
||||
if (this.repositoryCountKey.get()! > 0 && this.viewDescriptors.every(d => !this.viewsModel.isVisible(d.id))) {
|
||||
this.viewsModel.setVisible(this.viewDescriptors[0].id, true);
|
||||
}
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
@@ -265,12 +273,10 @@ export class SCMViewPaneContainer extends ViewPaneContainer implements IViewMode
|
||||
}
|
||||
}
|
||||
|
||||
viewDescriptor.repository.setSelected(false);
|
||||
this.viewsModel.setVisible(viewDescriptor.id, false);
|
||||
}
|
||||
|
||||
for (const viewDescriptor of toSetVisible) {
|
||||
viewDescriptor.repository.setSelected(true);
|
||||
this.viewsModel.setVisible(viewDescriptor.id, true, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +97,10 @@ class SCMRepository implements ISCMRepository {
|
||||
}
|
||||
|
||||
setSelected(selected: boolean): void {
|
||||
if (this._selected === selected) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._selected = selected;
|
||||
this._onDidChangeSelection.fire(selected);
|
||||
}
|
||||
@@ -158,11 +162,6 @@ export class SCMService implements ISCMService {
|
||||
this._repositories.push(repository);
|
||||
this._onDidAddProvider.fire(repository);
|
||||
|
||||
// automatically select the first repository
|
||||
if (this._repositories.length === 1) {
|
||||
repository.setSelected(true);
|
||||
}
|
||||
|
||||
return repository;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user