More layering and strictness (#9004)

* move handling generated files to the serilization classes

* remove unneeded methods

* add more folders to strictire compile, add more strict compile options

* update ci

* wip

* add more layering and fix issues

* add more strictness

* remove unnecessary assertion

* add missing checks

* fix indentation

* wip

* remove jsdoc

* fix layering

* fix compile

* fix compile errors

* wip

* wip

* finish layering

* fix css

* more layering

* remove no longer good parts

* fix issues with startup

* another try

* fix startup
This commit is contained in:
Anthony Dresser
2020-02-11 00:47:17 -06:00
committed by GitHub
parent 3a8b74a311
commit 0f934081e1
97 changed files with 489 additions and 214 deletions

View File

@@ -11,7 +11,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/common/languageAssociation';
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
const languageAssociationRegistry = Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.LanguageAssociations);

View File

@@ -45,8 +45,8 @@ import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { CollapseAllAction } from 'vs/base/browser/ui/tree/treeDefaults';
import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
import { IOEShimService } from 'sql/workbench/contrib/objectExplorer/browser/objectExplorerViewTreeShim';
import { NodeContextKey } from 'sql/workbench/contrib/dataExplorer/browser/nodeContext';
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
import { NodeContextKey } from 'sql/workbench/browser/parts/views/nodeContext';
import { UserCancelledConnectionError } from 'sql/base/common/errors';
import { firstIndex } from 'vs/base/common/arrays';
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';

View File

@@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ConnectionContextKey } from 'sql/workbench/services/connection/common/connectionContextKey';
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
import { ITreeItem } from 'sql/workbench/common/views';
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
export interface INodeContextValue {
node: ITreeItem;
viewId: string;
}
export class NodeContextKey extends Disposable implements IContextKey<INodeContextValue> {
static IsConnectable = new RawContextKey<boolean>('isConnectable', false);
static IsConnected = new RawContextKey<boolean>('isConnected', false);
static ViewId = new RawContextKey<string>('view', undefined);
static ViewItem = new RawContextKey<string>('viewItem', undefined);
static Node = new RawContextKey<INodeContextValue>('node', undefined);
private readonly _connectionContextKey: ConnectionContextKey;
private readonly _connectableKey: IContextKey<boolean>;
private readonly _connectedKey: IContextKey<boolean>;
private readonly _viewIdKey: IContextKey<string>;
private readonly _viewItemKey: IContextKey<string>;
private readonly _nodeContextKey: IContextKey<INodeContextValue>;
private _nodeContextUtils: MssqlNodeContext;
constructor(
@IContextKeyService private contextKeyService: IContextKeyService,
@IOEShimService private oeService: IOEShimService,
@IQueryManagementService queryManagementService: IQueryManagementService,
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@ICapabilitiesService private capabilitiesService: ICapabilitiesService
) {
super();
this._connectableKey = NodeContextKey.IsConnectable.bindTo(contextKeyService);
this._connectedKey = NodeContextKey.IsConnected.bindTo(contextKeyService);
this._viewIdKey = NodeContextKey.ViewId.bindTo(contextKeyService);
this._viewItemKey = NodeContextKey.ViewItem.bindTo(contextKeyService);
this._nodeContextKey = NodeContextKey.Node.bindTo(contextKeyService);
this._connectionContextKey = new ConnectionContextKey(contextKeyService, queryManagementService);
}
set(value: INodeContextValue) {
if (value.node && value.node.payload) {
this._connectableKey.set(true);
this._connectedKey.set(this.oeService.isNodeConnected(value.viewId, value.node));
this._connectionContextKey.set(value.node.payload);
} else {
this._connectableKey.set(false);
this._connectedKey.set(false);
this._connectionContextKey.reset();
}
if (value.node) {
this._viewItemKey.set(value.node.contextValue);
} else {
this._viewItemKey.reset();
}
this._nodeContextKey.set(value);
this._viewIdKey.set(value.viewId);
this._nodeContextUtils = new MssqlNodeContext(this._nodeContextKey.get(), this.contextKeyService,
this.connectionManagementService, this.capabilitiesService);
}
reset(): void {
this._viewIdKey.reset();
this._viewItemKey.reset();
this._connectableKey.reset();
this._connectedKey.reset();
this._connectionContextKey.reset();
this._nodeContextKey.reset();
this._nodeContextUtils.dispose();
}
get(): INodeContextValue | undefined {
return this._nodeContextKey.get();
}
}