mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix a bunch of strict issues (#11857)
* fix a bunch of strict issues * fix tests * fix tests
This commit is contained in:
@@ -37,11 +37,11 @@ export default class LoadingSpinner implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
loading: boolean;
|
loading?: boolean;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
loadingMessage: string;
|
loadingMessage?: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
loadingCompletedMessage: string;
|
loadingCompletedMessage?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export class PanelComponent extends Disposable implements IThemable {
|
|||||||
private _actionbar?: ActionBar;
|
private _actionbar?: ActionBar;
|
||||||
private _mru: TabComponent[] = [];
|
private _mru: TabComponent[] = [];
|
||||||
private _tabExpanded: boolean = true;
|
private _tabExpanded: boolean = true;
|
||||||
private _styleElement: HTMLStyleElement;
|
private _styleElement!: HTMLStyleElement;
|
||||||
|
|
||||||
protected AutoScrollbarVisibility = ScrollbarVisibility.Auto; // used by angular template
|
protected AutoScrollbarVisibility = ScrollbarVisibility.Auto; // used by angular template
|
||||||
protected HiddenScrollbarVisibility = ScrollbarVisibility.Hidden; // used by angular template
|
protected HiddenScrollbarVisibility = ScrollbarVisibility.Hidden; // used by angular template
|
||||||
@@ -266,7 +266,7 @@ export class PanelComponent extends Disposable implements IThemable {
|
|||||||
public updateTab(tabId: string, config: { title?: string, iconClass?: string }): void {
|
public updateTab(tabId: string, config: { title?: string, iconClass?: string }): void {
|
||||||
// First find the tab and update it with the new values. Then manually refresh the
|
// First find the tab and update it with the new values. Then manually refresh the
|
||||||
// tab header since it won't detect changes made to the corresponding tab by itself.
|
// tab header since it won't detect changes made to the corresponding tab by itself.
|
||||||
let tabHeader: TabHeaderComponent;
|
let tabHeader: TabHeaderComponent | undefined;
|
||||||
const tabHeaders = this._tabHeaders.toArray();
|
const tabHeaders = this._tabHeaders.toArray();
|
||||||
const tab = this._tabs.find((item, i) => {
|
const tab = this._tabs.find((item, i) => {
|
||||||
if (item.identifier === tabId) {
|
if (item.identifier === tabId) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export type TabType = 'tab' | 'group-header';
|
|||||||
export class TabComponent implements OnDestroy {
|
export class TabComponent implements OnDestroy {
|
||||||
private _child?: TabChild;
|
private _child?: TabChild;
|
||||||
@ContentChild(TemplateRef) templateRef!: TemplateRef<any>;
|
@ContentChild(TemplateRef) templateRef!: TemplateRef<any>;
|
||||||
@Input() public title!: string;
|
@Input() public title?: string;
|
||||||
@Input() public canClose!: boolean;
|
@Input() public canClose!: boolean;
|
||||||
@Input() public actions?: Array<Action>;
|
@Input() public actions?: Array<Action>;
|
||||||
@Input() public iconClass?: string;
|
@Input() public iconClass?: string;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export class ScrollableView extends Disposable {
|
|||||||
height: typeof height === 'number' ? height : DOM.getContentHeight(this.domNode)
|
height: typeof height === 'number' ? height : DOM.getContentHeight(this.domNode)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.renderHeight = scrollDimensions.height;
|
this.renderHeight = scrollDimensions.height!;
|
||||||
|
|
||||||
this.width = width ?? DOM.getContentWidth(this.domNode);
|
this.width = width ?? DOM.getContentWidth(this.domNode);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ export class ScrollableView extends Disposable {
|
|||||||
|
|
||||||
if (this.scrollableElementUpdateDisposable) {
|
if (this.scrollableElementUpdateDisposable) {
|
||||||
this.scrollableElementUpdateDisposable.dispose();
|
this.scrollableElementUpdateDisposable.dispose();
|
||||||
this.scrollableElementUpdateDisposable = null;
|
this.scrollableElementUpdateDisposable = undefined;
|
||||||
scrollDimensions.scrollHeight = this.scrollHeight;
|
scrollDimensions.scrollHeight = this.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ export class ScrollableView extends Disposable {
|
|||||||
setScrollTop(scrollTop: number): void {
|
setScrollTop(scrollTop: number): void {
|
||||||
if (this.scrollableElementUpdateDisposable) {
|
if (this.scrollableElementUpdateDisposable) {
|
||||||
this.scrollableElementUpdateDisposable.dispose();
|
this.scrollableElementUpdateDisposable.dispose();
|
||||||
this.scrollableElementUpdateDisposable = null;
|
this.scrollableElementUpdateDisposable = undefined;
|
||||||
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
|
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ export class ScrollableView extends Disposable {
|
|||||||
|
|
||||||
public addViews(views: IView[]): void { // @todo anthonydresser add ability to splice into the middle of the list and remove a particular index
|
public addViews(views: IView[]): void { // @todo anthonydresser add ability to splice into the middle of the list and remove a particular index
|
||||||
const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
|
const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
|
||||||
const items = views.map(view => ({ size: view.minimumSize, view, disposables: [], index: 0 }));
|
const items: IItem[] = views.map(view => ({ size: view.minimumSize, view, disposables: [], index: 0 }));
|
||||||
|
|
||||||
items.map(i => i.disposables.push(i.view.onDidChange(() => this.rerender(this.getRenderRange(this.lastRenderTop, this.lastRenderHeight)))));
|
items.map(i => i.disposables.push(i.view.onDidChange(() => this.rerender(this.getRenderRange(this.lastRenderTop, this.lastRenderHeight)))));
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ export class ScrollableView extends Disposable {
|
|||||||
|
|
||||||
// DOM operations
|
// DOM operations
|
||||||
|
|
||||||
private insertItemInDOM(index: number, beforeElement: HTMLElement | null): void {
|
private insertItemInDOM(index: number, beforeElement: HTMLElement | undefined): void {
|
||||||
const item = this.items[index];
|
const item = this.items[index];
|
||||||
|
|
||||||
if (!item.domNode) {
|
if (!item.domNode) {
|
||||||
@@ -298,29 +298,29 @@ export class ScrollableView extends Disposable {
|
|||||||
private removeItemFromDOM(index: number): void {
|
private removeItemFromDOM(index: number): void {
|
||||||
const item = this.items[index];
|
const item = this.items[index];
|
||||||
|
|
||||||
if (item) {
|
if (item && item.domNode) {
|
||||||
item.domNode.remove();
|
item.domNode.remove();
|
||||||
item.onDidInsertDisposable?.dispose();
|
item.onDidInsertDisposable?.dispose();
|
||||||
if (item.view.onDidRemove) {
|
if (item.view.onDidRemove) {
|
||||||
item.onDidRemoveDisposable = DOM.scheduleAtNextAnimationFrame(() => {
|
item.onDidRemoveDisposable = DOM.scheduleAtNextAnimationFrame(() => {
|
||||||
// we don't trust the items to be performant so don't interrupt our operations
|
// we don't trust the items to be performant so don't interrupt our operations
|
||||||
item.view.onDidRemove();
|
item.view.onDidRemove!();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getNextToLastElement(ranges: IRange[]): HTMLElement | null {
|
private getNextToLastElement(ranges: IRange[]): HTMLElement | undefined {
|
||||||
const lastRange = ranges[ranges.length - 1];
|
const lastRange = ranges[ranges.length - 1];
|
||||||
|
|
||||||
if (!lastRange) {
|
if (!lastRange) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextToLastItem = this.items[lastRange.end];
|
const nextToLastItem = this.items[lastRange.end];
|
||||||
|
|
||||||
if (!nextToLastItem) {
|
if (!nextToLastItem) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nextToLastItem.domNode;
|
return nextToLastItem.domNode;
|
||||||
@@ -333,7 +333,7 @@ export class ScrollableView extends Disposable {
|
|||||||
if (!this.scrollableElementUpdateDisposable) {
|
if (!this.scrollableElementUpdateDisposable) {
|
||||||
this.scrollableElementUpdateDisposable = DOM.scheduleAtNextAnimationFrame(() => {
|
this.scrollableElementUpdateDisposable = DOM.scheduleAtNextAnimationFrame(() => {
|
||||||
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
|
this.scrollableElement.setScrollDimensions({ scrollHeight: this.scrollHeight });
|
||||||
this.scrollableElementUpdateDisposable = null;
|
this.scrollableElementUpdateDisposable = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ export class SelectBox extends vsSelectBox {
|
|||||||
let optionItems: SelectOptionItemSQL[] = SelectBox.createOptions(options);
|
let optionItems: SelectOptionItemSQL[] = SelectBox.createOptions(options);
|
||||||
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
|
super(optionItems, 0, contextViewProvider, undefined, selectBoxOptions);
|
||||||
|
|
||||||
|
this._optionsDictionary = new Map<string, number>();
|
||||||
this.populateOptionsDictionary(optionItems);
|
this.populateOptionsDictionary(optionItems);
|
||||||
|
this._dialogOptions = optionItems;
|
||||||
const option = this._optionsDictionary.get(selectedOption);
|
const option = this._optionsDictionary.get(selectedOption);
|
||||||
if (option) {
|
if (option) {
|
||||||
super.select(option);
|
super.select(option);
|
||||||
@@ -144,7 +146,7 @@ export class SelectBox extends vsSelectBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public populateOptionsDictionary(options: SelectOptionItemSQL[]) {
|
public populateOptionsDictionary(options: SelectOptionItemSQL[]) {
|
||||||
this._optionsDictionary = new Map<string, number>();
|
this._optionsDictionary.clear();
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
this._optionsDictionary.set(options[i].value, i);
|
this._optionsDictionary.set(options[i].value, i);
|
||||||
}
|
}
|
||||||
@@ -198,7 +200,7 @@ export class SelectBox extends vsSelectBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get label(): string | undefined {
|
public get label(): string | undefined {
|
||||||
return this._dialogOptions.find(s => s.value === this._selectedOption).text;
|
return this._dialogOptions?.find(s => s.value === this._selectedOption)?.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get values(): string[] {
|
public get values(): string[] {
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ export class MouseController<T> implements IDisposable {
|
|||||||
if (document.activeElement !== e.browserEvent.target) {
|
if (document.activeElement !== e.browserEvent.target) {
|
||||||
this.table.domFocus();
|
this.table.domFocus();
|
||||||
}
|
}
|
||||||
const merger = (lastEvent: ITableMouseEvent<T>, currentEvent: MouseEvent): ITableMouseEvent<T> => {
|
const merger = (lastEvent: ITableMouseEvent<T> | null, currentEvent: MouseEvent): ITableMouseEvent<T> => {
|
||||||
return this.view.toMouseEvent(currentEvent);
|
return this.view.toMouseEvent(currentEvent);
|
||||||
};
|
};
|
||||||
this._mouseMoveMonitor.startMonitoring(e.browserEvent.target as HTMLElement, e.buttons, merger, e => this.onMouseMove(e), () => this.onMouseStop());
|
this._mouseMoveMonitor.startMonitoring(e.browserEvent.target as HTMLElement, e.buttons, merger, e => this.onMouseMove(e), () => this.onMouseStop());
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export interface ButtonClickEventArgs<T extends Slick.SlickData> {
|
|||||||
export class ButtonColumn<T extends Slick.SlickData> implements Slick.Plugin<T> {
|
export class ButtonColumn<T extends Slick.SlickData> implements Slick.Plugin<T> {
|
||||||
private _handler = new Slick.EventHandler();
|
private _handler = new Slick.EventHandler();
|
||||||
private _definition: ButtonColumnDefinition<T>;
|
private _definition: ButtonColumnDefinition<T>;
|
||||||
private _grid: Slick.Grid<T>;
|
private _grid!: Slick.Grid<T>;
|
||||||
private _onClick = new Emitter<ButtonClickEventArgs<T>>();
|
private _onClick = new Emitter<ButtonClickEventArgs<T>>();
|
||||||
public onClick = this._onClick.event;
|
public onClick = this._onClick.event;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export class TextWithIconColumn<T extends Slick.SlickData> {
|
|||||||
}
|
}
|
||||||
private formatter(row: number, cell: number, value: any, columnDef: Slick.Column<T>, dataContext: T): string {
|
private formatter(row: number, cell: number, value: any, columnDef: Slick.Column<T>, dataContext: T): string {
|
||||||
const iconColumn = columnDef as TextWithIconColumnDefinition<T>;
|
const iconColumn = columnDef as TextWithIconColumnDefinition<T>;
|
||||||
return `<div class="icon codicon slick-icon-cell-content ${dataContext[iconColumn.iconCssClassField]}">${value}</div>`;
|
return `<div class="icon codicon slick-icon-cell-content ${iconColumn.iconCssClassField ? dataContext[iconColumn.iconCssClassField] : ''}">${value}</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get definition(): TextWithIconColumnDefinition<T> {
|
public get definition(): TextWithIconColumnDefinition<T> {
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ const defaultOptions: IActionBarOptions = {
|
|||||||
export class OverflowActionBar extends ActionBar {
|
export class OverflowActionBar extends ActionBar {
|
||||||
// Elements
|
// Elements
|
||||||
private _overflow: HTMLElement;
|
private _overflow: HTMLElement;
|
||||||
private _moreItemElement: HTMLElement;
|
private _moreItemElement?: HTMLElement;
|
||||||
private _moreActionsElement: HTMLElement;
|
private _moreActionsElement?: HTMLElement;
|
||||||
private _previousWidth: number;
|
private _previousWidth: number = 0;
|
||||||
|
|
||||||
constructor(container: HTMLElement, options: IActionBarOptions = defaultOptions) {
|
constructor(container: HTMLElement, options: IActionBarOptions = defaultOptions) {
|
||||||
super(container, options);
|
super(container, options);
|
||||||
@@ -74,7 +74,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
this.createMoreItemElement();
|
this.createMoreItemElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._moreItemElement.style.display = 'block';
|
this._moreItemElement!.style.display = 'block';
|
||||||
while (width < fullWidth) {
|
while (width < fullWidth) {
|
||||||
let index = this._actionsList.childNodes.length - 2; // remove the last toolbar action before the more actions '...'
|
let index = this._actionsList.childNodes.length - 2; // remove the last toolbar action before the more actions '...'
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
@@ -94,7 +94,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
this.collapseItem();
|
this.collapseItem();
|
||||||
break;
|
break;
|
||||||
} else if (!this._overflow.hasChildNodes()) {
|
} else if (!this._overflow.hasChildNodes()) {
|
||||||
this._moreItemElement.style.display = 'none';
|
this._moreItemElement!.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,23 +117,26 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
|
|
||||||
// change role to menuItem when it's in the overflow
|
// change role to menuItem when it's in the overflow
|
||||||
if ((<HTMLElement>this._overflow.firstChild).className !== 'taskbarSeparator') {
|
if ((<HTMLElement>this._overflow.firstChild).className !== 'taskbarSeparator') {
|
||||||
(<HTMLElement>this._overflow.firstChild.firstChild).setAttribute('role', 'menuItem');
|
(<HTMLElement>this._overflow.firstChild!.firstChild).setAttribute('role', 'menuItem');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public restoreItem(): void {
|
public restoreItem(): void {
|
||||||
let item = this._overflow.removeChild(this._overflow.firstChild);
|
let firstChild = this._overflow.firstChild;
|
||||||
// change role back to button when it's in the toolbar
|
if (firstChild) {
|
||||||
if ((<HTMLElement>item).className !== 'taskbarSeparator') {
|
let item = this._overflow.removeChild(firstChild);
|
||||||
(<HTMLElement>item.firstChild).setAttribute('role', 'button');
|
// change role back to button when it's in the toolbar
|
||||||
}
|
if ((<HTMLElement>item).className !== 'taskbarSeparator') {
|
||||||
this._actionsList.insertBefore(item, this._actionsList.lastChild);
|
(<HTMLElement>item.firstChild).setAttribute('role', 'button');
|
||||||
|
}
|
||||||
|
this._actionsList.insertBefore(item, this._actionsList.lastChild);
|
||||||
|
|
||||||
// move placeholder in this._items if item isn't a separator
|
// move placeholder in this._items if item isn't a separator
|
||||||
if (!(<HTMLElement>item).classList.contains('taskbarSeparator')) {
|
if (!(<HTMLElement>item).classList.contains('taskbarSeparator')) {
|
||||||
let placeHolderIndex = this._items.findIndex(i => i === undefined);
|
let placeHolderIndex = this._items.findIndex(i => i === undefined);
|
||||||
let placeHolderItem = this._items.splice(placeHolderIndex, 1);
|
let placeHolderItem = this._items.splice(placeHolderIndex, 1);
|
||||||
this._items.splice(placeHolderIndex + 1, 0, placeHolderItem[0]);
|
this._items.splice(placeHolderIndex + 1, 0, placeHolderItem[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +166,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
// Close overflow if Escape is pressed
|
// Close overflow if Escape is pressed
|
||||||
if (event.equals(KeyCode.Escape)) {
|
if (event.equals(KeyCode.Escape)) {
|
||||||
this.hideOverflowDisplay();
|
this.hideOverflowDisplay();
|
||||||
this._moreActionsElement.focus();
|
this._moreActionsElement!.focus();
|
||||||
} else if (event.equals(KeyCode.UpArrow)) {
|
} else if (event.equals(KeyCode.UpArrow)) {
|
||||||
// up arrow on first element in overflow should move focus to the bottom of the overflow
|
// up arrow on first element in overflow should move focus to the bottom of the overflow
|
||||||
if (this._focusedItem === this._actionsList.childElementCount) {
|
if (this._focusedItem === this._actionsList.childElementCount) {
|
||||||
@@ -192,7 +195,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
|
|
||||||
this._moreItemElement.appendChild(this._moreActionsElement);
|
this._moreItemElement.appendChild(this._moreActionsElement);
|
||||||
this._actionsList.appendChild(this._moreItemElement);
|
this._actionsList.appendChild(this._moreItemElement);
|
||||||
this._items.push(undefined); // add place holder for more item element
|
this._items.push(undefined!); // add place holder for more item element @anthonydresser, im not sure how this is working, vscode indexes into this value all the time...
|
||||||
}
|
}
|
||||||
|
|
||||||
public moreElementOnClick(event: MouseEvent | StandardKeyboardEvent): void {
|
public moreElementOnClick(event: MouseEvent | StandardKeyboardEvent): void {
|
||||||
@@ -324,7 +327,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
if (i === this._focusedItem) {
|
if (i === this._focusedItem) {
|
||||||
// placeholder for location of moreActionsElement
|
// placeholder for location of moreActionsElement
|
||||||
if (!actionItem) {
|
if (!actionItem) {
|
||||||
this._moreActionsElement.focus();
|
this._moreActionsElement!.focus();
|
||||||
}
|
}
|
||||||
else if (types.isFunction(actionItem.focus)) {
|
else if (types.isFunction(actionItem.focus)) {
|
||||||
actionItem.focus();
|
actionItem.focus();
|
||||||
@@ -362,7 +365,7 @@ export class OverflowActionBar extends ActionBar {
|
|||||||
return this._overflow;
|
return this._overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get focusedItem(): number {
|
public get focusedItem(): number | undefined {
|
||||||
return this._focusedItem;
|
return this._focusedItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class TestView extends Disposable implements IView {
|
|||||||
this._onDidLayout.fire({ height, width });
|
this._onDidLayout.fire({ height, width });
|
||||||
}
|
}
|
||||||
|
|
||||||
private _size: number;
|
private _size: number = 0;
|
||||||
public get size(): number {
|
public get size(): number {
|
||||||
return this._size;
|
return this._size;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ suite('ScrollableView', () => {
|
|||||||
|
|
||||||
assert.equal(view1.size, 100, 'view1 is minimum size');
|
assert.equal(view1.size, 100, 'view1 is minimum size');
|
||||||
assert.equal(view2.size, 100, 'view2 is minimum size');
|
assert.equal(view2.size, 100, 'view2 is minimum size');
|
||||||
assert.equal(view3.size, undefined, 'view3 should not have been layout yet');
|
assert.equal(view3.size, 0, 'view3 should not have been layout yet');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('reacts to changes in views', async () => {
|
test('reacts to changes in views', async () => {
|
||||||
@@ -157,7 +157,7 @@ suite('ScrollableView', () => {
|
|||||||
|
|
||||||
assert.equal(view1.size, 130, 'view1 should be 130');
|
assert.equal(view1.size, 130, 'view1 should be 130');
|
||||||
assert.equal(view2.size, 100, 'view2 should still be minimum size');
|
assert.equal(view2.size, 100, 'view2 should still be minimum size');
|
||||||
assert.equal(view3.size, undefined, 'view3 should not have been layout yet');
|
assert.equal(view3.size, 0, 'view3 should not have been layout yet');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('programmatically scrolls', async () => {
|
test('programmatically scrolls', async () => {
|
||||||
@@ -174,7 +174,7 @@ suite('ScrollableView', () => {
|
|||||||
|
|
||||||
assert.equal(view1.size, 100, 'view1 is minimum size');
|
assert.equal(view1.size, 100, 'view1 is minimum size');
|
||||||
assert.equal(view2.size, 100, 'view2 is minimum size');
|
assert.equal(view2.size, 100, 'view2 is minimum size');
|
||||||
assert.equal(view3.size, undefined, 'view3 should not have been layout yet');
|
assert.equal(view3.size, 0, 'view3 should not have been layout yet');
|
||||||
assert.equal(getViewChildren(container).length, 2, 'only 2 views are rendered');
|
assert.equal(getViewChildren(container).length, 2, 'only 2 views are rendered');
|
||||||
|
|
||||||
scrollableView.setScrollTop(100);
|
scrollableView.setScrollTop(100);
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ const options: SelectOptionItemSQL[] = [
|
|||||||
suite('Select Box tests', () => {
|
suite('Select Box tests', () => {
|
||||||
test('default value', () => {
|
test('default value', () => {
|
||||||
|
|
||||||
const sb = new SelectBox(options, options[1].value, undefined, undefined, undefined);
|
const sb = new SelectBox(options, options[1].value, undefined!, undefined!, undefined!);
|
||||||
|
|
||||||
assert(sb.value === options[1].value);
|
assert(sb.value === options[1].value);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('values change', () => {
|
test('values change', () => {
|
||||||
const sb = new SelectBox(options, options[1].value, undefined, undefined, undefined);
|
const sb = new SelectBox(options, options[1].value, undefined!, undefined!, undefined!);
|
||||||
const newOptions = deepClone(options);
|
const newOptions = deepClone(options);
|
||||||
{
|
{
|
||||||
const moreOptions: SelectOptionItemSQL[] = [
|
const moreOptions: SelectOptionItemSQL[] = [
|
||||||
@@ -38,7 +38,7 @@ suite('Select Box tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('the selected option changes', () => {
|
test('the selected option changes', () => {
|
||||||
const sb = new SelectBox(options, options[1].value, undefined, undefined, undefined);
|
const sb = new SelectBox(options, options[1].value, undefined!, undefined!, undefined!);
|
||||||
|
|
||||||
sb.onSelect({
|
sb.onSelect({
|
||||||
index: 0,
|
index: 0,
|
||||||
@@ -50,16 +50,16 @@ suite('Select Box tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('values get auto populated', () => {
|
test('values get auto populated', () => {
|
||||||
const newOptions = deepClone(options).map(s => { return { text: s.text, value: undefined }; });
|
const newOptions = deepClone(options).map(s => { return { text: s.text, value: s.text }; });
|
||||||
const sb = new SelectBox(newOptions, undefined, undefined, undefined, undefined);
|
const sb = new SelectBox(newOptions, undefined!, undefined!, undefined!, undefined!);
|
||||||
|
|
||||||
assert(equals(sb.values, newOptions.map(s => s.text)));
|
assert(equals(sb.values, newOptions.map(s => s.text)));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('value did not contain label', () => {
|
test('value did not contain label', () => {
|
||||||
const newOptions = deepClone(options).map(s => { return { text: s.text, value: undefined }; });
|
const newOptions = deepClone(options).map(s => { return { text: s.text, value: s.text }; });
|
||||||
delete newOptions[0].text;
|
delete newOptions[0].text;
|
||||||
const sb = new SelectBox(newOptions, undefined, undefined, undefined, undefined);
|
const sb = new SelectBox(newOptions, undefined!, undefined!, undefined!, undefined!);
|
||||||
|
|
||||||
|
|
||||||
sb.onSelect({
|
sb.onSelect({
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export class AddAccountAction extends Action {
|
|||||||
this.logService.error(`Error while adding account: ${err}`);
|
this.logService.error(`Error while adding account: ${err}`);
|
||||||
this._addAccountErrorEmitter.fire(err);
|
this._addAccountErrorEmitter.fire(err);
|
||||||
this._addAccountCompleteEmitter.fire();
|
this._addAccountCompleteEmitter.fire();
|
||||||
|
return false;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class TestAccountManagementService implements IAccountManagementService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined!);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAccount(accountKey: azdata.AccountKey): Thenable<boolean> {
|
removeAccount(accountKey: azdata.AccountKey): Thenable<boolean> {
|
||||||
@@ -105,7 +105,7 @@ export class AccountProviderStub implements azdata.AccountProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined!);
|
||||||
}
|
}
|
||||||
initialize(storedAccounts: azdata.Account[]): Thenable<azdata.Account[]> {
|
initialize(storedAccounts: azdata.Account[]): Thenable<azdata.Account[]> {
|
||||||
return Promise.resolve(storedAccounts);
|
return Promise.resolve(storedAccounts);
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('createFromStoredProfile should set the id to new guid if not set in stored profile', () => {
|
test('createFromStoredProfile should set the id to new guid if not set in stored profile', () => {
|
||||||
let savedProfile = assign({}, storedProfile, { id: undefined });
|
let savedProfile: IConnectionProfileStore = assign({}, storedProfile, { id: undefined });
|
||||||
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
|
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
|
||||||
assert.equal(savedProfile.groupId, connectionProfile.groupId);
|
assert.equal(savedProfile.groupId, connectionProfile.groupId);
|
||||||
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
|
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
|
||||||
|
|||||||
@@ -33,14 +33,16 @@ export class TestConfigurationService implements IConfigurationService {
|
|||||||
let _target: 'user' | 'workspace' = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
|
let _target: 'user' | 'workspace' = (target as ConfigurationTarget) === ConfigurationTarget.USER ? 'user' : 'workspace';
|
||||||
let keyArray = key.split('.');
|
let keyArray = key.split('.');
|
||||||
let targetObject = this.configuration[_target];
|
let targetObject = this.configuration[_target];
|
||||||
for (let i = 0; i < keyArray.length; i++) {
|
if (targetObject) {
|
||||||
if (i === keyArray.length - 1) {
|
for (let i = 0; i < keyArray.length; i++) {
|
||||||
targetObject[keyArray[i]] = value;
|
if (i === keyArray.length - 1) {
|
||||||
} else {
|
targetObject![keyArray[i]] = value;
|
||||||
if (!targetObject[keyArray[i]]) {
|
} else {
|
||||||
targetObject[keyArray[i]] = {};
|
if (!targetObject![keyArray[i]]) {
|
||||||
|
targetObject![keyArray[i]] = {};
|
||||||
|
}
|
||||||
|
targetObject = targetObject![keyArray[i]];
|
||||||
}
|
}
|
||||||
targetObject = targetObject[keyArray[i]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve(void 0);
|
return Promise.resolve(void 0);
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConnectionCredentials(profileId: string): Promise<{ [name: string]: string }> {
|
getConnectionCredentials(profileId: string): Promise<{ [name: string]: string }> {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined!);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServerInfo(profileId: string): azdata.ServerInfo {
|
getServerInfo(profileId: string): azdata.ServerInfo {
|
||||||
|
|||||||
@@ -3,15 +3,26 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
import { IOpenerService, IOpener, IValidator, IExternalUriResolver, IExternalOpener, ResolveExternalUriOptions, IResolvedExternalUri } from 'vs/platform/opener/common/opener';
|
||||||
|
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
|
|
||||||
|
|
||||||
export class OpenerServiceStub implements IOpenerService {
|
export class OpenerServiceStub implements IOpenerService {
|
||||||
|
registerOpener(opener: IOpener): IDisposable {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
registerValidator(validator: IValidator): IDisposable {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
registerExternalUriResolver(resolver: IExternalUriResolver): IDisposable {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
setExternalOpener(opener: IExternalOpener): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
resolveExternalUri(resource: URI, options?: ResolveExternalUriOptions): Promise<IResolvedExternalUri> {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
registerOpener() { return undefined; }
|
|
||||||
registerValidator() { return undefined; }
|
|
||||||
registerExternalUriResolver() { return undefined; }
|
|
||||||
setExternalOpener() { return undefined; }
|
|
||||||
async open(resource: URI | string, options?: any): Promise<boolean> { return Promise.resolve(true); }
|
async open(resource: URI | string, options?: any): Promise<boolean> { return Promise.resolve(true); }
|
||||||
async resolveExternalUri(uri: any) { return undefined; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export class SerializationService implements ISerializationService {
|
|||||||
|
|
||||||
private createStartRequest(serializationRequest: SerializeDataParams, index: number): azdata.SerializeDataStartRequestParams {
|
private createStartRequest(serializationRequest: SerializeDataParams, index: number): azdata.SerializeDataStartRequestParams {
|
||||||
let batchSize = getBatchSize(serializationRequest.rowCount, index);
|
let batchSize = getBatchSize(serializationRequest.rowCount, index);
|
||||||
let rows = serializationRequest.getRowRange(index, serializationRequest.includeHeaders, batchSize);
|
let rows = serializationRequest.getRowRange(index, serializationRequest.includeHeaders ?? false, batchSize);
|
||||||
let columns: azdata.SimpleColumnInfo[] = serializationRequest.columns.map(c => {
|
let columns: azdata.SimpleColumnInfo[] = serializationRequest.columns.map(c => {
|
||||||
// For now treat all as strings. In the future, would like to use the
|
// For now treat all as strings. In the future, would like to use the
|
||||||
// type info for correct data type mapping
|
// type info for correct data type mapping
|
||||||
@@ -186,7 +186,7 @@ export class SerializationService implements ISerializationService {
|
|||||||
|
|
||||||
private createContinueRequest(serializationRequest: SerializeDataParams, index: number): azdata.SerializeDataContinueRequestParams {
|
private createContinueRequest(serializationRequest: SerializeDataParams, index: number): azdata.SerializeDataContinueRequestParams {
|
||||||
let numberOfRows = getBatchSize(serializationRequest.rowCount, index);
|
let numberOfRows = getBatchSize(serializationRequest.rowCount, index);
|
||||||
let rows = serializationRequest.getRowRange(index, serializationRequest.includeHeaders, numberOfRows);
|
let rows = serializationRequest.getRowRange(index, serializationRequest.includeHeaders ?? false, numberOfRows);
|
||||||
let isLastBatch = index + rows.length >= serializationRequest.rowCount;
|
let isLastBatch = index + rows.length >= serializationRequest.rowCount;
|
||||||
let continueSerializeRequest: azdata.SerializeDataContinueRequestParams = {
|
let continueSerializeRequest: azdata.SerializeDataContinueRequestParams = {
|
||||||
filePath: serializationRequest.filePath,
|
filePath: serializationRequest.filePath,
|
||||||
|
|||||||
@@ -263,4 +263,3 @@ suite('Assessment Actions', () => {
|
|||||||
notificationService.verify(s => s.prompt(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), TypeMoq.Times.once());
|
notificationService.verify(s => s.prompt(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), TypeMoq.Times.once());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"skipLibCheck": true
|
"strictNullChecks": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noImplicitAny": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./typings",
|
"./typings",
|
||||||
@@ -20,12 +23,12 @@
|
|||||||
// "./vs/code/**/*.ts",
|
// "./vs/code/**/*.ts",
|
||||||
"./vs/editor/**/*.ts",
|
"./vs/editor/**/*.ts",
|
||||||
"./vs/platform/**/*.ts",
|
"./vs/platform/**/*.ts",
|
||||||
"./vs/workbench/contrib/debug/common/debugProtocol.d.ts",
|
// "./vs/workbench/contrib/debug/common/debugProtocol.d.ts",
|
||||||
"./vs/workbench/services/**/*.ts",
|
// "./vs/workbench/services/**/*.ts",
|
||||||
"./sql/workbench/services/**/*.ts",
|
|
||||||
"./sql/base/**/*.ts",
|
"./sql/base/**/*.ts",
|
||||||
"./sql/editor/**/*.ts",
|
"./sql/editor/**/*.ts",
|
||||||
"./sql/platform/**/*.ts"
|
"./sql/platform/**/*.ts",
|
||||||
|
// "./sql/workbench/services/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts",
|
"./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user