Skip to content

Commit 600f88c

Browse files
authored
[W-20920750] fix: prevent duplicate output tabs in browser mode (#189)
fix: prevent duplicate output tabs in browser mode Pass existing workerServerOutputChannel to LanguageClient in browser mode to prevent LanguageClient from auto-creating its own default output channel. This ensures all logs go to a single output tab instead of creating duplicates.
1 parent 3256c64 commit 600f88c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/apex-lsp-vscode-extension/src/language-server.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,9 @@ async function createWebLanguageClient(
339339
configurationSection: EXTENSION_CONSTANTS.APEX_LS_CONFIG_SECTION,
340340
},
341341
initializationOptions: initOptions,
342-
// Don't pass outputChannel to web worker as it may contain non-serializable objects
343-
// Web worker logging is handled via window/logMessage notifications
342+
// Use our consolidated worker/server output channel to prevent LanguageClient
343+
// from creating its own default output channel (which causes duplicate tabs)
344+
outputChannel: getWorkerServerOutputChannel() || undefined,
344345
},
345346
worker,
346347
);
@@ -417,8 +418,9 @@ async function createWebLanguageClient(
417418
throw error;
418419
}
419420

420-
// Note: Output channels are handled via the window/logMessage notification handler below
421-
// The LanguageClient's outputChannel property is read-only, so we can't set it directly
421+
// Output channels: We pass our custom outputChannel to prevent LanguageClient
422+
// from creating a default one. Server logs are handled via window/logMessage notifications
423+
// which write to the same outputChannel, ensuring all logs go to a single tab.
422424

423425
// Set up window/logMessage handler for worker/server logs
424426
languageClient.onNotification('window/logMessage', (params: any) => {

0 commit comments

Comments
 (0)