mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 17:23:31 -05:00
Refact/idea lastknown (#501)
* close * connection is working * formatting * adds all * formatting * removed unneeded logging * readd npm shrinkwrap * addressed comments * fix capabilities cacheing * updated shrinkwrap * fixed tests * remove dead code * vbump sqltools
This commit is contained in:
@@ -5,11 +5,8 @@
|
||||
'use strict';
|
||||
|
||||
import { ExtensionContext, workspace, window, OutputChannel, languages } from 'vscode';
|
||||
import {
|
||||
LanguageClient, LanguageClientOptions, ServerOptions,
|
||||
TransportKind, RequestType, NotificationType, NotificationHandler,
|
||||
ErrorAction, CloseAction
|
||||
} from 'dataprotocol-client';
|
||||
import { SqlOpsDataClient, LanguageClientOptions } from 'dataprotocol-client';
|
||||
import { CloseAction, ErrorAction, ServerOptions, NotificationHandler, NotificationType, RequestType, TransportKind } from 'vscode-languageclient';
|
||||
|
||||
import { VscodeWrapper } from '../controllers/vscodeWrapper';
|
||||
import { Telemetry } from '../models/telemetry';
|
||||
@@ -135,14 +132,14 @@ export class SqlToolsServiceClient {
|
||||
}
|
||||
|
||||
// VS Code Language Client
|
||||
private _client: LanguageClient = undefined;
|
||||
private _client: SqlOpsDataClient = undefined;
|
||||
|
||||
// getter method for the Language Client
|
||||
private get client(): LanguageClient {
|
||||
private get client(): SqlOpsDataClient {
|
||||
return this._client;
|
||||
}
|
||||
|
||||
private set client(client: LanguageClient) {
|
||||
private set client(client: SqlOpsDataClient) {
|
||||
this._client = client;
|
||||
}
|
||||
|
||||
@@ -233,6 +230,7 @@ export class SqlToolsServiceClient {
|
||||
}
|
||||
|
||||
this._logger.appendLine();
|
||||
|
||||
this._server.getServerPath(platformInfo.runtimeId).then(serverPath => {
|
||||
if (serverPath === undefined) {
|
||||
// Check if the service already installed and if not open the output channel to show the logs
|
||||
@@ -319,9 +317,9 @@ export class SqlToolsServiceClient {
|
||||
}
|
||||
}
|
||||
|
||||
public createClient(context: ExtensionContext, runtimeId: Runtime, languageClientHelper: LanguageServiceContracts.ILanguageClientHelper, executableFiles: string[]): Promise<LanguageClient> {
|
||||
return new Promise<LanguageClient>((resolve, reject) => {
|
||||
let client: LanguageClient;
|
||||
public createClient(context: ExtensionContext, runtimeId: Runtime, languageClientHelper: LanguageServiceContracts.ILanguageClientHelper, executableFiles: string[]): Promise<SqlOpsDataClient> {
|
||||
return new Promise<SqlOpsDataClient>((resolve, reject) => {
|
||||
let client: SqlOpsDataClient;
|
||||
this._server.findServerPath(this.installDirectory, executableFiles).then(serverPath => {
|
||||
if (serverPath === undefined) {
|
||||
reject(new Error(SqlToolsServiceClient._constants.invalidServiceFilePath));
|
||||
@@ -342,7 +340,7 @@ export class SqlToolsServiceClient {
|
||||
};
|
||||
this._serviceStatus.showServiceLoading();
|
||||
// cache the client instance for later use
|
||||
client = new LanguageClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
client = new SqlOpsDataClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
|
||||
if (context !== undefined) {
|
||||
// Create the language client and start the client.
|
||||
@@ -389,7 +387,7 @@ export class SqlToolsServiceClient {
|
||||
return serverOptions;
|
||||
}
|
||||
|
||||
private createLanguageClient(serverOptions: ServerOptions): LanguageClient {
|
||||
private createLanguageClient(serverOptions: ServerOptions): SqlOpsDataClient {
|
||||
// Options to control the language client
|
||||
let clientOptions: LanguageClientOptions = {
|
||||
documentSelector: [SqlToolsServiceClient._constants.languageId],
|
||||
@@ -403,7 +401,7 @@ export class SqlToolsServiceClient {
|
||||
|
||||
this._serviceStatus.showServiceLoading();
|
||||
// cache the client instance for later use
|
||||
let client = new LanguageClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
let client = new SqlOpsDataClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
client.onReady().then(() => {
|
||||
this.checkServiceCompatibility();
|
||||
this._serviceStatus.showServiceLoaded();
|
||||
@@ -449,7 +447,7 @@ export class SqlToolsServiceClient {
|
||||
* @param params The params to pass with the request
|
||||
* @returns A thenable object for when the request receives a response
|
||||
*/
|
||||
public sendRequest<P, R, E>(type: RequestType<P, R, E>, params?: P, client: LanguageClient = undefined): Thenable<R> {
|
||||
public sendRequest<P, R, E, RO>(type: RequestType<P, R, E, RO>, params?: P, client: SqlOpsDataClient = undefined): Thenable<R> {
|
||||
if (client === undefined) {
|
||||
client = this._client;
|
||||
}
|
||||
@@ -463,7 +461,7 @@ export class SqlToolsServiceClient {
|
||||
* @param type The notification type to register the handler for
|
||||
* @param handler The handler to register
|
||||
*/
|
||||
public onNotification<P>(type: NotificationType<P>, handler: NotificationHandler<P>, client: LanguageClient = undefined): void {
|
||||
public onNotification<P, RO>(type: NotificationType<P, RO>, handler: NotificationHandler<P>, client: SqlOpsDataClient = undefined): void {
|
||||
if (client === undefined) {
|
||||
client = this._client;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { RequestType } from 'dataprotocol-client';
|
||||
import { RequestType } from 'vscode-languageclient';
|
||||
import { Runtime, LinuxDistribution } from '../platform';
|
||||
|
||||
// --------------------------------- < Version Request > -------------------------------------------------
|
||||
|
||||
// Version request message callback declaration
|
||||
export namespace VersionRequest {
|
||||
export const type: RequestType<void, VersionResult, void> = { get method(): string { return 'version'; } };
|
||||
export const type = new RequestType<void, VersionResult, void, void>('version');
|
||||
}
|
||||
|
||||
// Version response format
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { NotificationType, ServerOptions } from 'dataprotocol-client';
|
||||
import { NotificationType, ServerOptions } from 'vscode-languageclient';
|
||||
import { ITelemetryEventProperties, ITelemetryEventMeasures } from '../telemetry';
|
||||
import { Runtime } from '../platform';
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Runtime } from '../platform';
|
||||
* Event sent when the language service send a telemetry event
|
||||
*/
|
||||
export namespace TelemetryNotification {
|
||||
export const type: NotificationType<TelemetryParams> = { get method(): string { return 'telemetry/sqlevent'; } };
|
||||
export const type = new NotificationType<TelemetryParams, void>('telemetry/sqlevent');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ export class TelemetryParams {
|
||||
* Event sent when the language service send a status change event
|
||||
*/
|
||||
export namespace StatusChangedNotification {
|
||||
export const type: NotificationType<StatusChangeParams> = { get method(): string { return 'textDocument/statusChanged'; } };
|
||||
export const type = new NotificationType<StatusChangeParams, void>('textDocument/statusChanged');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user