Skip to content

Commit

Permalink
Fix: bspProxy start sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming committed Aug 7, 2024
1 parent 36ac874 commit 957deb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 1 addition & 8 deletions extension/src/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ import { instrumentOperation, sendInfo } from "vscode-extension-telemetry-wrappe
import { GradleBuildContentProvider } from "./client/GradleBuildContentProvider";
import { BuildServerController } from "./bs/BuildServerController";
import { GradleTestRunner } from "./bs/GradleTestRunner";
import { BspProxy } from "./bs/BspProxy";

export class Extension {
private readonly bspProxy: BspProxy;
private readonly taskServerClient: TaskServerClient;
private readonly server: GradleServer;
private readonly pinnedTasksStore: PinnedTasksStore;
Expand Down Expand Up @@ -81,16 +79,12 @@ export class Extension {
const serverLogger = new Logger("gradle-server");
serverLogger.setLoggingChannel(loggingChannel);

const bspLogger = new Logger("bspProxy");
bspLogger.setLoggingChannel(loggingChannel);

if (getConfigIsDebugEnabled()) {
Logger.setLogVerbosity(LogVerbosity.DEBUG);
}

const statusBarItem = vscode.window.createStatusBarItem();
this.bspProxy = new BspProxy(this.context, bspLogger);
this.server = new GradleServer({ host: "localhost" }, context, serverLogger, this.bspProxy);
this.server = new GradleServer({ host: "localhost" }, context, serverLogger);
this.taskServerClient = new TaskServerClient(this.server, statusBarItem, clientLogger);
this.pinnedTasksStore = new PinnedTasksStore(context);
this.recentTasksStore = new RecentTasksStore();
Expand Down Expand Up @@ -265,7 +259,6 @@ export class Extension {
}
await vscode.commands.executeCommand("setContext", "gradle:activated", activated);
await vscode.commands.executeCommand("setContext", "gradle:defaultView", true);
await this.bspProxy.start();
}

private registerCommands(): void {
Expand Down
7 changes: 4 additions & 3 deletions extension/src/server/GradleServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ export class GradleServer {
public readonly onDidStop: vscode.Event<null> = this._onDidStop.event;
private process?: cp.ChildProcessWithoutNullStreams;
private languageServerPipePath: string;
private bspProxy: BspProxy;

constructor(
private readonly opts: ServerOptions,
private readonly context: vscode.ExtensionContext,
private readonly logger: Logger,
private bspProxy: BspProxy
private readonly logger: Logger
) {
this.setLanguageServerPipePath();
this.bspProxy = new BspProxy(this.context, logger);
}

private setLanguageServerPipePath(): void {
Expand All @@ -59,7 +60,7 @@ export class GradleServer {
}
}
this.bspProxy.setBuildServerStarted(startBuildServer);

this.bspProxy.start();
this.taskServerPort = await getPort();
const cwd = this.context.asAbsolutePath("lib");
const cmd = path.join(cwd, getGradleServerCommand());
Expand Down

0 comments on commit 957deb6

Please sign in to comment.