Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update languageserver-client #1662

Merged
merged 6 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 39 additions & 52 deletions extensions/ql-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/github/vscode-codeql"
},
"engines": {
"vscode": "^1.59.0",
"vscode": "^1.67.0",
"node": "^16.13.0",
"npm": ">=7.20.6"
},
Expand Down Expand Up @@ -1321,8 +1321,8 @@
"tree-kill": "~1.2.2",
"unzipper": "~0.10.5",
"vscode-extension-telemetry": "^0.1.6",
"vscode-jsonrpc": "^5.0.1",
"vscode-languageclient": "^6.1.3",
"vscode-jsonrpc": "^8.0.2",
"vscode-languageclient": "^8.0.2",
"vscode-test-adapter-api": "~1.7.0",
"vscode-test-adapter-util": "~0.7.0",
"zip-a-folder": "~1.1.3"
Expand Down
10 changes: 7 additions & 3 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ProviderResult,
version as vscodeVersion,
} from "vscode";
import { LanguageClient } from "vscode-languageclient";
import { LanguageClient } from "vscode-languageclient/node";
import * as os from "os";
import * as fs from "fs-extra";
import * as path from "path";
Expand Down Expand Up @@ -1422,8 +1422,12 @@ async function activateWithInstalledDistribution(
ctx.subscriptions.push(new SummaryLanguageSupport());

void logger.log("Starting language server.");
ctx.subscriptions.push(client.start());

await client.start();
ctx.subscriptions.push({
dispose: () => {
void client.stop();
},
});
// Jump-to-definition and find-references
void logger.log("Registering jump-to-definition handlers.");

Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/ide-server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProgressLocation, window } from "vscode";
import { StreamInfo } from "vscode-languageclient";
import { StreamInfo } from "vscode-languageclient/node";
import * as cli from "./cli";
import { QueryServerConfig } from "./config";
import { ideServerLogger } from "./logging";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from "fs-extra";

import { DisposableObject } from "../pure/disposable-object";
import { CancellationToken, commands } from "vscode";
import { createMessageConnection, RequestType } from "vscode-jsonrpc";
import { createMessageConnection, RequestType } from "vscode-jsonrpc/node";
import * as cli from "../cli";
import { QueryServerConfig } from "../config";
import { Logger, ProgressReporter } from "../logging";
Expand Down Expand Up @@ -237,8 +237,8 @@ export class QueryServerClient extends DisposableObject {
return this.serverProcess!.child.pid || 0;
}

