Skip to content

Commit 2b6ec73

Browse files
authored
Merge pull request #3250 from github/koesie10/rename-ide-server
Remove outdated IDE server name in favor of language client
2 parents 9798037 + 479aa68 commit 2b6ec73

File tree

5 files changed

+32
-30
lines changed

5 files changed

+32
-30
lines changed

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ function isEnvTrue(name: string): boolean {
16571657
);
16581658
}
16591659

1660-
export function shouldDebugIdeServer() {
1660+
export function shouldDebugLanguageServer() {
16611661
return isEnvTrue("IDE_SERVER_JAVA_DEBUG");
16621662
}
16631663

extensions/ql-vscode/src/common/logging/vscode/loggers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const extLogger = new OutputChannelLogger("CodeQL Extension Log");
1111
export const queryServerLogger = new OutputChannelLogger("CodeQL Query Server");
1212

1313
// Logger for messages from the language server.
14-
export const ideServerLogger = new OutputChannelLogger(
14+
export const languageServerLogger = new OutputChannelLogger(
1515
"CodeQL Language Server",
1616
);
1717

extensions/ql-vscode/src/extension.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
} from "./config";
3535
import {
3636
AstViewer,
37-
createIDEServer,
37+
createLanguageClient,
3838
getQueryEditorCommands,
3939
install,
4040
TemplatePrintAstProvider,
@@ -84,7 +84,7 @@ import {
8484
import type { ProgressReporter } from "./common/logging/vscode";
8585
import {
8686
extLogger,
87-
ideServerLogger,
87+
languageServerLogger,
8888
queryServerLogger,
8989
} from "./common/logging/vscode";
9090
import { QueryHistoryManager } from "./query-history/query-history-manager";
@@ -171,7 +171,7 @@ function getCommands(
171171
app: App,
172172
cliServer: CodeQLCliServer,
173173
queryRunner: QueryRunner,
174-
ideServer: LanguageClient,
174+
languageClient: LanguageClient,
175175
): BaseCommands {
176176
const getCliVersion = async () => {
177177
try {
@@ -189,10 +189,10 @@ function getCommands(
189189
await Promise.all([
190190
queryRunner.restartQueryServer(progress, token),
191191
async () => {
192-
if (ideServer.isRunning()) {
193-
await ideServer.restart();
192+
if (languageClient.isRunning()) {
193+
await languageClient.restart();
194194
} else {
195-
await ideServer.start();
195+
await languageClient.start();
196196
}
197197
},
198198
]);
@@ -942,7 +942,7 @@ async function activateWithInstalledDistribution(
942942
ctx.subscriptions.push(tmpDirDisposal);
943943

944944
void extLogger.log("Initializing CodeQL language server.");
945-
const ideServer = createIDEServer(qlConfigurationListener);
945+
const languageClient = createLanguageClient(qlConfigurationListener);
946946

947947
const localQueries = new LocalQueries(
948948
app,
@@ -1008,7 +1008,7 @@ async function activateWithInstalledDistribution(
10081008
void extLogger.log("Registering top-level command palette commands.");
10091009

10101010
const allCommands: AllExtensionCommands = {
1011-
...getCommands(app, cliServer, qs, ideServer),
1011+
...getCommands(app, cliServer, qs, languageClient),
10121012
...getQueryEditorCommands({
10131013
commandManager: app.commands,
10141014
queryRunner: qs,
@@ -1055,21 +1055,21 @@ async function activateWithInstalledDistribution(
10551055
}
10561056

10571057
void extLogger.log("Starting language server.");
1058-
await ideServer.start();
1058+
await languageClient.start();
10591059
ctx.subscriptions.push({
10601060
dispose: () => {
1061-
void ideServer.stop();
1061+
void languageClient.stop();
10621062
},
10631063
});
10641064

1065-
// Handle visibility changes in the ideserver
1065+
// Handle visibility changes in the CodeQL language client.
10661066
if (await cliServer.cliConstraints.supportsVisibilityNotifications()) {
10671067
Window.onDidChangeVisibleTextEditors((editors) => {
1068-
ideServer.notifyVisibilityChange(editors);
1068+
languageClient.notifyVisibilityChange(editors);
10691069
});
10701070
// Send an inital notification to the language server
10711071
// to set the initial state of the visible editors.
1072-
ideServer.notifyVisibilityChange(Window.visibleTextEditors);
1072+
languageClient.notifyVisibilityChange(Window.visibleTextEditors);
10731073
}
10741074

10751075
// Jump-to-definition and find-references
@@ -1251,7 +1251,7 @@ function getContextStoragePath(ctx: ExtensionContext) {
12511251
async function initializeLogging(ctx: ExtensionContext): Promise<void> {
12521252
ctx.subscriptions.push(extLogger);
12531253
ctx.subscriptions.push(queryServerLogger);
1254-
ctx.subscriptions.push(ideServerLogger);
1254+
ctx.subscriptions.push(languageServerLogger);
12551255
}
12561256

12571257
const checkForUpdatesCommand: keyof PreActivationCommands =

extensions/ql-vscode/src/language-support/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ export * from "./contextual/key-type";
55
export * from "./contextual/location-finder";
66
export * from "./contextual/query-resolver";
77
export * from "./contextual/template-provider";
8-
export * from "./ide-server";
8+
export * from "./language-client";
99
export * from "./language-support";
1010
export * from "./query-editor";

extensions/ql-vscode/src/language-support/ide-server.ts renamed to extensions/ql-vscode/src/language-support/language-client.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ import type { TextEditor } from "vscode";
22
import { ProgressLocation, window } from "vscode";
33
import type { StreamInfo } from "vscode-languageclient/node";
44
import { LanguageClient, NotificationType } from "vscode-languageclient/node";
5-
import { shouldDebugIdeServer, spawnServer } from "../codeql-cli/cli";
5+
import { shouldDebugLanguageServer, spawnServer } from "../codeql-cli/cli";
66
import type { QueryServerConfig } from "../config";
7-
import { ideServerLogger } from "../common/logging/vscode";
7+
import { languageServerLogger } from "../common/logging/vscode";
88

99
/**
10-
* Managing the language server for CodeQL.
10+
* Managing the language client and corresponding server process for CodeQL.
1111
*/
1212

1313
/**
14-
* Create a new CodeQL language server.
14+
* Create a new CodeQL language client connected to a language server.
1515
*/
16-
export function createIDEServer(
16+
export function createLanguageClient(
1717
config: QueryServerConfig,
1818
): CodeQLLanguageClient {
1919
return new CodeQLLanguageClient(config);
2020
}
2121

2222
/**
23-
* CodeQL language server.
23+
* CodeQL language client.
2424
*/
2525
export class CodeQLLanguageClient extends LanguageClient {
2626
constructor(config: QueryServerConfig) {
2727
super(
2828
"codeQL.lsp",
2929
"CodeQL Language Server",
30-
() => spawnIdeServer(config),
30+
() => spawnLanguageServer(config),
3131
{
3232
documentSelector: [
3333
{ language: "ql", scheme: "file" },
@@ -38,7 +38,7 @@ export class CodeQLLanguageClient extends LanguageClient {
3838
configurationSection: "codeQL",
3939
},
4040
// Ensure that language server exceptions are logged to the same channel as its output.
41-
outputChannel: ideServerLogger.outputChannel,
41+
outputChannel: languageServerLogger.outputChannel,
4242
},
4343
true,
4444
);
@@ -55,12 +55,14 @@ export class CodeQLLanguageClient extends LanguageClient {
5555
}
5656

5757
/** Starts a new CodeQL language server process, sending progress messages to the status bar. */
58-
async function spawnIdeServer(config: QueryServerConfig): Promise<StreamInfo> {
58+
async function spawnLanguageServer(
59+
config: QueryServerConfig,
60+
): Promise<StreamInfo> {
5961
return window.withProgress(
6062
{ title: "CodeQL language server", location: ProgressLocation.Window },
6163
async (progressReporter, _) => {
6264
const args = ["--check-errors", "ON_CHANGE"];
63-
if (shouldDebugIdeServer()) {
65+
if (shouldDebugLanguageServer()) {
6466
args.push(
6567
"-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=n,quiet=y",
6668
);
@@ -70,11 +72,11 @@ async function spawnIdeServer(config: QueryServerConfig): Promise<StreamInfo> {
7072
"CodeQL language server",
7173
["execute", "language-server"],
7274
args,
73-
ideServerLogger,
75+
languageServerLogger,
7476
(data) =>
75-
ideServerLogger.log(data.toString(), { trailingNewline: false }),
77+
languageServerLogger.log(data.toString(), { trailingNewline: false }),
7678
(data) =>
77-
ideServerLogger.log(data.toString(), { trailingNewline: false }),
79+
languageServerLogger.log(data.toString(), { trailingNewline: false }),
7880
progressReporter,
7981
);
8082
return { writer: child.stdin!, reader: child.stdout! };

0 commit comments

Comments
 (0)