Merge pull request #13273 from ethereum/lsp-ci-trace

lsp.py: Pass trace option during initialization already.
This commit is contained in:
Christian Parpart 2022-07-13 20:13:31 +02:00 committed by GitHub
commit 454603e170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -119,7 +119,7 @@ LanguageServer::LanguageServer(Transport& _transport):
{"exit", [this](auto, auto) { m_state = (m_state == State::ShutdownRequested ? State::ExitRequested : State::ExitWithoutShutdown); }},
{"initialize", bind(&LanguageServer::handleInitialize, this, _1, _2)},
{"initialized", [](auto, auto) {}},
{"$/setTrace", bind(&LanguageServer::setTrace, this, _2)},
{"$/setTrace", [this](auto, Json::Value const& args) { setTrace(args["value"]); }},
{"shutdown", [this](auto, auto) { m_state = State::ShutdownRequested; }},
{"textDocument/definition", GotoDefinition(*this) },
{"textDocument/didOpen", bind(&LanguageServer::handleTextDocumentDidOpen, this, _2)},
@ -325,6 +325,9 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
else if (Json::Value rootPath = _args["rootPath"])
rootPath = rootPath.asString();
if (_args["trace"])
setTrace(_args["trace"]);
m_fileRepository = FileRepository(rootPath, {});
if (_args["initializationOptions"].isObject())
changeConfiguration(_args["initializationOptions"]);
@ -341,7 +344,6 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
replyArgs["capabilities"]["semanticTokensProvider"]["full"] = true; // XOR requests.full.delta = true
replyArgs["capabilities"]["renameProvider"] = true;
m_client.reply(_id, move(replyArgs));
}
@ -372,11 +374,11 @@ void LanguageServer::handleWorkspaceDidChangeConfiguration(Json::Value const& _a
void LanguageServer::setTrace(Json::Value const& _args)
{
if (!_args["value"].isString())
if (!_args.isString())
// Simply ignore invalid parameter.
return;
string const stringValue = _args["value"].asString();
string const stringValue = _args.asString();
if (stringValue == "off")
m_client.setTrace(TraceValue::Off);
else if (stringValue == "messages")

View File

@ -906,7 +906,9 @@ class SolidityLSPTestSuite: # {{{
params = {
'processId': None,
'rootUri': self.project_root_uri,
'trace': 'off',
# Enable traces to receive the amount of expected diagnostics before
# actually receiving them.
'trace': 'messages',
'initializationOptions': {},
'capabilities': {
'textDocument': {
@ -925,9 +927,6 @@ class SolidityLSPTestSuite: # {{{
params['rootUri'] = None
lsp.call_method('initialize', params)
lsp.send_notification('initialized')
# Enable traces to receive the amount of expected diagnostics before
# actually receiving them.
lsp.send_message("$/setTrace", { 'value': 'messages' })
# {{{ helpers
def get_test_file_path(self, test_case_name, sub_dir=None):