mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
More work around isolating node imports (#6512)
* more work around isolating node imports * rewrite query plan input * fix hygiene errors * fix tests * address feedback * remove welcome page changes
This commit is contained in:
@@ -41,7 +41,7 @@ import { Schemas } from 'vs/base/common/network';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { NotebookChangeType } from 'sql/workbench/parts/notebook/common/models/contracts';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export interface NotebookProviderProperties {
|
||||
provider: string;
|
||||
@@ -127,7 +127,8 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IFileService private readonly _fileService: IFileService,
|
||||
@ILogService private readonly _logService: ILogService,
|
||||
@IQueryManagementService private readonly _queryManagementService
|
||||
@IQueryManagementService private readonly _queryManagementService: IQueryManagementService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService
|
||||
) {
|
||||
super();
|
||||
this._providersMemento = new Memento('notebookProviders', this._storageService);
|
||||
@@ -152,7 +153,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
this.cleanupProviders();
|
||||
|
||||
// If providers have already registered by this point, add them now (since onHandlerAdded will never fire)
|
||||
if (this._queryManagementService.registeredProviders && this._queryManagementService.registeredProviders.length > 0) {
|
||||
if (this._queryManagementService.getRegisteredProviders().length > 0) {
|
||||
this.updateSQLRegistrationWithConnectionProviders();
|
||||
}
|
||||
|
||||
@@ -169,7 +170,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
this.hookContextKeyListeners();
|
||||
this.hookNotebookThemesAndConfigListener();
|
||||
// Temporary (issue #6427 will remove): Add a product quality key so we can only show books on Insiders
|
||||
this._contextKeyService.createKey<string>('notebookQuality', product.quality);
|
||||
this._contextKeyService.createKey<string>('notebookQuality', environmentService.appQuality);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as os from 'os';
|
||||
import { nb, QueryExecuteSubsetResult, IDbColumn, BatchSummary, IResultMessage, ResultSetSummary } from 'azdata';
|
||||
import { localize } from 'vs/nls';
|
||||
import { FutureInternal, notebookConstants } from 'sql/workbench/parts/notebook/common/models/modelInterfaces';
|
||||
@@ -23,6 +22,8 @@ import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilit
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { ILanguageMagic } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export const sqlKernelError: string = localize("sqlKernelError", "SQL kernel error");
|
||||
export const MAX_ROWS = 5000;
|
||||
@@ -168,7 +169,8 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IErrorMessageService private _errorMessageService: IErrorMessageService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService
|
||||
) {
|
||||
super();
|
||||
this.initMagics();
|
||||
@@ -275,7 +277,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
|
||||
private getCodeWithoutCellMagic(content: nb.IExecuteRequest): string {
|
||||
let code = Array.isArray(content.code) ? content.code.join('') : content.code;
|
||||
let firstLineEnd = code.indexOf(os.EOL);
|
||||
let firstLineEnd = code.indexOf(this.textResourcePropertiesService.getEOL(URI.file(this._path)));
|
||||
let firstLine = code.substring(0, (firstLineEnd >= 0) ? firstLineEnd : 0).trimLeft();
|
||||
if (firstLine.startsWith('%%')) {
|
||||
// Strip out the line
|
||||
|
||||
Reference in New Issue
Block a user