@@ -20,10 +20,19 @@ import {
2020
2121import { Socket } from 'net' ;
2222import { RHelpTopicProvider } from './help' ;
23- import { RLspOutputChannelManager } from './lsp-output-channel-manager' ;
2423import { R_DOCUMENT_SELECTORS } from './provider' ;
2524import { VirtualDocumentProvider } from './virtual-documents' ;
2625
26+ /**
27+ * Global output channel for R LSP sessions
28+ *
29+ * Since we only have one LSP session active at any time, and since the start of
30+ * a new session is logged with a session ID, we use a single output channel for
31+ * all LSP sessions. Watch out for session start log messages to find the
32+ * relevant section of the log.
33+ */
34+ const LSP_OUTPUT_CHANNEL = positron . window . createRawLogOutputChannel ( 'R Language Server' ) ;
35+
2736/**
2837 * The state of the language server.
2938 */
@@ -107,12 +116,6 @@ export class ArkLsp implements vscode.Disposable {
107116
108117 const { notebookUri } = this . _metadata ;
109118
110- // Persistant output channel, used across multiple sessions of the same name + mode combination
111- const outputChannel = RLspOutputChannelManager . instance . getOutputChannel (
112- this . _dynState . sessionName ,
113- this . _metadata . sessionMode
114- ) ;
115-
116119 const clientOptions : LanguageClientOptions = {
117120 // If this client belongs to a notebook, set the document selector to only include that notebook.
118121 // Otherwise, this is the main client for this language, so set the document selector to include
@@ -126,7 +129,7 @@ export class ArkLsp implements vscode.Disposable {
126129 fileEvents : vscode . workspace . createFileSystemWatcher ( '**/*.R' )
127130 } ,
128131 errorHandler : new RErrorHandler ( this . _version , port ) ,
129- outputChannel : outputChannel ,
132+ outputChannel : LSP_OUTPUT_CHANNEL ,
130133 revealOutputChannelOn : RevealOutputChannelOn . Never ,
131134 middleware : {
132135 handleDiagnostics ( uri , diagnostics , next ) {
@@ -146,7 +149,7 @@ export class ArkLsp implements vscode.Disposable {
146149 const message = `Creating language client ${ this . _dynState . sessionName } for session ${ this . _metadata . sessionId } on port ${ port } ` ;
147150
148151 LOGGER . info ( message ) ;
149- outputChannel . appendLine ( message ) ;
152+ LSP_OUTPUT_CHANNEL . appendLine ( message ) ;
150153
151154 this . client = new LanguageClient ( id , this . languageClientName , serverOptions , clientOptions ) ;
152155
@@ -319,10 +322,6 @@ export class ArkLsp implements vscode.Disposable {
319322 }
320323
321324 public showOutput ( ) {
322- const outputChannel = RLspOutputChannelManager . instance . getOutputChannel (
323- this . _dynState . sessionName ,
324- this . _metadata . sessionMode
325- ) ;
326- outputChannel . show ( ) ;
325+ LSP_OUTPUT_CHANNEL . show ( ) ;
327326 }
328327}
0 commit comments