Skip to content

Commit 4479e66

Browse files
authored
can read client.log for empty workspace (#971)
Signed-off-by: Yan Zhang <[email protected]>
1 parent c2a5579 commit 4479e66

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/daemon/clientLog/logWatcher.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33
import * as vscode from "vscode";
4+
import * as path from "path";
45
import { sendInfo } from "vscode-extension-telemetry-wrapper";
56
import { LSDaemon } from "../daemon";
67

@@ -62,6 +63,13 @@ export class ClientLogWatcher {
6263
}
6364

6465
private async readLatestLogFile() {
66+
if (!this.javaExtensionRoot) {
67+
try {
68+
this.javaExtensionRoot = vscode.Uri.file(path.dirname(await vscode.commands.executeCommand("_java.workspace.path")));
69+
} catch (error) {
70+
}
71+
}
72+
6573
if (this.javaExtensionRoot) {
6674
const files = await vscode.workspace.fs.readDirectory(this.javaExtensionRoot);
6775
const logFiles = files.filter(elem => elem[0].startsWith("client.log")).sort((a, b) => compare_file(a[0], b[0]));

src/daemon/serverLog/logWatcher.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ export class LogWatcher {
2828
* start
2929
*/
3030
public async start() {
31+
if (!this.serverLogUri) {
32+
try {
33+
const jdtWsPath: string = await vscode.commands.executeCommand("_java.workspace.path");
34+
this.serverLogUri= vscode.Uri.file(path.join(jdtWsPath, ".metadata"));
35+
} catch (error) {
36+
}
37+
}
38+
3139
if (!this.serverLogUri) {
3240
sendInfo("", { name: "no-server-log" });
3341
return;

0 commit comments

Comments
 (0)