async sendRequest<P, R, E, RO>(
type: RequestType<WithProgressId<P>, R, E, RO>,
async sendRequest<P, R, E>(
type: RequestType<WithProgressId<P>, R, E>,
parameter: P,
token?: CancellationToken,
progress?: (res: ProgressMessage) => void,
Expand Down
7 changes: 5 additions & 2 deletions extensions/ql-vscode/src/legacy-query-server/run-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from "fs-extra";
import * as tmp from "tmp-promise";
import * as path from "path";
import { CancellationToken, Uri } from "vscode";
import { ErrorCodes, ResponseError } from "vscode-languageclient";
import { LSPErrorCodes, ResponseError } from "vscode-languageclient";

import * as cli from "../cli";
import { DatabaseItem } from "../databases";
Expand Down Expand Up @@ -480,7 +480,10 @@ export async function compileAndRunQueryAgainstDatabase(
try {
errors = await query.compile(qs, qlProgram, progress, token);
} catch (e) {
if (e instanceof ResponseError && e.code == ErrorCodes.RequestCancelled) {
if (
e instanceof ResponseError &&
e.code == LSPErrorCodes.RequestCancelled
) {
return createSyntheticResult(query, "Query cancelled");
} else {
throw e;
Expand Down
15 changes: 0 additions & 15 deletions extensions/ql-vscode/src/pure/legacy-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,6 @@ export type ProgressMessage = shared.ProgressMessage;
export const checkQuery = new rpc.RequestType<
WithProgressId<CheckQueryParams>,
CheckQueryResult,
void,
void
>("compilation/checkQuery");
/**
Expand All @@ -982,7 +981,6 @@ export const checkQuery = new rpc.RequestType<
export const compileQuery = new rpc.RequestType<
WithProgressId<CompileQueryParams>,
CheckQueryResult,
void,
void
>("compilation/compileQuery");
/**
Expand All @@ -991,7 +989,6 @@ export const compileQuery = new rpc.RequestType<
export const compileDilQuery = new rpc.RequestType<
WithProgressId<CompileDilParams>,
CheckQueryResult,
void,
void
>("compilation/compileDilQuery");

Expand All @@ -1001,7 +998,6 @@ export const compileDilQuery = new rpc.RequestType<
export const checkUpgrade = new rpc.RequestType<
WithProgressId<UpgradeParams>,
CheckUpgradeResult,
void,
void
>("compilation/checkUpgrade");
/**
Expand All @@ -1010,7 +1006,6 @@ export const checkUpgrade = new rpc.RequestType<
export const compileUpgrade = new rpc.RequestType<
WithProgressId<CompileUpgradeParams>,
CompileUpgradeResult,
void,
void
>("compilation/compileUpgrade");
/**
Expand All @@ -1019,7 +1014,6 @@ export const compileUpgrade = new rpc.RequestType<
export const compileUpgradeSequence = new rpc.RequestType<
WithProgressId<CompileUpgradeSequenceParams>,
CompileUpgradeSequenceResult,
void,
void
>("compilation/compileUpgradeSequence");

Expand All @@ -1029,7 +1023,6 @@ export const compileUpgradeSequence = new rpc.RequestType<
export const startLog = new rpc.RequestType<
WithProgressId<StartLogParams>,
StartLogResult,
void,
void
>("evaluation/startLog");

Expand All @@ -1039,7 +1032,6 @@ export const startLog = new rpc.RequestType<
export const endLog = new rpc.RequestType<
WithProgressId<EndLogParams>,
EndLogResult,
void,
void
>("evaluation/endLog");

Expand All @@ -1049,7 +1041,6 @@ export const endLog = new rpc.RequestType<
export const clearCache = new rpc.RequestType<
WithProgressId<ClearCacheParams>,
ClearCacheResult,
void,
void
>("evaluation/clearCache");
/**
Expand All @@ -1058,7 +1049,6 @@ export const clearCache = new rpc.RequestType<
export const trimCache = new rpc.RequestType<
WithProgressId<TrimCacheParams>,
ClearCacheResult,
void,
void
>("evaluation/trimCache");

Expand All @@ -1068,7 +1058,6 @@ export const trimCache = new rpc.RequestType<
export const runQueries = new rpc.RequestType<
WithProgressId<EvaluateQueriesParams>,
EvaluationComplete,
void,
void
>("evaluation/runQueries");

Expand All @@ -1078,21 +1067,18 @@ export const runQueries = new rpc.RequestType<
export const runUpgrade = new rpc.RequestType<
WithProgressId<RunUpgradeParams>,
RunUpgradeResult,
void,
void
>("evaluation/runUpgrade");

export const registerDatabases = new rpc.RequestType<
WithProgressId<RegisterDatabasesParams>,
RegisterDatabasesResult,
void,
void
>("evaluation/registerDatabases");

export const deregisterDatabases = new rpc.RequestType<
WithProgressId<DeregisterDatabasesParams>,
DeregisterDatabasesResult,
void,
void
>("evaluation/deregisterDatabases");

Expand All @@ -1103,7 +1089,6 @@ export const deregisterDatabases = new rpc.RequestType<
export const completeQuery = new rpc.RequestType<
EvaluationResult,
Record<string, any>,
void,
void
>("evaluation/queryCompleted");

Expand Down
2 changes: 1 addition & 1 deletion extensions/ql-vscode/src/pure/messages-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ export interface ProgressMessage {
/**
* A notification that the progress has been changed.
*/
export const progress = new rpc.NotificationType<ProgressMessage, void>(
export const progress = new rpc.NotificationType<ProgressMessage>(
"ql/progressUpdated",
);
Loading