File tree Expand file tree Collapse file tree 5 files changed +22
-5
lines changed Expand file tree Collapse file tree 5 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,20 @@ export class ConfigurationManager extends Disposable {
140140 this . _settings = defaultSettings ( ) ;
141141 }
142142
143+ public init ( logLevel ?: string ) {
144+ const initLogLevel = LogFunctionLogger . parseLogLevel (
145+ logLevel ?? "warn"
146+ ) ;
147+
148+ this . _settings = {
149+ ...this . _settings ,
150+ quarto : {
151+ ...this . _settings . quarto ,
152+ logLevel : initLogLevel ,
153+ }
154+ } ;
155+ }
156+
143157 public async update ( ) {
144158 this . _logger . logTrace ( 'Sending \'configuration\' request' ) ;
145159 const settings = await this . connection_ . workspace . getConfiguration ( ) ;
Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ let initializationOptions: LspInitializationOptions | undefined;
7373let mdLs : IMdLanguageService | undefined ;
7474
7575connection . onInitialize ( ( params : InitializeParams ) => {
76+ // Set log level from initialization options if provided so that we use the
77+ // expected level as soon as possible
78+ configManager . init ( params . initializationOptions ?. logLevel ) ;
79+
7680 // We're connected, log messages via LSP
7781 logger . setConnection ( connection ) ;
7882 logger . logRequest ( 'initialize' ) ;
Original file line number Diff line number Diff line change @@ -55,9 +55,6 @@ export class LogFunctionLogger extends Disposable implements ILogger {
5555 private readonly _logFn : typeof console . log ,
5656 ) {
5757 super ( ) ;
58-
59- // Be verbose during init until we have a chance to get the user configuration
60- this . _logLevel = LogLevel . Debug ;
6158 }
6259
6360 setConnection ( connection : Connection ) {
Original file line number Diff line number Diff line change @@ -117,7 +117,8 @@ export async function activateLsp(
117117
118118 // create client options
119119 const initializationOptions : LspInitializationOptions = {
120- quartoBinPath : quartoContext . binPath
120+ quartoBinPath : quartoContext . binPath ,
121+ logLevel : config . get ( "server.logLevel" ) ,
121122 } ;
122123
123124 const documentSelectorPattern = semver . gte ( quartoContext . version , "1.6.24" ) ?
Original file line number Diff line number Diff line change 1515
1616export interface LspInitializationOptions {
1717 quartoBinPath ?: string ;
18- }
18+ logLevel ?: 'trace' | 'debug' | 'info' | 'warn' | 'error' ;
19+ }
You can’t perform that action at this time.
0 commit comments