mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 01:25:38 -05:00
* Revert "Revert "Remove typings and replace missing methods with vscodes (#8217)" (#8240)"
This reverts commit e801a04bcf.
* fix runtime error
* add tests for chartview
This commit is contained in:
@@ -42,6 +42,7 @@ 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 { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
export interface NotebookProviderProperties {
|
||||
provider: string;
|
||||
@@ -212,7 +213,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
let sqlNotebookProvider = this._providerToStandardKernels.get(notebookConstants.SQL);
|
||||
if (sqlNotebookProvider) {
|
||||
let sqlConnectionTypes = this._queryManagementService.getRegisteredProviders();
|
||||
let provider = sqlNotebookProvider.find(p => p.name === notebookConstants.SQL);
|
||||
let provider = find(sqlNotebookProvider, p => p.name === notebookConstants.SQL);
|
||||
if (provider) {
|
||||
this._providerToStandardKernels.set(notebookConstants.SQL, [{
|
||||
name: notebookConstants.SQL,
|
||||
@@ -353,7 +354,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
let managers: INotebookManager[] = this._managersMap.get(uriString);
|
||||
// If manager already exists for a given notebook, return it
|
||||
if (managers) {
|
||||
let index = managers.findIndex(m => m.providerId === providerId);
|
||||
let index = firstIndex(managers, m => m.providerId === providerId);
|
||||
if (index && index >= 0) {
|
||||
return managers[index];
|
||||
}
|
||||
@@ -404,7 +405,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
return undefined;
|
||||
}
|
||||
let uriString = notebookUri.toString();
|
||||
let editor = this.listNotebookEditors().find(n => n.id === uriString);
|
||||
let editor = find(this.listNotebookEditors(), n => n.id === uriString);
|
||||
return editor;
|
||||
}
|
||||
|
||||
@@ -512,7 +513,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
let knownProviders = Object.keys(notebookRegistry.providers);
|
||||
let cache = this.providersMemento.notebookProviderCache;
|
||||
for (let key in cache) {
|
||||
if (!knownProviders.includes(key)) {
|
||||
if (!knownProviders.some(x => x === key)) {
|
||||
this._providers.delete(key);
|
||||
delete cache[key];
|
||||
}
|
||||
@@ -532,7 +533,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
private removeContributedProvidersFromCache(identifier: IExtensionIdentifier, extensionService: IExtensionService) {
|
||||
const notebookProvider = 'notebookProvider';
|
||||
extensionService.getExtensions().then(i => {
|
||||
let extension = i.find(c => c.identifier.value.toLowerCase() === identifier.id.toLowerCase());
|
||||
let extension = find(i, c => c.identifier.value.toLowerCase() === identifier.id.toLowerCase());
|
||||
if (extension && extension.contributes
|
||||
&& extension.contributes[notebookProvider]
|
||||
&& extension.contributes[notebookProvider].providerId) {
|
||||
@@ -584,9 +585,9 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
// 3. Not already saving (e.g. isn't in the queue to be cached)
|
||||
// 4. Notebook is trusted. Don't need to save state of untrusted notebooks
|
||||
let notebookUriString = notebookUri.toString();
|
||||
if (changeType === NotebookChangeType.Saved && this._trustedCacheQueue.findIndex(uri => uri.toString() === notebookUriString) < 0) {
|
||||
if (changeType === NotebookChangeType.Saved && firstIndex(this._trustedCacheQueue, uri => uri.toString() === notebookUriString) < 0) {
|
||||
// Only save if it's trusted
|
||||
let notebook = this.listNotebookEditors().find(n => n.id === notebookUriString);
|
||||
let notebook = find(this.listNotebookEditors(), n => n.id === notebookUriString);
|
||||
if (notebook && notebook.model.trustedMode) {
|
||||
this._trustedCacheQueue.push(notebookUri);
|
||||
this._updateTrustCacheScheduler.schedule();
|
||||
|
||||
Reference in New Issue
Block a user