diff options
Diffstat (limited to 'graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h')
-rw-r--r-- | graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h | 186 |
1 files changed, 83 insertions, 103 deletions
diff --git a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h index 6752c40812..98f82608b8 100644 --- a/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h +++ b/graphics/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h @@ -9,168 +9,148 @@ struct LintRule { - std::string key; - std::string name; - - - std::string Display() const - { - return name + " (" + key + ")"; - } - bool activeByDefault = true; - optional<std::string> severity; - optional<std::string> type; - int icon_index = -1; - MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); - + std::string key; + std::string name; + + std::string Display() const + { + return name + " (" + key + ")"; + } + bool activeByDefault = true; + optional<std::string> severity; + optional<std::string> type; + int icon_index = -1; + MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); }; MAKE_REFLECT_STRUCT(LintRule, key, name, activeByDefault, severity, type); - -struct RuleParameter { - std::string name; - optional<std::string> description; - optional<std::string> defaultValue; - +struct RuleParameter +{ + std::string name; + optional<std::string> description; + optional<std::string> defaultValue; }; MAKE_REFLECT_STRUCT(RuleParameter, name, description, defaultValue); -struct ShowRuleDescriptionParams { - - optional<std::string> key; - - optional<std::string> name; +struct ShowRuleDescriptionParams +{ - optional<std::string> htmlDescription; + optional<std::string> key; - optional<std::string> type; + optional<std::string> name; - optional<std::string> severity; + optional<std::string> htmlDescription; - optional< std::vector<RuleParameter> > parameters; - MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) + optional<std::string> type; + optional<std::string> severity; + optional<std::vector<RuleParameter>> parameters; + MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) }; MAKE_REFLECT_STRUCT(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters); - -struct GetJavaConfigResponse { - std::string projectRoot; - std::string sourceLevel; - std::vector<std::string> classpath; - bool isTest; - std::string vmLocation; - MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); +struct GetJavaConfigResponse +{ + std::string projectRoot; + std::string sourceLevel; + std::vector<std::string> classpath; + bool isTest; + std::string vmLocation; + MAKE_SWAP_METHOD(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); }; MAKE_REFLECT_STRUCT(GetJavaConfigResponse, projectRoot, sourceLevel, classpath, isTest, vmLocation); -struct SetTraceNotificationParams { - lsInitializeParams::lsTrace value; +struct SetTraceNotificationParams +{ + lsInitializeParams::lsTrace value; }; MAKE_REFLECT_STRUCT(SetTraceNotificationParams, value); +struct ServerConnectionSettings +{ -struct ServerConnectionSettings { - - std::string SONARCLOUD_URL = "https://sonarcloud.io"; - std::vector<std::string>SONARCLOUD_ALIAS = { "https://sonarqube.com", - "https://www.sonarqube.com", - "https://www.sonarcloud.io", - "https://sonarcloud.io" }; - - std::string connectionId; - std::string serverUrl; - std::string token; - optional<std::string> organizationKey; - MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) + std::string SONARCLOUD_URL = "https://sonarcloud.io"; + std::vector<std::string> SONARCLOUD_ALIAS = { + "https://sonarqube.com", "https://www.sonarqube.com", "https://www.sonarcloud.io", "https://sonarcloud.io" + }; + std::string connectionId; + std::string serverUrl; + std::string token; + optional<std::string> organizationKey; + MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) }; MAKE_REFLECT_STRUCT(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) struct RuleSetting { - bool IsOn(); - std::string level = "on"; - RuleSetting(bool activate); - RuleSetting() = default; - void toggle(); - void on() + bool IsOn(); + std::string level = "on"; + RuleSetting(bool activate); + RuleSetting() = default; + void toggle(); + void on() + { + level = "on"; + } + void off() + { + level = "off"; + } + void turn(bool activate) + { + if (activate) { - level = "on"; + on(); } - void off() + else { - level = "off"; + off(); } - void turn(bool activate) - { - if (activate) - { - on(); - } - else - { - off(); - } - } - optional< std::map<std::string, std::string > > parameters; + } + optional<std::map<std::string, std::string>> parameters; }; MAKE_REFLECT_STRUCT(RuleSetting, level, parameters) struct ConsoleParams { - optional < bool >showAnalyzerLogs; - optional < bool >showVerboseLogs; - MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) + optional<bool> showAnalyzerLogs; + optional<bool> showVerboseLogs; + MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) }; MAKE_REFLECT_STRUCT(ConsoleParams, showAnalyzerLogs, showVerboseLogs) struct SonarLintWorkspaceSettings { - optional < bool > disableTelemetry; - optional < std::map<std::string, ServerConnectionSettings> >connectedMode; - optional<std::map<std::string, RuleSetting>> rules; - optional<ConsoleParams> output; - - optional<std::string > pathToNodeExecutable; - - optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); + optional<bool> disableTelemetry; + optional<std::map<std::string, ServerConnectionSettings>> connectedMode; + optional<std::map<std::string, RuleSetting>> rules; + optional<ConsoleParams> output; + optional<std::string> pathToNodeExecutable; + optional<std::map<std::string, std::string>> getConfigurationParameters(std::string const& ruleKey); }; -MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, - rules, output, pathToNodeExecutable) - - - - DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); - +MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, rules, output, pathToNodeExecutable) +DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); DEFINE_NOTIFICATION_TYPE(Notify_didClasspathUpdate, lsDocumentUri, "sonarlint/didClasspathUpdate") - DEFINE_NOTIFICATION_TYPE(Notify_didJavaServerModeChange, std::string, "sonarlint/didJavaServerModeChange") - - DEFINE_REQUEST_RESPONSE_TYPE(slls_showSonarLintOutput, JsonNull, JsonNull, "sonarlint/showSonarLintOutput"); - - DEFINE_REQUEST_RESPONSE_TYPE(slls_openJavaHomeSettings, JsonNull, JsonNull, "sonarlint/openJavaHomeSettings"); - - - DEFINE_REQUEST_RESPONSE_TYPE(slls_openPathToNodeSettings, JsonNull, JsonNull, "sonarlint/openPathToNodeSettings"); - -DEFINE_REQUEST_RESPONSE_TYPE(slls_showRuleDescription, ShowRuleDescriptionParams, JsonNull, "sonarlint/showRuleDescription"); +DEFINE_REQUEST_RESPONSE_TYPE( + slls_showRuleDescription, ShowRuleDescriptionParams, JsonNull, "sonarlint/showRuleDescription" +); DEFINE_REQUEST_RESPONSE_TYPE(slls_getJavaConfig, lsDocumentUri, GetJavaConfigResponse, "sonarlint/getJavaConfig"); - DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification") |