Skip to content

Commit

Permalink
fix: comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming committed Aug 8, 2024
1 parent bfb4835 commit 60aeb2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
14 changes: 6 additions & 8 deletions extension/src/server/GradleServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { sendInfo } from "vscode-extension-telemetry-wrapper";
import { getGradleServerCommand, getGradleServerEnv, quoteArg } from "./serverUtil";
import { Logger } from "../logger/index";
import { NO_JAVA_EXECUTABLE, OPT_RESTART, INSTALL_JDK } from "../constant";
import { redHatJavaInstalled, javaExtensionPackInstalled } from "../util/config";
import { extensionInstalled } from "../util/config";
import { BspProxy } from "../bs/BspProxy";
import { getRandomPipeName } from "../util/generateRandomPipeName";
const SERVER_LOGLEVEL_REGEX = /^\[([A-Z]+)\](.*)$/;
Expand Down Expand Up @@ -51,7 +51,7 @@ export class GradleServer {
}
public async start(): Promise<void> {
let startBuildServer = false;
if (redHatJavaInstalled()) {
if (extensionInstalled("redhat.java")) {
const isPrepared = this.bspProxy.prepareToStart();
if (isPrepared) {
startBuildServer = true;
Expand All @@ -69,14 +69,12 @@ export class GradleServer {
sendInfo("", {
kind: "GradleServerEnvMissing",
});
if (javaExtensionPackInstalled()) {
const selection = await vscode.window.showErrorMessage(NO_JAVA_EXECUTABLE, INSTALL_JDK);
const choice = extensionInstalled("vscjava.vscode-java-pack") ? [INSTALL_JDK] : [];
vscode.window.showErrorMessage(NO_JAVA_EXECUTABLE, ...choice).then((selection) => {
if (selection === INSTALL_JDK) {
await vscode.commands.executeCommand("java.installJdk");
vscode.commands.executeCommand("java.installJdk");
}
} else {
await vscode.window.showErrorMessage(NO_JAVA_EXECUTABLE);
}
});
return;
}
const args = [
Expand Down
9 changes: 3 additions & 6 deletions extension/src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,12 @@ export async function findValidJavaHome(): Promise<string | undefined> {
return undefined;
}

export function redHatJavaInstalled(): boolean {
return !!vscode.extensions.getExtension("redhat.java");
export function extensionInstalled(extensionId: string): boolean {
return !!vscode.extensions.getExtension(extensionId);
}

export function javaExtensionPackInstalled(): boolean {
return !!vscode.extensions.getExtension("vscjava.vscode-java-pack");
}
export function getRedHatJavaEmbeddedJRE(): string | undefined {
if (!redHatJavaInstalled()) {
if (!extensionInstalled("redhat.java")) {
return undefined;
}

Expand Down

0 comments on commit 60aeb2e

Please sign in to comment.