mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add app quality to extension API (#20731)
* Add app quality to extension API * Comment * Special case rc1 to stable
This commit is contained in:
@@ -128,11 +128,10 @@ export async function getParallelMessageProcessingConfig(): Promise<boolean> {
|
|||||||
if (!config) {
|
if (!config) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const quality = await getProductQuality();
|
|
||||||
const setting = config.inspect(parallelMessageProcessingConfig);
|
const setting = config.inspect(parallelMessageProcessingConfig);
|
||||||
// For dev environment, we want to enable the feature by default unless it is set explicitely.
|
// For dev environment, we want to enable the feature by default unless it is set explicitely.
|
||||||
// Note: the quality property is not set for dev environment, we can use this to determine whether it is dev environment.
|
// Note: the quality property is not set for dev environment, we can use this to determine whether it is dev environment.
|
||||||
return (quality === undefined && setting.globalValue === undefined && setting.workspaceValue === undefined) ? true : config[parallelMessageProcessingConfig];
|
return (azdata.env.quality === azdata.env.AppQuality.dev && setting.globalValue === undefined && setting.workspaceValue === undefined) ? true : config[parallelMessageProcessingConfig];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLogFileName(prefix: string, pid: number): string {
|
export function getLogFileName(prefix: string, pid: number): string {
|
||||||
@@ -396,7 +395,3 @@ export async function getOrDownloadServer(config: IConfig, handleServerEvent?: (
|
|||||||
return serverdownloader.getOrDownloadServer();
|
return serverdownloader.getOrDownloadServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getProductQuality(): Promise<string> {
|
|
||||||
const content = await fs.readFile(path.join(vscode.env.appRoot, 'product.json'));
|
|
||||||
return JSON.parse(content?.toString())?.quality;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ import { sendSettingChangedEvent, TelemetryActions, TelemetryReporter, Telemetry
|
|||||||
|
|
||||||
const STORAGE_IV_KEY = 'queryHistory.storage-iv';
|
const STORAGE_IV_KEY = 'queryHistory.storage-iv';
|
||||||
const STORAGE_KEY_KEY = 'queryHistory.storage-key';
|
const STORAGE_KEY_KEY = 'queryHistory.storage-key';
|
||||||
const HISTORY_STORAGE_FILE_NAME = 'queryHistory.bin';
|
// We use a different file for every flavor of ADS because the secret storage is unique per-flavor and so we will have
|
||||||
|
// a different key/IV pair for each flavor with no easy way to transfer/read them. This means that each flavor of ADS
|
||||||
|
// will have its own unique history - even if they're all stored in the same location.
|
||||||
|
const HISTORY_STORAGE_FILE_NAME = azdata.env.quality === azdata.env.AppQuality.stable ? 'queryHistory.bin' : `queryHistory.${azdata.env.quality}.bin`;
|
||||||
const STORAGE_ENCRYPTION_ALGORITHM = 'aes-256-ctr';
|
const STORAGE_ENCRYPTION_ALGORITHM = 'aes-256-ctr';
|
||||||
const HISTORY_DEBOUNCE_MS = 10000;
|
const HISTORY_DEBOUNCE_MS = 10000;
|
||||||
const DEFAULT_CAPTURE_ENABLED = true;
|
const DEFAULT_CAPTURE_ENABLED = true;
|
||||||
|
|||||||
17
src/sql/azdata.proposed.d.ts
vendored
17
src/sql/azdata.proposed.d.ts
vendored
@@ -8,6 +8,23 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
declare module 'azdata' {
|
declare module 'azdata' {
|
||||||
|
|
||||||
|
export namespace env {
|
||||||
|
/**
|
||||||
|
* Well-known app quality values
|
||||||
|
*/
|
||||||
|
export enum AppQuality {
|
||||||
|
stable = 'stable',
|
||||||
|
insider = 'insider',
|
||||||
|
dev = 'dev'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of Azure Data Studio this is currently running as - such as `stable`, or `insider`
|
||||||
|
*/
|
||||||
|
export const quality: AppQuality | string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
export namespace nb {
|
export namespace nb {
|
||||||
export interface NotebookDocument {
|
export interface NotebookDocument {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -606,6 +606,15 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
|||||||
ExecutionPlanGraphElementPropertyBetterValue: sqlExtHostTypes.executionPlan.ExecutionPlanGraphElementPropertyBetterValue
|
ExecutionPlanGraphElementPropertyBetterValue: sqlExtHostTypes.executionPlan.ExecutionPlanGraphElementPropertyBetterValue
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Dev/OSS builds don't have a quality set - give it a value here so it's more clear
|
||||||
|
let quality = initData.quality || 'dev';
|
||||||
|
// Special case rc1 quality, that should be treated as stable by extensions
|
||||||
|
quality = quality === 'rc1' ? 'stable' : quality;
|
||||||
|
const env: typeof azdata.env = {
|
||||||
|
AppQuality: sqlExtHostTypes.env.AppQuality,
|
||||||
|
quality
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: initData.version,
|
version: initData.version,
|
||||||
accounts,
|
accounts,
|
||||||
@@ -658,7 +667,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
|||||||
sqlAssessment,
|
sqlAssessment,
|
||||||
TextType: sqlExtHostTypes.TextType,
|
TextType: sqlExtHostTypes.TextType,
|
||||||
designers: designers,
|
designers: designers,
|
||||||
executionPlan: executionPlan
|
executionPlan: executionPlan,
|
||||||
|
env
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
extHostNotebook: extHostNotebook,
|
extHostNotebook: extHostNotebook,
|
||||||
|
|||||||
@@ -1058,3 +1058,14 @@ export namespace executionPlan {
|
|||||||
None = 4
|
None = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export namespace env {
|
||||||
|
/**
|
||||||
|
* Well-known app quality values
|
||||||
|
*/
|
||||||
|
export enum AppQuality {
|
||||||
|
stable = 'stable',
|
||||||
|
insider = 'insider',
|
||||||
|
dev = 'dev'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ export interface IWorkspaceData extends IStaticWorkspaceData {
|
|||||||
export interface IInitData {
|
export interface IInitData {
|
||||||
version: string;
|
version: string;
|
||||||
vscodeVersion: string; // {{SQL CARBON EDIT}} add vscodeVersion
|
vscodeVersion: string; // {{SQL CARBON EDIT}} add vscodeVersion
|
||||||
|
quality?: string; // {{SQL CARBON EDIT}} add quality
|
||||||
commit?: string;
|
commit?: string;
|
||||||
parentPid: number;
|
parentPid: number;
|
||||||
environment: IEnvironment;
|
environment: IEnvironment;
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
|
|||||||
commit: this._productService.commit,
|
commit: this._productService.commit,
|
||||||
version: this._productService.version,
|
version: this._productService.version,
|
||||||
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
||||||
|
quality: this._productService.quality, // {{SQL CARBON EDIT}} Add quality
|
||||||
parentPid: -1,
|
parentPid: -1,
|
||||||
environment: {
|
environment: {
|
||||||
isExtensionDevelopmentDebug: this._environmentService.debugRenderer,
|
isExtensionDevelopmentDebug: this._environmentService.debugRenderer,
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
|
|||||||
commit: this._productService.commit,
|
commit: this._productService.commit,
|
||||||
version: this._productService.version,
|
version: this._productService.version,
|
||||||
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
||||||
|
quality: this._productService.quality, // {{SQL CARBON EDIT}} Add quality
|
||||||
parentPid: remoteInitData.pid,
|
parentPid: remoteInitData.pid,
|
||||||
environment: {
|
environment: {
|
||||||
isExtensionDevelopmentDebug,
|
isExtensionDevelopmentDebug,
|
||||||
|
|||||||
@@ -550,6 +550,7 @@ export class LocalProcessExtensionHost implements IExtensionHost {
|
|||||||
commit: this._productService.commit,
|
commit: this._productService.commit,
|
||||||
version: this._productService.version,
|
version: this._productService.version,
|
||||||
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
vscodeVersion: this._productService.vscodeVersion, // {{SQL CARBON EDIT}} add vscode version
|
||||||
|
quality: this._productService.quality, // {{SQL CARBON EDIT}} Add quality
|
||||||
parentPid: process.pid,
|
parentPid: process.pid,
|
||||||
environment: {
|
environment: {
|
||||||
isExtensionDevelopmentDebug: this._isExtensionDevDebug,
|
isExtensionDevelopmentDebug: this._isExtensionDevDebug,
|
||||||
|
|||||||
Reference in New Issue
Block a user