From 0f3680866eb02da6114c6bb8775016eb0452f3db Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Mon, 4 Dec 2017 00:29:38 -0800 Subject: [PATCH] Make missing clientVersion skip check --- src/command_line.cc | 6 +++--- src/config.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index 51808f11..dcbcef22 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -1511,13 +1511,13 @@ bool QueryDbMainLoop(Config* config, *config = *request->params.initializationOptions; // Check client version. - if (config->clientVersion != kExpectedClientVersion && - config->clientVersion != -1 /*disable check*/) { + if (config->clientVersion.has_value() && + *config->clientVersion != kExpectedClientVersion) { Out_ShowLogMessage out; out.display_type = Out_ShowLogMessage::DisplayType::Show; out.params.type = lsMessageType::Error; out.params.message = - "cquery client (v" + std::to_string(config->clientVersion) + + "cquery client (v" + std::to_string(*config->clientVersion) + ") and server (v" + std::to_string(kExpectedClientVersion) + ") version mismatch. Please update "; if (config->clientVersion > kExpectedClientVersion) diff --git a/src/config.h b/src/config.h index d8d2b2af..a11ad749 100644 --- a/src/config.h +++ b/src/config.h @@ -67,8 +67,9 @@ struct Config { // Enables code lens on parameter and function variables. bool codeLensOnLocalVariables = true; - // Version of the client. - int clientVersion = 0; + // Version of the client. If undefined the version check is skipped. Used to + // inform users their vscode client is too old and needs to be updated. + optional clientVersion; // If true parameter declarations are included in code completion when calling // a function or method