mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 01:25:38 -05:00
Add STS root folder override (#16927)
* Add STS root folder override * Display message to user * Show once for any service
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ServerProvider, IConfig, Events } from '@microsoft/ads-service-downloader';
|
||||
import { IConfig, Events } from '@microsoft/ads-service-downloader';
|
||||
import { ServerOptions, TransportKind } from 'vscode-languageclient';
|
||||
import * as Constants from './constants';
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { getCommonLaunchArgsAndCleanupOldLogFiles } from './utils';
|
||||
import { getCommonLaunchArgsAndCleanupOldLogFiles, getOrDownloadServer } from './utils';
|
||||
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature } from './features';
|
||||
@@ -82,10 +82,7 @@ export class SqlToolsServer {
|
||||
this.config.installDirectory = path.join(configDir, this.config.installDirectory);
|
||||
this.config.proxy = vscode.workspace.getConfiguration('http').get('proxy');
|
||||
this.config.strictSSL = vscode.workspace.getConfiguration('http').get('proxyStrictSSL') || true;
|
||||
|
||||
const serverdownloader = new ServerProvider(this.config);
|
||||
serverdownloader.eventEmitter.onAny(generateHandleServerProviderEvent());
|
||||
return serverdownloader.getOrDownloadServer();
|
||||
return getOrDownloadServer(this.config, handleServerProviderEvent);
|
||||
}
|
||||
|
||||
private activateFeatures(context: AppContext): Promise<void> {
|
||||
@@ -109,39 +106,37 @@ function generateServerOptions(logPath: string, executablePath: string): ServerO
|
||||
return { command: executablePath, args: launchArgs, transport: TransportKind.stdio };
|
||||
}
|
||||
|
||||
function generateHandleServerProviderEvent() {
|
||||
function handleServerProviderEvent(e: string, ...args: any[]): void {
|
||||
let dots = 0;
|
||||
return (e: string, ...args: any[]) => {
|
||||
switch (e) {
|
||||
case Events.INSTALL_START:
|
||||
outputChannel.show(true);
|
||||
statusView.show();
|
||||
outputChannel.appendLine(localize('installingServiceChannelMsg', "Installing {0} to {1}", Constants.serviceName, args[0]));
|
||||
statusView.text = localize('installingServiceStatusMsg', "Installing {0}", Constants.serviceName);
|
||||
break;
|
||||
case Events.INSTALL_END:
|
||||
outputChannel.appendLine(localize('installedServiceChannelMsg', "Installed {0}", Constants.serviceName));
|
||||
break;
|
||||
case Events.DOWNLOAD_START:
|
||||
outputChannel.appendLine(localize('downloadingServiceChannelMsg', "Downloading {0}", args[0]));
|
||||
outputChannel.append(localize('downloadingServiceSizeChannelMsg', "({0} KB)", Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
|
||||
statusView.text = localize('downloadingServiceStatusMsg', "Downloading {0}", Constants.serviceName);
|
||||
break;
|
||||
case Events.DOWNLOAD_PROGRESS:
|
||||
let newDots = Math.ceil(args[0] / 5);
|
||||
if (newDots > dots) {
|
||||
outputChannel.append('.'.repeat(newDots - dots));
|
||||
dots = newDots;
|
||||
}
|
||||
break;
|
||||
case Events.DOWNLOAD_END:
|
||||
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', "Done installing {0}", Constants.serviceName));
|
||||
break;
|
||||
case Events.ENTRY_EXTRACTED:
|
||||
outputChannel.appendLine(localize('entryExtractedChannelMsg', "Extracted {0} ({1}/{2})", args[0], args[1], args[2]));
|
||||
break;
|
||||
}
|
||||
};
|
||||
switch (e) {
|
||||
case Events.INSTALL_START:
|
||||
outputChannel.show(true);
|
||||
statusView.show();
|
||||
outputChannel.appendLine(localize('installingServiceChannelMsg', "Installing {0} to {1}", Constants.serviceName, args[0]));
|
||||
statusView.text = localize('installingServiceStatusMsg', "Installing {0}", Constants.serviceName);
|
||||
break;
|
||||
case Events.INSTALL_END:
|
||||
outputChannel.appendLine(localize('installedServiceChannelMsg', "Installed {0}", Constants.serviceName));
|
||||
break;
|
||||
case Events.DOWNLOAD_START:
|
||||
outputChannel.appendLine(localize('downloadingServiceChannelMsg', "Downloading {0}", args[0]));
|
||||
outputChannel.append(localize('downloadingServiceSizeChannelMsg', "({0} KB)", Math.ceil(args[1] / 1024).toLocaleString(vscode.env.language)));
|
||||
statusView.text = localize('downloadingServiceStatusMsg', "Downloading {0}", Constants.serviceName);
|
||||
break;
|
||||
case Events.DOWNLOAD_PROGRESS:
|
||||
let newDots = Math.ceil(args[0] / 5);
|
||||
if (newDots > dots) {
|
||||
outputChannel.append('.'.repeat(newDots - dots));
|
||||
dots = newDots;
|
||||
}
|
||||
break;
|
||||
case Events.DOWNLOAD_END:
|
||||
outputChannel.appendLine(localize('downloadServiceDoneChannelMsg', "Done installing {0}", Constants.serviceName));
|
||||
break;
|
||||
case Events.ENTRY_EXTRACTED:
|
||||
outputChannel.appendLine(localize('entryExtractedChannelMsg', "Extracted {0} ({1}/{2})", args[0], args[1], args[2]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getClientOptions(context: AppContext): ClientOptions {
|
||||
|
||||
Reference in New Issue
Block a user