@@ -119,7 +119,7 @@ LanguageServer::LanguageServer(Transport& _transport):
119
119
{" exit" , [this ](auto , auto ) { m_state = (m_state == State::ShutdownRequested ? State::ExitRequested : State::ExitWithoutShutdown); }},
120
120
{" initialize" , bind (&LanguageServer::handleInitialize, this , _1, _2)},
121
121
{" initialized" , [](auto , auto ) {}},
122
- {" $/setTrace" , bind (&LanguageServer::setTrace, this , _2) },
122
+ {" $/setTrace" , [ this ]( auto , Json::Value const & args) { setTrace (args[ " value " ]); } },
123
123
{" shutdown" , [this ](auto , auto ) { m_state = State::ShutdownRequested; }},
124
124
{" textDocument/definition" , GotoDefinition (*this ) },
125
125
{" textDocument/didOpen" , bind (&LanguageServer::handleTextDocumentDidOpen, this , _2)},
@@ -325,6 +325,9 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
325
325
else if (Json::Value rootPath = _args[" rootPath" ])
326
326
rootPath = rootPath.asString ();
327
327
328
+ if (_args[" trace" ])
329
+ setTrace (_args[" trace" ]);
330
+
328
331
m_fileRepository = FileRepository (rootPath, {});
329
332
if (_args[" initializationOptions" ].isObject ())
330
333
changeConfiguration (_args[" initializationOptions" ]);
@@ -341,7 +344,6 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
341
344
replyArgs[" capabilities" ][" semanticTokensProvider" ][" full" ] = true ; // XOR requests.full.delta = true
342
345
replyArgs[" capabilities" ][" renameProvider" ] = true ;
343
346
344
-
345
347
m_client.reply (_id, move (replyArgs));
346
348
}
347
349
@@ -372,11 +374,11 @@ void LanguageServer::handleWorkspaceDidChangeConfiguration(Json::Value const& _a
372
374
373
375
void LanguageServer::setTrace (Json::Value const & _args)
374
376
{
375
- if (!_args[ " value " ] .isString ())
377
+ if (!_args.isString ())
376
378
// Simply ignore invalid parameter.
377
379
return ;
378
380
379
- string const stringValue = _args[ " value " ] .asString ();
381
+ string const stringValue = _args.asString ();
380
382
if (stringValue == " off" )
381
383
m_client.setTrace (TraceValue::Off);
382
384
else if (stringValue == " messages" )
0 commit comments