mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -24,7 +24,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
@@ -1085,7 +1084,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (this._savedKernelInfo.display_name !== displayName) {
|
||||
this._savedKernelInfo.display_name = displayName;
|
||||
}
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || displayName.startsWith(kernel.displayName));
|
||||
if (standardKernel && this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
|
||||
this._savedKernelInfo.name = standardKernel.name;
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
|
||||
@@ -7,8 +7,6 @@ import * as path from 'vs/base/common/path';
|
||||
import { nb, ServerInfo } from 'azdata';
|
||||
import { DEFAULT_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_FILETYPE, INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
export const clusterEndpointsProperty = 'clusterEndpoints';
|
||||
export const hadoopEndpointNameGateway = 'gateway';
|
||||
@@ -23,7 +21,7 @@ export function getProvidersForFileName(fileName: string, notebookService: INote
|
||||
let fileExt = path.extname(fileName);
|
||||
let providers: string[];
|
||||
// First try to get provider for actual file type
|
||||
if (fileExt && startsWith(fileExt, '.')) {
|
||||
if (fileExt && fileExt.startsWith('.')) {
|
||||
fileExt = fileExt.slice(1, fileExt.length);
|
||||
providers = notebookService.getProvidersForFileType(fileExt);
|
||||
}
|
||||
@@ -44,7 +42,7 @@ export function getStandardKernelsForProvider(providerId: string, notebookServic
|
||||
}
|
||||
let standardKernels = notebookService.getStandardKernelsForProvider(providerId);
|
||||
standardKernels.forEach(kernel => {
|
||||
assign(<IStandardKernelWithProvider>kernel, {
|
||||
Object.assign(<IStandardKernelWithProvider>kernel, {
|
||||
name: kernel.name,
|
||||
connectionProviderIds: kernel.connectionProviderIds,
|
||||
notebookProvider: providerId
|
||||
|
||||
@@ -87,11 +87,11 @@ class CellDisplayGroup extends DisplayGroup<ICellModel> {
|
||||
}
|
||||
|
||||
hasGraph(cell: ICellModel): boolean {
|
||||
return !!cell.outputs.find((o: nb.IDisplayResult) => o?.output_type === 'display_data' && o?.data.hasOwnProperty('application/vnd.plotly.v1+json'));
|
||||
return !!cell.outputs.find((o: nb.ICellOutput) => o?.output_type === 'display_data' && (o as nb.IDisplayResult)?.data.hasOwnProperty('application/vnd.plotly.v1+json'));
|
||||
}
|
||||
|
||||
hasTable(cell: ICellModel): boolean {
|
||||
return !!cell.outputs.find((o: nb.IDisplayResult) => o?.output_type === 'display_data' && o?.data.hasOwnProperty('application/vnd.dataresource+json'));
|
||||
return !!cell.outputs.find((o: nb.ICellOutput) => o?.output_type === 'display_data' && (o as nb.IDisplayResult)?.data.hasOwnProperty('application/vnd.dataresource+json'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import { ILanguageMagic } from 'sql/workbench/services/notebook/browser/notebook
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getUriPrefix, uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { tryMatchCellMagic } from 'sql/workbench/services/notebook/browser/utils';
|
||||
@@ -357,7 +356,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
let code = Array.isArray(content.code) ? content.code.join('') : content.code;
|
||||
let firstLineEnd = code.indexOf(this.textResourcePropertiesService.getEOL(URI.file(this._path)));
|
||||
let firstLine = code.substring(0, (firstLineEnd >= 0) ? firstLineEnd : 0).trimLeft();
|
||||
if (startsWith(firstLine, '%%')) {
|
||||
if (firstLine.startsWith('%%')) {
|
||||
// Strip out the line
|
||||
code = code.substring(firstLineEnd, code.length);
|
||||
// Try and match to an external script magic. If we add more magics later, should handle transforms better
|
||||
|
||||
Reference in New Issue
Block a user