Skip to content

Commit 19f8634

Browse files
authored
Open Java Server Log always opens standard server log (#3310)
Signed-off-by: Snjezana Peco <[email protected]>
1 parent 65cd881 commit 19f8634

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/extension.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
328328
}
329329

330330
// Register commands here to make it available even when the language client fails
331-
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_LOG, (column: ViewColumn) => openServerLogFile(workspacePath, column)));
332-
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_STDOUT_LOG, (column: ViewColumn) => openRollingServerLogFile(workspacePath, '.out-jdt.ls', column)));
333-
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_STDERR_LOG, (column: ViewColumn) => openRollingServerLogFile(workspacePath, '.error-jdt.ls', column)));
331+
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_LOG, (column: ViewColumn) => openServerLogFile(storagePath, column)));
332+
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_STDOUT_LOG, (column: ViewColumn) => openRollingServerLogFile(storagePath, '.out-jdt.ls', column)));
333+
context.subscriptions.push(commands.registerCommand(Commands.OPEN_SERVER_STDERR_LOG, (column: ViewColumn) => openRollingServerLogFile(storagePath, '.error-jdt.ls', column)));
334334

335335
context.subscriptions.push(commands.registerCommand(Commands.OPEN_CLIENT_LOG, (column: ViewColumn) => openClientLogFile(clientLogFile, column)));
336336

@@ -667,13 +667,19 @@ async function cleanSharedIndexes(context: ExtensionContext) {
667667
}
668668
}
669669

670-
function openServerLogFile(workspacePath, column: ViewColumn = ViewColumn.Active): Thenable<boolean> {
670+
function openServerLogFile(storagePath, column: ViewColumn = ViewColumn.Active): Thenable<boolean> {
671+
const workspacePath = getWorkspacePath(storagePath);
671672
const serverLogFile = path.join(workspacePath, '.metadata', '.log');
672673
return openLogFile(serverLogFile, 'Could not open Java Language Server log file', column);
673674
}
674675

675-
function openRollingServerLogFile(workspacePath, filename, column: ViewColumn = ViewColumn.Active): Thenable<boolean> {
676+
function getWorkspacePath(storagePath: any) {
677+
return path.join(storagePath, apiManager.getApiInstance().serverMode === ServerMode.lightWeight ? 'ss_ws' : 'jdt_ws');
678+
}
679+
680+
function openRollingServerLogFile(storagePath, filename, column: ViewColumn = ViewColumn.Active): Thenable<boolean> {
676681
return new Promise((resolve) => {
682+
const workspacePath = getWorkspacePath(storagePath);
677683
const dirname = path.join(workspacePath, '.metadata');
678684

679685
// find out the newest one

0 commit comments

Comments
 (0)