Remove logging and clone utlities (#5309)

* remove log utility functions; remove custom mixin

* fix tests

* add log service as required by telemetry utils

* remove unused code

* replace some console.logs with logservice
This commit is contained in:
Anthony Dresser
2019-05-04 22:37:15 -07:00
committed by GitHub
parent df7645e4e5
commit ab0cd71d10
80 changed files with 439 additions and 383 deletions

View File

@@ -1,7 +1,8 @@
// Adapted from https://github.com/naresh-n/slickgrid-column-data-autosize/blob/master/src/slick.autocolumnsize.js
import { mixin, clone } from 'sql/base/common/objects';
import { mixin } from 'sql/base/common/objects';
import { isInDOM } from 'vs/base/browser/dom';
import { deepClone } from 'vs/base/common/objects';
export interface IAutoColumnSizeOptions extends Slick.PluginOptions {
maxWidth?: number;
@@ -71,7 +72,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
if (headerColumnsQuery && headerColumnsQuery.length) {
let headerColumns = headerColumnsQuery[0];
let origCols = this._grid.getColumns();
let allColumns = clone(origCols);
let allColumns = deepClone(origCols);
allColumns.forEach((col, index) => {
col.formatter = origCols[index].formatter;
col.asyncPostRender = origCols[index].asyncPostRender;
@@ -117,7 +118,7 @@ export class AutoColumnSize<T> implements Slick.Plugin<T> {
let headerWidth = this.getElementWidth(headerEl[0]);
let colIndex = this._grid.getColumnIndex(columnDef.id!);
let origCols = this._grid.getColumns();
let allColumns = clone(origCols);
let allColumns = deepClone(origCols);
allColumns.forEach((col, index) => {
col.formatter = origCols[index].formatter;
col.asyncPostRender = origCols[index].asyncPostRender;

View File

@@ -1,16 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function log(...args: any[]): void {
console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
}
export function warn(...args: any[]): void {
console.warn(`\x1b[93m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
}
export function error(...args: any[]) {
console.error(`\x1b[91m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
}

View File

@@ -5,25 +5,6 @@
import * as Types from 'vs/base/common/types';
export function clone<T>(obj: T): T {
if (!obj || typeof obj !== 'object') {
return obj;
}
if (obj instanceof RegExp) {
// See https://github.com/Microsoft/TypeScript/issues/10990
return obj as any;
}
const result = (Array.isArray(obj)) ? <any>[] : <any>{};
Object.keys(obj).forEach(key => {
if (obj[key] && typeof obj[key] === 'object') {
result[key] = clone(obj[key]);
} else {
result[key] = obj[key];
}
});
return result;
}
/**
* A copy of the vs mixin that accepts a custom behavior function
*/