diff options
Diffstat (limited to 'Build/source/utils/asymptote/LspCpp/include/LibLsp')
126 files changed, 5706 insertions, 5523 deletions
diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h index b89f32f1663..496be298443 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Cancellation.h @@ -7,12 +7,12 @@ namespace Cancellation { struct Params { - /** - * The request id to cancel. - */ - lsRequestId id; - - MAKE_SWAP_METHOD(Cancellation::Params, id); + /** + * The request id to cancel. + */ + lsRequestId id; + + MAKE_SWAP_METHOD(Cancellation::Params, id); }; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h index a5f550041d3..6a8cf7a2a64 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Condition.h @@ -5,44 +5,44 @@ class Condition { public: - std::mutex m_mutex; - std::condition_variable m_condition; - ~Condition() { - m_condition.notify_all(); - } - void notify(std::unique_ptr<T> data) noexcept - { - { - std::lock_guard<std::mutex> eventLock(m_mutex); - any.swap(data); - } - // wake up one waiter - m_condition.notify_one(); - }; + std::mutex m_mutex; + std::condition_variable m_condition; + ~Condition() { + m_condition.notify_all(); + } + void notify(std::unique_ptr<T> data) noexcept + { + { + std::lock_guard<std::mutex> eventLock(m_mutex); + any.swap(data); + } + // wake up one waiter + m_condition.notify_one(); + }; - - std::unique_ptr<T> wait(unsigned timeout=0) - { - std::unique_lock<std::mutex> ul(m_mutex); - if (!timeout) { - m_condition.wait(ul,[&]() { - if (!any) - return false; - return true; - }); - } - else{ - if(!any){ - std::cv_status status = m_condition.wait_for(ul, std::chrono::milliseconds(timeout)); - if (status == std::cv_status::timeout) - { - return {}; - } - } - } - return std::unique_ptr<T>(any.release()); - - } + + std::unique_ptr<T> wait(unsigned timeout=0) + { + std::unique_lock<std::mutex> ul(m_mutex); + if (!timeout) { + m_condition.wait(ul,[&]() { + if (!any) + return false; + return true; + }); + } + else{ + if(!any){ + std::cv_status status = m_condition.wait_for(ul, std::chrono::milliseconds(timeout)); + if (status == std::cv_status::timeout) + { + return {}; + } + } + } + return std::unique_ptr<T>(any.release()); + + } private: - std::unique_ptr<T> any; + std::unique_ptr<T> any; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h index 01d8e8ca91e..d752711a3a9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/Endpoint.h @@ -15,38 +15,38 @@ using GenericNotificationHandler = std::function< bool(std::unique_ptr<LspMessag class Endpoint { public: - virtual ~Endpoint() = default; - virtual bool onRequest(std::unique_ptr<LspMessage>) = 0; - virtual bool notify(std::unique_ptr<LspMessage>) = 0; - - virtual bool onResponse(const std::string&, std::unique_ptr<LspMessage>) = 0; - virtual void registerRequestHandler(const std::string&, GenericResponseHandler ) = 0; - virtual void registerNotifyHandler(const std::string&, GenericNotificationHandler ) = 0; + virtual ~Endpoint() = default; + virtual bool onRequest(std::unique_ptr<LspMessage>) = 0; + virtual bool notify(std::unique_ptr<LspMessage>) = 0; + + virtual bool onResponse(const std::string&, std::unique_ptr<LspMessage>) = 0; + virtual void registerRequestHandler(const std::string&, GenericResponseHandler ) = 0; + virtual void registerNotifyHandler(const std::string&, GenericNotificationHandler ) = 0; }; class GenericEndpoint :public Endpoint { public: - GenericEndpoint(lsp::Log& l):log(l){} - bool notify(std::unique_ptr<LspMessage>) override; - bool onResponse(const std::string&, std::unique_ptr<LspMessage>) override; - - bool onRequest(std::unique_ptr<LspMessage>) override; - std::map< std::string, GenericRequestHandler > method2request; - std::map< std::string, GenericResponseHandler > method2response; - std::map< std::string, GenericNotificationHandler > method2notification; - - void registerRequestHandler(const std::string& method, GenericResponseHandler cb) override - { - method2request[method] = cb; - } - - void registerNotifyHandler(const std::string& method, GenericNotificationHandler cb) override - { - method2notification[method] = cb; - } - lsp::Log& log; + GenericEndpoint(lsp::Log& l):log(l){} + bool notify(std::unique_ptr<LspMessage>) override; + bool onResponse(const std::string&, std::unique_ptr<LspMessage>) override; + + bool onRequest(std::unique_ptr<LspMessage>) override; + std::map< std::string, GenericRequestHandler > method2request; + std::map< std::string, GenericResponseHandler > method2response; + std::map< std::string, GenericNotificationHandler > method2notification; + + void registerRequestHandler(const std::string& method, GenericResponseHandler cb) override + { + method2request[method] = cb; + } + + void registerNotifyHandler(const std::string& method, GenericNotificationHandler cb) override + { + method2notification[method] = cb; + } + lsp::Log& log; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h index bda6e65d46d..6c29ee8f0e7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageIssue.h @@ -4,179 +4,179 @@ #include <vector> namespace lsp { - class Log - { - public: - virtual ~Log() = default; - - enum class Level - { - /** - * OFF is a special level that can be used to turn off logging. - - */ - OFF = 1, - - /** - * SEVERE is a message level indicating a serious failure. - * <p> - * In general SEVERE messages should describe events that are - * of considerable importance and which will prevent normal - * program execution. They should be reasonably intelligible - * to end users and to system administrators. - - */ - SEVERE = 2, - - /** - * WARNING is a message level indicating a potential problem. - * <p> - * In general WARNING messages should describe events that will - * be of interest to end users or system managers, or which - * indicate potential problems. - - * - */ - WARNING = 3, - /** - * INFO is a message level for informational messages. - * <p> - * Typically INFO messages will be written to the console - * or its equivalent. So the INFO level should only be - * used for reasonably significant messages that will - * make sense to end users and system administrators. - - */ - INFO = 3, - /** - * CONFIG is a message level for static configuration messages. - * <p> - * CONFIG messages are intended to provide a variety of static - * configuration information, to assist in debugging problems - * that may be associated with particular configurations. - * For example, CONFIG message might include the CPU type, - * the graphics depth, the GUI look-and-feel, etc. - * This level is initialized to <CODE>4</CODE>. - */ - - CONFIG = 4, - - - - /** - * FINE is a message level providing tracing information. - * <p> - * All of FINE, FINER, and FINEST are intended for relatively - * detailed tracing. The exact meaning of the three levels will - * vary between subsystems, but in general, FINEST should be used - * for the most voluminous detailed output, FINER for somewhat - * less detailed output, and FINE for the lowest volume (and - * most important) messages. - * <p> - * In general the FINE level should be used for information - * that will be broadly interesting to developers who do not have - * a specialized interest in the specific subsystem. - * <p> - * FINE messages might include things like minor (recoverable) - * failures. Issues indicating potential performance problems - * are also worth logging as FINE. - * This level is initialized to <CODE>5</CODE>. - */ - FINE = 5, - - /** - * FINER indicates a fairly detailed tracing message. - * By default logging calls for entering, returning, or throwing - * an exception are traced at this level. - * This level is initialized to <CODE>400</CODE>. - */ - FINER = 6, - - /** - * FINEST indicates a highly detailed tracing message. - * This level is initialized to <CODE>300</CODE>. - */ - FINEST = 7, - - /** - * ALL indicates that all messages should be logged. - * This level is initialized to <CODE>Integer.MIN_VALUE</CODE>. - */ - ALL, - }; - virtual void log(Level level, std::wstring&& msg) = 0; - virtual void log(Level level, const std::wstring& msg) = 0; - virtual void log(Level level, std::string&& msg) = 0; - virtual void log(Level level, const std::string& msg) = 0; - - void info(const std::string& msg) - { - log(Level::INFO, msg); - } - void info(const std::wstring& msg) - { - log(Level::INFO, msg); - } - void error(const std::string& msg) - { - log(Level::SEVERE, msg); - } - void error(const std::wstring& msg) - { - log(Level::SEVERE, msg); - } - void warning(const std::string& msg) - { - log(Level::WARNING, msg); - } - void warning(const std::wstring& msg) - { - log(Level::WARNING, msg); - } - }; + class Log + { + public: + virtual ~Log() = default; + + enum class Level + { + /** + * OFF is a special level that can be used to turn off logging. + + */ + OFF = 1, + + /** + * SEVERE is a message level indicating a serious failure. + * <p> + * In general SEVERE messages should describe events that are + * of considerable importance and which will prevent normal + * program execution. They should be reasonably intelligible + * to end users and to system administrators. + + */ + SEVERE = 2, + + /** + * WARNING is a message level indicating a potential problem. + * <p> + * In general WARNING messages should describe events that will + * be of interest to end users or system managers, or which + * indicate potential problems. + + * + */ + WARNING = 3, + /** + * INFO is a message level for informational messages. + * <p> + * Typically INFO messages will be written to the console + * or its equivalent. So the INFO level should only be + * used for reasonably significant messages that will + * make sense to end users and system administrators. + + */ + INFO = 3, + /** + * CONFIG is a message level for static configuration messages. + * <p> + * CONFIG messages are intended to provide a variety of static + * configuration information, to assist in debugging problems + * that may be associated with particular configurations. + * For example, CONFIG message might include the CPU type, + * the graphics depth, the GUI look-and-feel, etc. + * This level is initialized to <CODE>4</CODE>. + */ + + CONFIG = 4, + + + + /** + * FINE is a message level providing tracing information. + * <p> + * All of FINE, FINER, and FINEST are intended for relatively + * detailed tracing. The exact meaning of the three levels will + * vary between subsystems, but in general, FINEST should be used + * for the most voluminous detailed output, FINER for somewhat + * less detailed output, and FINE for the lowest volume (and + * most important) messages. + * <p> + * In general the FINE level should be used for information + * that will be broadly interesting to developers who do not have + * a specialized interest in the specific subsystem. + * <p> + * FINE messages might include things like minor (recoverable) + * failures. Issues indicating potential performance problems + * are also worth logging as FINE. + * This level is initialized to <CODE>5</CODE>. + */ + FINE = 5, + + /** + * FINER indicates a fairly detailed tracing message. + * By default logging calls for entering, returning, or throwing + * an exception are traced at this level. + * This level is initialized to <CODE>400</CODE>. + */ + FINER = 6, + + /** + * FINEST indicates a highly detailed tracing message. + * This level is initialized to <CODE>300</CODE>. + */ + FINEST = 7, + + /** + * ALL indicates that all messages should be logged. + * This level is initialized to <CODE>Integer.MIN_VALUE</CODE>. + */ + ALL, + }; + virtual void log(Level level, std::wstring&& msg) = 0; + virtual void log(Level level, const std::wstring& msg) = 0; + virtual void log(Level level, std::string&& msg) = 0; + virtual void log(Level level, const std::string& msg) = 0; + + void info(const std::string& msg) + { + log(Level::INFO, msg); + } + void info(const std::wstring& msg) + { + log(Level::INFO, msg); + } + void error(const std::string& msg) + { + log(Level::SEVERE, msg); + } + void error(const std::wstring& msg) + { + log(Level::SEVERE, msg); + } + void warning(const std::string& msg) + { + log(Level::WARNING, msg); + } + void warning(const std::wstring& msg) + { + log(Level::WARNING, msg); + } + }; } class MessageIssue { public: - std::string text; + std::string text; - lsp::Log::Level code; + lsp::Log::Level code; - MessageIssue(const std::string& text, lsp::Log::Level code) :text(text), code(code) - { + MessageIssue(const std::string& text, lsp::Log::Level code) :text(text), code(code) + { - } - MessageIssue(std::string&& text, lsp::Log::Level code) :text(text), code(code) - { + } + MessageIssue(std::string&& text, lsp::Log::Level code) :text(text), code(code) + { - } + } - std::string getText() { - return text; - } + std::string getText() { + return text; + } - lsp::Log::Level getIssueCode() { - return code; - } + lsp::Log::Level getIssueCode() { + return code; + } - std::string toString() { - return getText(); - } + std::string toString() { + return getText(); + } }; class MessageIssueHandler { public: - /** - * Handle issues found while parsing or validating a message. The list of issues must not be empty. - */ - virtual ~MessageIssueHandler() = default; - - virtual void handle(std::vector<MessageIssue>&&) = 0; - virtual void handle( MessageIssue&&) = 0; + /** + * Handle issues found while parsing or validating a message. The list of issues must not be empty. + */ + virtual ~MessageIssueHandler() = default; + + virtual void handle(std::vector<MessageIssue>&&) = 0; + virtual void handle( MessageIssue&&) = 0; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h index 7e238b0cf6e..f019fbf1212 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageJsonHandler.h @@ -13,49 +13,49 @@ using GenericNotificationJsonHandler = std::function< std::unique_ptr<LspMessag class MessageJsonHandler { public: - std::map< std::string, GenericRequestJsonHandler > method2request; - std::map< std::string, GenericResponseJsonHandler > method2response; - std::map< std::string, GenericNotificationJsonHandler > method2notification; - - - const GenericRequestJsonHandler* GetRequestJsonHandler(const char* methodInfo) const - { - const auto findIt = method2request.find(methodInfo); - return findIt == method2request.end() ? nullptr : &findIt->second; - } - - void SetRequestJsonHandler(const std::string& methodInfo, GenericRequestJsonHandler handler) - { - method2request[methodInfo] = handler; - } - - const GenericResponseJsonHandler* GetResponseJsonHandler(const char* methodInfo) const - { - const auto findIt = method2response.find(methodInfo); - return findIt == method2response.end() ? nullptr : &findIt->second; - } - - void SetResponseJsonHandler(const std::string& methodInfo,GenericResponseJsonHandler handler) - { - method2response[methodInfo] = handler; - } - - const GenericNotificationJsonHandler* GetNotificationJsonHandler(const char* methodInfo) const - { - const auto findIt = method2notification.find(methodInfo); - return findIt == method2notification.end() ? nullptr : &findIt->second; - } - - void SetNotificationJsonHandler(const std::string& methodInfo, GenericNotificationJsonHandler handler) - { - method2notification[methodInfo] = handler; - } - - - - std::unique_ptr<LspMessage> parseResponseMessage(const std::string&, Reader&); - std::unique_ptr<LspMessage> parseRequstMessage(const std::string&, Reader&); - bool resovleResponseMessage(Reader&, std::pair<std::string, std::unique_ptr<LspMessage>>& result); - std::unique_ptr<LspMessage> parseNotificationMessage(const std::string&, Reader&); + std::map< std::string, GenericRequestJsonHandler > method2request; + std::map< std::string, GenericResponseJsonHandler > method2response; + std::map< std::string, GenericNotificationJsonHandler > method2notification; + + + const GenericRequestJsonHandler* GetRequestJsonHandler(const char* methodInfo) const + { + const auto findIt = method2request.find(methodInfo); + return findIt == method2request.end() ? nullptr : &findIt->second; + } + + void SetRequestJsonHandler(const std::string& methodInfo, GenericRequestJsonHandler handler) + { + method2request[methodInfo] = handler; + } + + const GenericResponseJsonHandler* GetResponseJsonHandler(const char* methodInfo) const + { + const auto findIt = method2response.find(methodInfo); + return findIt == method2response.end() ? nullptr : &findIt->second; + } + + void SetResponseJsonHandler(const std::string& methodInfo,GenericResponseJsonHandler handler) + { + method2response[methodInfo] = handler; + } + + const GenericNotificationJsonHandler* GetNotificationJsonHandler(const char* methodInfo) const + { + const auto findIt = method2notification.find(methodInfo); + return findIt == method2notification.end() ? nullptr : &findIt->second; + } + + void SetNotificationJsonHandler(const std::string& methodInfo, GenericNotificationJsonHandler handler) + { + method2notification[methodInfo] = handler; + } + + + + std::unique_ptr<LspMessage> parseResponseMessage(const std::string&, Reader&); + std::unique_ptr<LspMessage> parseRequstMessage(const std::string&, Reader&); + bool resovleResponseMessage(Reader&, std::pair<std::string, std::unique_ptr<LspMessage>>& result); + std::unique_ptr<LspMessage> parseNotificationMessage(const std::string&, Reader&); }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h index ab7a29a17f7..2affe3b3ff2 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/MessageProducer.h @@ -5,9 +5,9 @@ class MessageProducer { public: - - - typedef std::function< void(std::string&&) > MessageConsumer; - virtual ~MessageProducer() = default; - virtual void listen(MessageConsumer) = 0; + + + typedef std::function< void(std::string&&) > MessageConsumer; + virtual ~MessageProducer() = default; + virtual void listen(MessageConsumer) = 0; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h index e4841b5703c..cdee9e572e7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/NotificationInMessage.h @@ -9,54 +9,54 @@ // NotificationInMessage does not have |id|. struct NotificationInMessage : public LspMessage { - Kind GetKid() override - { - return NOTIFICATION_MESSAGE; - } - MethodType GetMethodType() const override - { - return method.c_str(); - } - void SetMethodType(MethodType _t) override - { - method = _t; - } - std::string method; + Kind GetKid() override + { + return NOTIFICATION_MESSAGE; + } + MethodType GetMethodType() const override + { + return method.c_str(); + } + void SetMethodType(MethodType _t) override + { + method = _t; + } + std::string method; }; template <class T, class TDerived > struct lsNotificationInMessage : NotificationInMessage { - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } - lsNotificationInMessage(MethodType _method) - { - method = _method; - } - - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { - - TDerived* temp = new TDerived(); - - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - - } - void swap(lsNotificationInMessage& arg) noexcept - { - method.swap(method); - std::swap(params, arg.params); - } - T params; + void ReflectWriter(Writer& writer) override { + Reflect(writer, static_cast<TDerived&>(*this)); + } + lsNotificationInMessage(MethodType _method) + { + method = _method; + } + + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { + + TDerived* temp = new TDerived(); + + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + + } + void swap(lsNotificationInMessage& arg) noexcept + { + method.swap(method); + std::swap(params, arg.params); + } + T params; }; #define DEFINE_NOTIFICATION_TYPE(MSG,paramType,methodInfo)\ namespace MSG {\ - struct notify : public lsNotificationInMessage< paramType , notify >{\ - static constexpr MethodType kMethodInfo = methodInfo;\ - notify():lsNotificationInMessage(kMethodInfo){} \ - };\ + struct notify : public lsNotificationInMessage< paramType , notify >{\ + static constexpr MethodType kMethodInfo = methodInfo;\ + notify():lsNotificationInMessage(kMethodInfo){} \ + };\ };\ MAKE_REFLECT_STRUCT(MSG::notify, jsonrpc,method, params) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h index 3ae6b567a5c..4045098f1bf 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RemoteEndPoint.h @@ -12,6 +12,7 @@ #include "MessageIssue.h" #include "LibLsp/JsonRpc/MessageJsonHandler.h" #include "Endpoint.h" +#include "future.h" class MessageJsonHandler; @@ -19,74 +20,74 @@ class Endpoint; struct LspMessage; class RemoteEndPoint; namespace lsp { - class ostream; - class istream; - - //////////////////////////////////////////////////////////////////////////////// - // ResponseOrError<T> - //////////////////////////////////////////////////////////////////////////////// - - // ResponseOrError holds either the response to a request or an error - // message. - template <typename T> - struct ResponseOrError { - using Request = T; - ResponseOrError(); - ResponseOrError(const T& response); - ResponseOrError(T&& response); - ResponseOrError(const Rsp_Error& error); - ResponseOrError(Rsp_Error&& error); - ResponseOrError(const ResponseOrError& other); - ResponseOrError(ResponseOrError&& other) noexcept; - - ResponseOrError& operator=(const ResponseOrError& other); - ResponseOrError& operator=(ResponseOrError&& other) noexcept; - bool IsError() const { return is_error; } - std::string ToJson() - { - if (is_error) return error.ToJson(); - return response.ToJson(); - } - T response; - Rsp_Error error; // empty represents success. - bool is_error; - }; - - template <typename T> - ResponseOrError<T>::ResponseOrError(): is_error(false) - { - } - - template <typename T> - ResponseOrError<T>::ResponseOrError(const T& resp) : response(resp), is_error(false) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(T&& resp) : response(std::move(resp)), is_error(false) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(const Rsp_Error& err) : error(err), is_error(true) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(Rsp_Error&& err) : error(std::move(err)), is_error(true) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(const ResponseOrError& other) - : response(other.response), error(other.error), is_error(other.is_error) {} - template <typename T> - ResponseOrError<T>::ResponseOrError(ResponseOrError&& other) noexcept - : response(std::move(other.response)), error(std::move(other.error)), is_error(other.is_error) {} - template <typename T> - ResponseOrError<T>& ResponseOrError<T>::operator=( - const ResponseOrError& other) { - response = other.response; - error = other.error; - is_error = other.is_error; - return *this; - } - template <typename T> - ResponseOrError<T>& ResponseOrError<T>::operator=(ResponseOrError&& other) noexcept - { - response = std::move(other.response); - error = std::move(other.error); - is_error = other.is_error; - return *this; - } + class ostream; + class istream; + + //////////////////////////////////////////////////////////////////////////////// + // ResponseOrError<T> + //////////////////////////////////////////////////////////////////////////////// + + // ResponseOrError holds either the response to a request or an error + // message. + template <typename T> + struct ResponseOrError { + using Request = T; + ResponseOrError(); + ResponseOrError(const T& response); + ResponseOrError(T&& response); + ResponseOrError(const Rsp_Error& error); + ResponseOrError(Rsp_Error&& error); + ResponseOrError(const ResponseOrError& other); + ResponseOrError(ResponseOrError&& other) noexcept; + + ResponseOrError& operator=(const ResponseOrError& other); + ResponseOrError& operator=(ResponseOrError&& other) noexcept; + bool IsError() const { return is_error; } + std::string ToJson() + { + if (is_error) return error.ToJson(); + return response.ToJson(); + } + T response; + Rsp_Error error; // empty represents success. + bool is_error; + }; + + template <typename T> + ResponseOrError<T>::ResponseOrError(): is_error(false) + { + } + + template <typename T> + ResponseOrError<T>::ResponseOrError(const T& resp) : response(resp), is_error(false) {} + template <typename T> + ResponseOrError<T>::ResponseOrError(T&& resp) : response(std::move(resp)), is_error(false) {} + template <typename T> + ResponseOrError<T>::ResponseOrError(const Rsp_Error& err) : error(err), is_error(true) {} + template <typename T> + ResponseOrError<T>::ResponseOrError(Rsp_Error&& err) : error(std::move(err)), is_error(true) {} + template <typename T> + ResponseOrError<T>::ResponseOrError(const ResponseOrError& other) + : response(other.response), error(other.error), is_error(other.is_error) {} + template <typename T> + ResponseOrError<T>::ResponseOrError(ResponseOrError&& other) noexcept + : response(std::move(other.response)), error(std::move(other.error)), is_error(other.is_error) {} + template <typename T> + ResponseOrError<T>& ResponseOrError<T>::operator=( + const ResponseOrError& other) { + response = other.response; + error = other.error; + is_error = other.is_error; + return *this; + } + template <typename T> + ResponseOrError<T>& ResponseOrError<T>::operator=(ResponseOrError&& other) noexcept + { + response = std::move(other.response); + error = std::move(other.error); + is_error = other.is_error; + return *this; + } } @@ -94,247 +95,253 @@ namespace lsp { class RemoteEndPoint :MessageIssueHandler { - template <typename F, int N> - using ParamType = lsp::traits::ParameterType<F, N>; + template <typename F, int N> + using ParamType = lsp::traits::ParameterType<F, N>; - template <typename T> - using IsRequest = lsp::traits::EnableIfIsType<RequestInMessage, T>; + template <typename T> + using IsRequest = lsp::traits::EnableIfIsType<RequestInMessage, T>; - template <typename T> - using IsResponse = lsp::traits::EnableIfIsType<ResponseInMessage, T>; + template <typename T> + using IsResponse = lsp::traits::EnableIfIsType<ResponseInMessage, T>; - template <typename T> - using IsNotify = lsp::traits::EnableIfIsType<NotificationInMessage, T>; + template <typename T> + using IsNotify = lsp::traits::EnableIfIsType<NotificationInMessage, T>; - template <typename F, typename ReturnType> - using IsRequestHandler = lsp::traits::EnableIf<lsp::traits::CompatibleWith< - F, - std::function<ReturnType(const RequestInMessage&)>>:: - value>; + template <typename F, typename ReturnType> + using IsRequestHandler = lsp::traits::EnableIf<lsp::traits::CompatibleWith< + F, + std::function<ReturnType(const RequestInMessage&)>>:: + value>; - template <typename F, typename ReturnType> - using IsRequestHandlerWithMonitor = lsp::traits::EnableIf<lsp::traits::CompatibleWith< - F, - std::function<ReturnType(const RequestInMessage&,const CancelMonitor&)>>:: - value>; + template <typename F, typename ReturnType> + using IsRequestHandlerWithMonitor = lsp::traits::EnableIf<lsp::traits::CompatibleWith< + F, + std::function<ReturnType(const RequestInMessage&,const CancelMonitor&)>>:: + value>; public: - - RemoteEndPoint(const std::shared_ptr <MessageJsonHandler>& json_handler, - const std::shared_ptr < Endpoint >& localEndPoint, - lsp::Log& _log, uint8_t max_workers = 2); - - ~RemoteEndPoint() override; - template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> - IsRequestHandler< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) - { - ProcessRequestJsonHandler(handler); - local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - auto req = reinterpret_cast<const RequestType*>(msg.get()); - lsp::ResponseOrError<ResponseType> res(handler(*req)); - if (res.is_error) { - res.error.id = req->id; - send(res.error); - } - else - { - res.response.id = req->id; - send(res.response); - } - return true; - }); - } - template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> - IsRequestHandlerWithMonitor< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) { - ProcessRequestJsonHandler(handler); - local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - auto req = static_cast<const RequestType*>(msg.get()); - lsp::ResponseOrError<ResponseType> res(handler(*req , getCancelMonitor(req->id))); - if (res.is_error) { - res.error.id = req->id; - send(res.error); - } - else - { - res.response.id = req->id; - send(res.response); - } - return true; - }); - } - using RequestErrorCallback = std::function<void(const Rsp_Error&)>; - - template <typename T, typename F, typename ResponseType = ParamType<F, 0> > - void send(T& request, F&& handler, RequestErrorCallback onError) - { - ProcessRequestJsonHandler(handler); - auto cb = [=](std::unique_ptr<LspMessage> msg) { - if (!msg) - return true; - const auto result = msg.get(); - - if (static_cast<ResponseInMessage*>(result)->IsErrorType()) { - const auto rsp_error = static_cast<const Rsp_Error*>(result); - onError(*rsp_error); - } - else { - handler(*static_cast<ResponseType*>(result)); - } - - return true; - }; - internalSendRequest(request, cb); - } - - - template <typename F, typename NotifyType = ParamType<F, 0> > - IsNotify<NotifyType> registerHandler(F&& handler) { - { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetNotificationJsonHandler(NotifyType::kMethodInfo)) - { - jsonHandler->SetNotificationJsonHandler(NotifyType::kMethodInfo, - [](Reader& visitor) - { - return NotifyType::ReflectReader(visitor); - }); - } - } - local_endpoint->registerNotifyHandler(NotifyType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { - handler(*static_cast<NotifyType*>(msg.get())); - return true; - }); - } - - template <typename T, typename = IsRequest<T>> - std::future< lsp::ResponseOrError<typename T::Response> > send(T& request) { - - ProcessResponseJsonHandler(request); - using Response = typename T::Response; - auto promise = std::make_shared< std::promise<lsp::ResponseOrError<Response>>>(); - auto cb = [=](std::unique_ptr<LspMessage> msg) { - if (!msg) - return true; - auto result = msg.get(); - - if (reinterpret_cast<ResponseInMessage*>(result)->IsErrorType()) - { - Rsp_Error* rsp_error = static_cast<Rsp_Error*>(result); - Rsp_Error temp; - std::swap(temp, *rsp_error); - promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); - } - else - { - Response temp; - std::swap(temp, *static_cast<Response*>(result)); - promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); - } - return true; - }; - internalSendRequest(request, cb); - return promise->get_future(); - } - - template <typename T, typename = IsRequest<T>> - std::unique_ptr<lsp::ResponseOrError<typename T::Response>> waitResponse(T& request, const unsigned time_out = 0) - { - auto future_rsp = send(request); - if (time_out == 0) - { - future_rsp.wait(); - } - else - { - auto state = future_rsp.wait_for(std::chrono::milliseconds(time_out)); - if (std::future_status::timeout == state) - { - return {}; - } - } - - using Response = typename T::Response; - return std::make_unique<lsp::ResponseOrError<Response>>(std::move(future_rsp.get())); - } - - void send(NotificationInMessage& msg) - { - sendMsg(msg); - } - - void send(ResponseInMessage& msg) - { - sendMsg(msg); - } - - void sendNotification(NotificationInMessage& msg) - { - send(msg); - } - void sendResponse(ResponseInMessage& msg) - { - send(msg); - } - void startProcessingMessages(std::shared_ptr<lsp::istream> r, - std::shared_ptr<lsp::ostream> w); - - bool IsWorking() const - { - if (message_producer_thread_) - return true; - return false; - } - void Stop(); - - std::unique_ptr<LspMessage> internalWaitResponse(RequestInMessage&, unsigned time_out = 0); - - void internalSendRequest(RequestInMessage&, GenericResponseHandler); - - void handle(std::vector<MessageIssue>&&) override; - void handle(MessageIssue&&) override; + + RemoteEndPoint(const std::shared_ptr <MessageJsonHandler>& json_handler, + const std::shared_ptr < Endpoint >& localEndPoint, + lsp::Log& _log, uint8_t max_workers = 2); + + ~RemoteEndPoint() override; + template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> + IsRequestHandler< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) + { + processRequestJsonHandler(handler); + local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { + auto req = reinterpret_cast<const RequestType*>(msg.get()); + lsp::ResponseOrError<ResponseType> res(handler(*req)); + if (res.is_error) { + res.error.id = req->id; + send(res.error); + } + else + { + res.response.id = req->id; + send(res.response); + } + return true; + }); + } + template <typename F, typename RequestType = ParamType<F, 0>, typename ResponseType = typename RequestType::Response> + IsRequestHandlerWithMonitor< F, lsp::ResponseOrError<ResponseType> > registerHandler(F&& handler) { + processRequestJsonHandler(handler); + local_endpoint->registerRequestHandler(RequestType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { + auto req = static_cast<const RequestType*>(msg.get()); + lsp::ResponseOrError<ResponseType> res(handler(*req , getCancelMonitor(req->id))); + if (res.is_error) { + res.error.id = req->id; + send(res.error); + } + else + { + res.response.id = req->id; + send(res.response); + } + return true; + }); + } + using RequestErrorCallback = std::function<void(const Rsp_Error&)>; + + template <typename T, typename F, typename ResponseType = ParamType<F, 0> > + void send(T& request, F&& handler, RequestErrorCallback onError) + { + processRequestJsonHandler(handler); + auto cb = [=](std::unique_ptr<LspMessage> msg) { + if (!msg) + return true; + const auto result = msg.get(); + + if (static_cast<ResponseInMessage*>(result)->IsErrorType()) { + const auto rsp_error = static_cast<const Rsp_Error*>(result); + onError(*rsp_error); + } + else { + handler(*static_cast<ResponseType*>(result)); + } + + return true; + }; + internalSendRequest(request, cb); + } + + + template <typename F, typename NotifyType = ParamType<F, 0> > + IsNotify<NotifyType> registerHandler(F&& handler) { + { + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetNotificationJsonHandler(NotifyType::kMethodInfo)) + { + jsonHandler->SetNotificationJsonHandler(NotifyType::kMethodInfo, + [](Reader& visitor) + { + return NotifyType::ReflectReader(visitor); + }); + } + } + local_endpoint->registerNotifyHandler(NotifyType::kMethodInfo, [=](std::unique_ptr<LspMessage> msg) { + handler(*static_cast<NotifyType*>(msg.get())); + return true; + }); + } + + template <typename T, typename = IsRequest<T>> + lsp::future< lsp::ResponseOrError<typename T::Response> > send(T& request) { + + processResponseJsonHandler(request); + using Response = typename T::Response; + auto promise = std::make_shared< lsp::promise<lsp::ResponseOrError<Response>>>(); + auto cb = [=](std::unique_ptr<LspMessage> msg) { + if (!msg) + return true; + auto result = msg.get(); + + if (reinterpret_cast<ResponseInMessage*>(result)->IsErrorType()) + { + Rsp_Error* rsp_error = static_cast<Rsp_Error*>(result); + Rsp_Error temp; + std::swap(temp, *rsp_error); + promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); + } + else + { + Response temp; + std::swap(temp, *static_cast<Response*>(result)); + promise->set_value(std::move(lsp::ResponseOrError<Response>(std::move(temp)))); + } + return true; + }; + internalSendRequest(request, cb); + return promise->get_future(); + } + + template <typename T, typename = IsRequest<T>> + std::unique_ptr<lsp::ResponseOrError<typename T::Response>> waitResponse(T& request, const unsigned time_out = 0) + { + auto future_rsp = send(request); + if (time_out == 0) + { + future_rsp.wait(); + } + else + { + auto state = future_rsp.wait_for(std::chrono::milliseconds(time_out)); + if (lsp::future_status::timeout == state) + { + return {}; + } + } + + using Response = typename T::Response; + return std::make_unique<lsp::ResponseOrError<Response>>(std::move(future_rsp.get())); + } + + void send(NotificationInMessage& msg) + { + sendMsg(msg); + } + + void send(ResponseInMessage& msg) + { + sendMsg(msg); + } + + void sendNotification(NotificationInMessage& msg) + { + send(msg); + } + void sendResponse(ResponseInMessage& msg) + { + send(msg); + } + template <typename T> + T createRequest() { + auto req = T(); + req.id.set(getNextRequestId()); + return req; + } + + int getNextRequestId(); + + bool cancelRequest(const lsRequestId&); + + void startProcessingMessages(std::shared_ptr<lsp::istream> r, + std::shared_ptr<lsp::ostream> w); + + bool isWorking() const; + void stop(); + + std::unique_ptr<LspMessage> internalWaitResponse(RequestInMessage&, unsigned time_out = 0); + + bool internalSendRequest(RequestInMessage &info, GenericResponseHandler handler); + + void handle(std::vector<MessageIssue>&&) override; + void handle(MessageIssue&&) override; private: - CancelMonitor getCancelMonitor(const lsRequestId&); - void sendMsg(LspMessage& msg); - void mainLoop(std::unique_ptr<LspMessage>); - bool dispatch(const std::string&); - template <typename F, typename RequestType = ParamType<F, 0>> - IsRequest<RequestType> ProcessRequestJsonHandler(const F& handler) { - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetRequestJsonHandler(RequestType::kMethodInfo)) - { - jsonHandler->SetRequestJsonHandler(RequestType::kMethodInfo, - [](Reader& visitor) - { - return RequestType::ReflectReader(visitor); - }); - } - } - template <typename T, typename = IsRequest<T>> - void ProcessResponseJsonHandler(T& request) - { - using Response = typename T::Response; - std::lock_guard<std::mutex> lock(m_sendMutex); - if (!jsonHandler->GetResponseJsonHandler(T::kMethodInfo)) - { - jsonHandler->SetResponseJsonHandler(T::kMethodInfo, [](Reader& visitor) - { - if (visitor.HasMember("error")) - return Rsp_Error::ReflectReader(visitor); - return Response::ReflectReader(visitor); - }); - } - } - - struct Data; - - Data* d_ptr; - - std::shared_ptr < MessageJsonHandler> jsonHandler; - std::mutex m_sendMutex; - - std::shared_ptr < Endpoint > local_endpoint; + CancelMonitor getCancelMonitor(const lsRequestId&); + void sendMsg(LspMessage& msg); + void mainLoop(std::unique_ptr<LspMessage>); + bool dispatch(const std::string&); + template <typename F, typename RequestType = ParamType<F, 0>> + IsRequest<RequestType> processRequestJsonHandler(const F& handler) { + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetRequestJsonHandler(RequestType::kMethodInfo)) + { + jsonHandler->SetRequestJsonHandler(RequestType::kMethodInfo, + [](Reader& visitor) + { + return RequestType::ReflectReader(visitor); + }); + } + } + template <typename T, typename = IsRequest<T>> + void processResponseJsonHandler(T& request) + { + using Response = typename T::Response; + std::lock_guard<std::mutex> lock(m_sendMutex); + if (!jsonHandler->GetResponseJsonHandler(T::kMethodInfo)) + { + jsonHandler->SetResponseJsonHandler(T::kMethodInfo, [](Reader& visitor) + { + if (visitor.HasMember("error")) + return Rsp_Error::ReflectReader(visitor); + return Response::ReflectReader(visitor); + }); + } + } + + struct Data; + + Data* d_ptr; + + std::shared_ptr < MessageJsonHandler> jsonHandler; + std::mutex m_sendMutex; + + std::shared_ptr < Endpoint > local_endpoint; public: - std::shared_ptr < std::thread > message_producer_thread_; + std::shared_ptr < std::thread > message_producer_thread_; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h index 163d038a2ee..0775b36dbaf 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/RequestInMessage.h @@ -10,14 +10,14 @@ #include "lsResponseMessage.h" struct RequestInMessage : public LspMessage { - // number or string, actually no null - lsRequestId id; - std::string method; - Kind GetKid() override - { - return REQUEST_MESSAGE; - } - + // number or string, actually no null + lsRequestId id; + std::string method; + Kind GetKid() override + { + return REQUEST_MESSAGE; + } + }; @@ -25,45 +25,45 @@ struct RequestInMessage : public LspMessage { template <class T, class TDerived > struct lsRequest : public RequestInMessage { - lsRequest(MethodType _method) - { - method = _method; - } - MethodType GetMethodType() const override { return method.c_str(); } - void SetMethodType(MethodType _method) override - { - method = _method; - } \ - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } - - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { + lsRequest(MethodType _method) + { + method = _method; + } + MethodType GetMethodType() const override { return method.c_str(); } + void SetMethodType(MethodType _method) override + { + method = _method; + } \ + void ReflectWriter(Writer& writer) override { + Reflect(writer, static_cast<TDerived&>(*this)); + } + + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { - TDerived* temp = new TDerived(); - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - } - void swap(lsRequest& arg) noexcept - { - id.swap(arg.id); - method.swap(method); - std::swap(params, arg.params); - } - T params; + TDerived* temp = new TDerived(); + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + } + void swap(lsRequest& arg) noexcept + { + id.swap(arg.id); + method.swap(method); + std::swap(params, arg.params); + } + T params; }; #define DEFINE_REQUEST_RESPONSE_TYPE(MSG,request_param,response_result,methodInfo)\ namespace MSG {\ - struct response :public ResponseMessage< response_result, response> {}; \ - struct request : public lsRequest< request_param , request >{\ - static constexpr MethodType kMethodInfo = methodInfo;\ - request():lsRequest(kMethodInfo){} \ - using Response = response;\ - };\ + struct response :public ResponseMessage< response_result, response> {}; \ + struct request : public lsRequest< request_param , request >{\ + static constexpr MethodType kMethodInfo = methodInfo;\ + request():lsRequest(kMethodInfo){} \ + using Response = response;\ + };\ };\ MAKE_REFLECT_STRUCT(MSG::request, jsonrpc, id, method, params);\ MAKE_REFLECT_STRUCT(MSG::response, jsonrpc, id, result); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h index 439a9f1b0eb..e039891f5f9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/StreamMessageProducer.h @@ -7,42 +7,42 @@ #include "MessageIssue.h" namespace lsp { - class istream; + class istream; } class StreamMessageProducer : public MessageProducer { public: - struct Headers - { - int contentLength = -1; - std::string charset; - void clear() - { - contentLength = -1; - charset.clear(); - } - }; - bool handleMessage(Headers& headers, MessageConsumer callBack); - StreamMessageProducer( - MessageIssueHandler& message_issue_handler, std::shared_ptr < lsp::istream> _input) - : issueHandler(message_issue_handler), - input(_input) - { - } - StreamMessageProducer( - MessageIssueHandler& message_issue_handler) - : issueHandler(message_issue_handler) - { - } - - bool keepRunning = false; - void listen(MessageConsumer) override; - void bind(std::shared_ptr < lsp::istream>); - void parseHeader(std::string& line, Headers& headers); + struct Headers + { + int contentLength = -1; + std::string charset; + void clear() + { + contentLength = -1; + charset.clear(); + } + }; + bool handleMessage(Headers& headers, MessageConsumer callBack); + StreamMessageProducer( + MessageIssueHandler& message_issue_handler, std::shared_ptr < lsp::istream> _input) + : issueHandler(message_issue_handler), + input(_input) + { + } + StreamMessageProducer( + MessageIssueHandler& message_issue_handler) + : issueHandler(message_issue_handler) + { + } + + bool keepRunning = false; + void listen(MessageConsumer) override; + void bind(std::shared_ptr < lsp::istream>); + void parseHeader(std::string& line, Headers& headers); private: - MessageIssueHandler& issueHandler; - std::shared_ptr < lsp::istream> input; - + MessageIssueHandler& issueHandler; + std::shared_ptr < lsp::istream> input; + }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h index e533acf0569..a377be8c3e3 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/TcpServer.h @@ -36,5 +36,5 @@ namespace lsp void do_stop(); Data* d_ptr = nullptr; }; -} // namespace +} // namespace diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h new file mode 100644 index 00000000000..8e241d96e9b --- /dev/null +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/future.h @@ -0,0 +1,178 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include <condition_variable> +#include <memory> +#include <mutex> + +namespace lsp { + +// internal functionality +namespace detail { +template <typename T> +struct promise_state { + T val; + std::mutex mutex; + std::condition_variable cv; + bool hasVal = false; +}; +} // namespace detail + +// forward declaration +template <typename T> +class promise; + +// future_status is the enumeration returned by future::wait_for and +// future::wait_until. +enum class future_status { + ready, + timeout, +}; + +// future is a minimal reimplementation of std::future, that does not suffer +// from TSAN false positives. See: +// https://gcc.gnu.org/bugzilla//show_bug.cgi?id=69204 +template <typename T> +class future { + public: + using State = detail::promise_state<T>; + + // constructors + inline future() = default; + inline future(future&&) = default; + + // valid() returns true if the future has an internal state. + bool valid() const; + + // get() blocks until the future has a valid result, and returns it. + // The future must have a valid internal state to call this method. + inline T get(); + + // wait() blocks until the future has a valid result. + // The future must have a valid internal state to call this method. + void wait() const; + + // wait_for() blocks until the future has a valid result, or the timeout is + // reached. + // The future must have a valid internal state to call this method. + template <class Rep, class Period> + future_status wait_for( + const std::chrono::duration<Rep, Period>& timeout) const; + + // wait_until() blocks until the future has a valid result, or the timeout is + // reached. + // The future must have a valid internal state to call this method. + template <class Clock, class Duration> + future_status wait_until( + const std::chrono::time_point<Clock, Duration>& timeout) const; + + private: + friend promise<T>; + future(const future&) = delete; + inline future(const std::shared_ptr<State>& state); + + std::shared_ptr<State> state = std::make_shared<State>(); +}; + +template <typename T> +future<T>::future(const std::shared_ptr<State>& s) : state(s) {} + +template <typename T> +bool future<T>::valid() const { + return static_cast<bool>(state); +} + +template <typename T> +T future<T>::get() { + std::unique_lock<std::mutex> lock(state->mutex); + state->cv.wait(lock, [&] { return state->hasVal; }); + return state->val; +} + +template <typename T> +void future<T>::wait() const { + std::unique_lock<std::mutex> lock(state->mutex); + state->cv.wait(lock, [&] { return state->hasVal; }); +} + +template <typename T> +template <class Rep, class Period> +future_status future<T>::wait_for( + const std::chrono::duration<Rep, Period>& timeout) const { + std::unique_lock<std::mutex> lock(state->mutex); + return state->cv.wait_for(lock, timeout, [&] { return state->hasVal; }) + ? future_status::ready + : future_status::timeout; +} + +template <typename T> +template <class Clock, class Duration> +future_status future<T>::wait_until( + const std::chrono::time_point<Clock, Duration>& timeout) const { + std::unique_lock<std::mutex> lock(state->mutex); + return state->cv.wait_until(lock, timeout, [&] { return state->hasVal; }) + ? future_status::ready + : future_status::timeout; +} + +// promise is a minimal reimplementation of std::promise, that does not suffer +// from TSAN false positives. See: +// https://gcc.gnu.org/bugzilla//show_bug.cgi?id=69204 +template <typename T> +class promise { + public: + // constructors + inline promise() = default; + inline promise(promise&& other) = default; + inline promise(const promise& other) = default; + + // set_value() stores value to the shared state. + // set_value() must only be called once. + inline void set_value(const T& value) const; + inline void set_value(T&& value) const; + + // get_future() returns a future sharing this promise's state. + future<T> get_future(); + + private: + using State = detail::promise_state<T>; + std::shared_ptr<State> state = std::make_shared<State>(); +}; + +template <typename T> +future<T> promise<T>::get_future() { + return future<T>(state); +} + +template <typename T> +void promise<T>::set_value(const T& value) const { + std::unique_lock<std::mutex> lock(state->mutex); + state->val = value; + state->hasVal = true; + state->cv.notify_all(); +} + +template <typename T> +void promise<T>::set_value(T&& value) const { + std::unique_lock<std::mutex> lock(state->mutex); + state->val = std::move(value); + state->hasVal = true; + state->cv.notify_all(); +} + +} // namespace lsp + + diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h index 98ee91b544a..34e62329175 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/json.h @@ -10,7 +10,7 @@ class JsonReader : public Reader { std::vector<const char*> path_; public: - rapidjson::GenericValue<rapidjson::UTF8<>>* m_; + rapidjson::GenericValue<rapidjson::UTF8<>>* m_; JsonReader(rapidjson::GenericValue<rapidjson::UTF8<>>* m) : m_(m) {} SerializeFormat Format() const override { return SerializeFormat::Json; } @@ -35,10 +35,10 @@ class JsonReader : public Reader { bool HasMember(const char* x) override { - if (m_->IsObject()) - return m_->HasMember(x); - else - return false; + if (m_->IsObject()) + return m_->HasMember(x); + else + return false; } std::unique_ptr<Reader> operator[](const char* x) override { auto& sub = (*m_)[x]; @@ -59,7 +59,7 @@ class JsonReader : public Reader { class JsonWriter : public Writer { public: - rapidjson::Writer<rapidjson::StringBuffer>* m_; + rapidjson::Writer<rapidjson::StringBuffer>* m_; JsonWriter(rapidjson::Writer<rapidjson::StringBuffer>* m) : m_(m) {} SerializeFormat Format() const override { return SerializeFormat::Json; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h index 87e94669ab6..2efc80b19a8 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsRequestId.h @@ -3,49 +3,49 @@ #include "LibLsp/JsonRpc/serializer.h" struct lsRequestId { - // The client can send the request id as an int or a string. We should output - // the same format we received. - enum Type { kNone, kInt, kString }; - Type type = kNone; + // The client can send the request id as an int or a string. We should output + // the same format we received. + enum Type { kNone, kInt, kString }; + Type type = kNone; - int value = -1; - std::string k_string; - bool has_value() const { return type != kNone; } - void swap(lsRequestId& arg) noexcept - { - std::swap(arg, *this); - } - void set(int v) - { - value = v; - type = kInt; - } - void set(const std::string& v) - { - k_string = v; - type = kString; - } - bool operator==(const lsRequestId& rhs) const - { - if (type != rhs.type) return false; - if (type == kInt) - return value == rhs.value; - return k_string == rhs.k_string; - } - bool operator!=(const lsRequestId& rhs) const - { - return !operator==(rhs); - } - bool operator<(const lsRequestId& rhs) const - { - if (type != rhs.type) return false; - if (type == kInt) - return value < rhs.value; - return k_string < rhs.k_string; - } + int value = -1; + std::string k_string; + bool has_value() const { return type != kNone; } + void swap(lsRequestId& arg) noexcept + { + std::swap(arg, *this); + } + void set(int v) + { + value = v; + type = kInt; + } + void set(const std::string& v) + { + k_string = v; + type = kString; + } + bool operator==(const lsRequestId& rhs) const + { + if (type != rhs.type) return false; + if (type == kInt) + return value == rhs.value; + return k_string == rhs.k_string; + } + bool operator!=(const lsRequestId& rhs) const + { + return !operator==(rhs); + } + bool operator<(const lsRequestId& rhs) const + { + if (type != rhs.type) return false; + if (type == kInt) + return value < rhs.value; + return k_string < rhs.k_string; + } }; void Reflect(Reader& visitor, lsRequestId& value); void Reflect(Writer& visitor, lsRequestId& value); // Debug method to convert an id to a string. -std::string ToString(const lsRequestId& id);
\ No newline at end of file +std::string ToString(const lsRequestId& id); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h index ba94167cf8b..68ad502b0c2 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/lsResponseMessage.h @@ -7,65 +7,65 @@ struct ResponseInMessage :public LspMessage { - lsRequestId id; - std::string m_methodType; + lsRequestId id; + std::string m_methodType; - virtual MethodType GetMethodType() const override - { - return m_methodType.data(); - }; - virtual void SetMethodType(MethodType _type) override - { - m_methodType = _type; - }; + virtual MethodType GetMethodType() const override + { + return m_methodType.data(); + }; + virtual void SetMethodType(MethodType _type) override + { + m_methodType = _type; + }; - Kind GetKid() override - { - return RESPONCE_MESSAGE; - } - virtual bool IsErrorType() - { - return false; - } + Kind GetKid() override + { + return RESPONCE_MESSAGE; + } + virtual bool IsErrorType() + { + return false; + } }; template <class TDerived > struct BaseResponseMessage : ResponseInMessage { - void ReflectWriter(Writer& writer) override { - Reflect(writer, static_cast<TDerived&>(*this)); - } - static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { + void ReflectWriter(Writer& writer) override { + Reflect(writer, static_cast<TDerived&>(*this)); + } + static std::unique_ptr<LspMessage> ReflectReader(Reader& visitor) { - TDerived* temp = new TDerived(); - std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); - // Reflect may throw and *message will be partially deserialized. - Reflect(visitor, static_cast<TDerived&>(*temp)); - return message; - } + TDerived* temp = new TDerived(); + std::unique_ptr<TDerived> message = std::unique_ptr<TDerived>(temp); + // Reflect may throw and *message will be partially deserialized. + Reflect(visitor, static_cast<TDerived&>(*temp)); + return message; + } }; template <class T, class TDerived > struct ResponseMessage : BaseResponseMessage<TDerived> { - T result; - void swap(ResponseMessage<T, TDerived>& arg) noexcept - { - std::swap(result, arg.result); - this->id.swap(arg.id); - this->m_methodType.swap(arg.m_methodType); - } + T result; + void swap(ResponseMessage<T, TDerived>& arg) noexcept + { + std::swap(result, arg.result); + this->id.swap(arg.id); + this->m_methodType.swap(arg.m_methodType); + } }; template <class T, class TDerived > struct ResponseError : BaseResponseMessage<TDerived> { - T error; - bool IsErrorType() override { return true; } - void swap(ResponseError<T, TDerived>& arg) noexcept - { + T error; + bool IsErrorType() override { return true; } + void swap(ResponseError<T, TDerived>& arg) noexcept + { - this->id.swap(arg.id); - this->m_methodType.swap(arg.m_methodType); - std::swap(error, arg.error); - } + this->id.swap(arg.id); + this->m_methodType.swap(arg.m_methodType); + std::swap(error, arg.error); + } }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h index f09ba5b1a74..19a96342869 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/macro_map.h @@ -27,7 +27,7 @@ DEALINGS IN THE SOFTWARE. // Taken from https://github.com/cbeck88/visit_struct. // // Usage -// +// // #define PRINT_DOUBLE(x) printf(#x " = %d\n", x); // // MACRO_MAP(PRINT_DOUBLE, 1, 2, 3) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h index 6603f3fb3a2..57f4932520d 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/message.h @@ -9,26 +9,26 @@ struct LspMessage { public: - std::string jsonrpc = "2.0"; - virtual void ReflectWriter(Writer&) = 0; - - // Send the message to the language client by writing it to stdout. - void Write(std::ostream& out); - - - virtual MethodType GetMethodType() const = 0; - virtual void SetMethodType(MethodType) = 0; - - virtual ~LspMessage()=default; - enum Kind - { - REQUEST_MESSAGE, - RESPONCE_MESSAGE, - NOTIFICATION_MESSAGE - }; - - virtual Kind GetKid() = 0; - virtual std::string ToJson() ; - + std::string jsonrpc = "2.0"; + virtual void ReflectWriter(Writer&) = 0; + + // Send the message to the language client by writing it to stdout. + void Write(std::ostream& out); + + + virtual MethodType GetMethodType() const = 0; + virtual void SetMethodType(MethodType) = 0; + + virtual ~LspMessage()=default; + enum Kind + { + REQUEST_MESSAGE, + RESPONCE_MESSAGE, + NOTIFICATION_MESSAGE + }; + + virtual Kind GetKid() = 0; + virtual std::string ToJson() ; + }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h index 71b6bede593..477c8228451 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/serializer.h @@ -24,64 +24,64 @@ enum class SerializeFormat { Json, MessagePack }; // A tag type that can be used to write `null` to json. struct JsonNull { - void swap(JsonNull& arg) noexcept; + void swap(JsonNull& arg) noexcept; }; class Reader { public: - virtual ~Reader() {} - virtual SerializeFormat Format() const = 0; - - virtual bool IsBool() = 0; - virtual bool IsNull() = 0; - virtual bool IsArray() = 0; - virtual bool IsInt() = 0; - virtual bool IsInt64() = 0; - virtual bool IsUint64() = 0; - virtual bool IsDouble() = 0; + virtual ~Reader() {} + virtual SerializeFormat Format() const = 0; + + virtual bool IsBool() = 0; + virtual bool IsNull() = 0; + virtual bool IsArray() = 0; + virtual bool IsInt() = 0; + virtual bool IsInt64() = 0; + virtual bool IsUint64() = 0; + virtual bool IsDouble() = 0; virtual bool IsNumber() = 0; virtual bool IsString() = 0; - virtual void GetNull() = 0; - virtual bool GetBool() = 0; - virtual int GetInt() = 0; - virtual uint32_t GetUint32() = 0; - virtual int64_t GetInt64() = 0; - virtual uint64_t GetUint64() = 0; - virtual double GetDouble() = 0; - virtual std::string GetString() = 0; - - virtual bool HasMember(const char* x) = 0; - virtual std::unique_ptr<Reader> operator[](const char* x) = 0; - virtual void IterMap( std::function<void(const char*, Reader&)> fn) = 0; - virtual void IterArray(std::function<void(Reader&)> fn) = 0; - virtual void DoMember(const char* name, std::function<void(Reader&)> fn) = 0; - virtual std::string ToString() const = 0; + virtual void GetNull() = 0; + virtual bool GetBool() = 0; + virtual int GetInt() = 0; + virtual uint32_t GetUint32() = 0; + virtual int64_t GetInt64() = 0; + virtual uint64_t GetUint64() = 0; + virtual double GetDouble() = 0; + virtual std::string GetString() = 0; + + virtual bool HasMember(const char* x) = 0; + virtual std::unique_ptr<Reader> operator[](const char* x) = 0; + virtual void IterMap( std::function<void(const char*, Reader&)> fn) = 0; + virtual void IterArray(std::function<void(Reader&)> fn) = 0; + virtual void DoMember(const char* name, std::function<void(Reader&)> fn) = 0; + virtual std::string ToString() const = 0; }; class Writer { public: - virtual ~Writer() {} - virtual SerializeFormat Format() const = 0; - - virtual void Null() = 0; - virtual void Bool(bool x) = 0; - virtual void Int(int x) = 0; - virtual void Uint32(uint32_t x) = 0; - virtual void Int64(int64_t x) = 0; - virtual void Uint64(uint64_t x) = 0; - virtual void Double(double x) = 0; - virtual void String(const char* x) = 0; - virtual void String(const char* x, size_t len) = 0; - virtual void StartArray(size_t) = 0; - virtual void EndArray() = 0; - virtual void StartObject() = 0; - virtual void EndObject() = 0; - virtual void Key(const char* name) = 0; + virtual ~Writer() {} + virtual SerializeFormat Format() const = 0; + + virtual void Null() = 0; + virtual void Bool(bool x) = 0; + virtual void Int(int x) = 0; + virtual void Uint32(uint32_t x) = 0; + virtual void Int64(int64_t x) = 0; + virtual void Uint64(uint64_t x) = 0; + virtual void Double(double x) = 0; + virtual void String(const char* x) = 0; + virtual void String(const char* x, size_t len) = 0; + virtual void StartArray(size_t) = 0; + virtual void EndArray() = 0; + virtual void StartObject() = 0; + virtual void EndObject() = 0; + virtual void Key(const char* name) = 0; }; @@ -130,9 +130,9 @@ struct optionals_mandatory_tag {}; #define _MAPPABLE_SWAP_MEMBER(name) std::swap(name,arg.name); -#define MAKE_SWAP_METHOD(type, ...) \ -void swap(type& arg) noexcept{ \ - MACRO_MAP(_MAPPABLE_SWAP_MEMBER, __VA_ARGS__) \ +#define MAKE_SWAP_METHOD(type, ...) \ +void swap(type& arg) noexcept{ \ + MACRO_MAP(_MAPPABLE_SWAP_MEMBER, __VA_ARGS__) \ } #define MAKE_REFLECT_STRUCT_OPTIONALS_MANDATORY(type, ...) \ @@ -208,171 +208,171 @@ void Reflect(Writer& visitor, SerializeFormat& value); template <typename T> void Reflect(Reader& visitor, boost::optional<T>& value) { - if (visitor.IsNull()) { - visitor.GetNull(); - return; - } - T real_value; - Reflect(visitor, real_value); - value = std::move(real_value); + if (visitor.IsNull()) { + visitor.GetNull(); + return; + } + T real_value; + Reflect(visitor, real_value); + value = std::move(real_value); } template <typename T> void Reflect(Writer& visitor, boost::optional<T>& value) { - if (value) - Reflect(visitor, *value); - else - visitor.Null(); + if (value) + Reflect(visitor, *value); + else + visitor.Null(); } template <typename T> void ReflectMember(Writer& visitor, const char* name, boost::optional<T>& value) { - // For TypeScript optional property key?: value in the spec, - // We omit both key and value if value is std::nullopt (null) for JsonWriter - // to reduce output. But keep it for other serialization formats. - if (value || visitor.Format() != SerializeFormat::Json) { - visitor.Key(name); - Reflect(visitor, value); - } + // For TypeScript optional property key?: value in the spec, + // We omit both key and value if value is std::nullopt (null) for JsonWriter + // to reduce output. But keep it for other serialization formats. + if (value || visitor.Format() != SerializeFormat::Json) { + visitor.Key(name); + Reflect(visitor, value); + } } template <typename T> void ReflectMember(Writer& visitor, - const char* name, - T& value, - optionals_mandatory_tag) { - visitor.Key(name); - Reflect(visitor, value); + const char* name, + T& value, + optionals_mandatory_tag) { + visitor.Key(name); + Reflect(visitor, value); } template <typename T> void ReflectMember(Reader& visitor, - const char* name, - T& value, - optionals_mandatory_tag) { - Reflect(visitor, value); + const char* name, + T& value, + optionals_mandatory_tag) { + Reflect(visitor, value); } template<class T > void Reflect(Reader& visitor, std::map<std::string, T>& value) { - visitor.IterMap([&](const char* name,Reader& entry) { - T entry_value; - Reflect(entry, entry_value); - value[name]=(std::move(entry_value)); - }); + visitor.IterMap([&](const char* name,Reader& entry) { + T entry_value; + Reflect(entry, entry_value); + value[name]=(std::move(entry_value)); + }); } template<class _Ty > void Reflect(Writer& visitor, std::map<std::string, _Ty>& value) { - REFLECT_MEMBER_START(); - for (auto& it : value) - { - visitor.Key(it.first.c_str()); - Reflect(visitor, it.second); - } - REFLECT_MEMBER_END(); + REFLECT_MEMBER_START(); + for (auto& it : value) + { + visitor.Key(it.first.c_str()); + Reflect(visitor, it.second); + } + REFLECT_MEMBER_END(); } // std::vector template <typename T> void Reflect(Reader& visitor, std::vector<T>& values) { - visitor.IterArray([&](Reader& entry) { - T entry_value; - Reflect(entry, entry_value); - values.push_back(std::move(entry_value)); - }); + visitor.IterArray([&](Reader& entry) { + T entry_value; + Reflect(entry, entry_value); + values.push_back(std::move(entry_value)); + }); } template <typename T> void Reflect(Writer& visitor, std::vector<T>& values) { - visitor.StartArray(values.size()); - for (auto& value : values) - Reflect(visitor, value); - visitor.EndArray(); + visitor.StartArray(values.size()); + for (auto& value : values) + Reflect(visitor, value); + visitor.EndArray(); } // ReflectMember inline void DefaultReflectMemberStart(Writer& visitor) { - visitor.StartObject(); + visitor.StartObject(); } inline void DefaultReflectMemberStart(Reader& visitor) {} template <typename T> bool ReflectMemberStart(Reader& visitor, T& value) { - return false; + return false; } template <typename T> bool ReflectMemberStart(Writer& visitor, T& value) { - visitor.StartObject(); - return true; + visitor.StartObject(); + return true; } template <typename T> void ReflectMemberEnd(Reader& visitor, T& value) {} template <typename T> void ReflectMemberEnd(Writer& visitor, T& value) { - visitor.EndObject(); + visitor.EndObject(); } template <typename T> void ReflectMember(Reader& visitor, const char* name, T& value) { - visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); }); + visitor.DoMember(name, [&](Reader& child) { Reflect(child, value); }); } template <typename T> void ReflectMember(Writer& visitor, const char* name, T& value) { - visitor.Key(name); - Reflect(visitor, value); + visitor.Key(name); + Reflect(visitor, value); } template<class _Ty1, class _Ty2> void Reflect(Writer& visitor, std::pair< boost::optional<_Ty1>, boost::optional<_Ty2> >& value) { - if (value.first) - { - Reflect(visitor, value.first); - } - else - { - Reflect(visitor, value.second); - } + if (value.first) + { + Reflect(visitor, value.first); + } + else + { + Reflect(visitor, value.second); + } } template<class _Ty2> void Reflect(Reader& visitor, std::pair< boost::optional<bool>, boost::optional<_Ty2> >& value) { - if(visitor.IsBool()) - { - Reflect(visitor, value.first); - return; - } + if(visitor.IsBool()) + { + Reflect(visitor, value.first); + return; + } - Reflect(visitor, value.second); + Reflect(visitor, value.second); } template<class _Ty2> void Reflect(Reader& visitor, std::pair< boost::optional<std::string>, boost::optional<_Ty2> >& value) { - if (visitor.IsString()) - { - Reflect(visitor, value.first); - return; - } + if (visitor.IsString()) + { + Reflect(visitor, value.first); + return; + } - Reflect(visitor, value.second); + Reflect(visitor, value.second); } template<class _Ty1, class _Ty2> void Reflect(Reader& visitor, std::pair< boost::optional<_Ty1>, boost::optional<_Ty2> >& value) { - try - { - Reflect(visitor, value.second); - } - catch (...) - { - Reflect(visitor, value.first); - } + try + { + Reflect(visitor, value.second); + } + catch (...) + { + Reflect(visitor, value.first); + } } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h index 549c361950a..3dd3def9930 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/stream.h @@ -3,194 +3,194 @@ #include <string> namespace lsp { - class stream - { - public: - virtual ~stream() = default; - virtual bool fail() = 0; - virtual bool bad() = 0; - virtual bool eof() = 0; - virtual bool good() = 0; - virtual void clear() = 0; - virtual std::string what() = 0; - virtual bool need_to_clear_the_state() - { - return false; - } - - bool operator!() - { - return bad(); - } - }; - class istream : public stream - { - public: - virtual int get() = 0; - virtual ~istream() = default; - virtual istream& read(char* str, std::streamsize count) = 0; - }; - template <class T > - class base_istream : public istream - { - public: - explicit base_istream(T& _t) :_impl(_t) - { - - } - - int get() override - { - return _impl.get(); - } - bool fail() override - { - return _impl.fail(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - bool good() override - { - return _impl.good(); - } - istream& read(char* str, std::streamsize count) override - { - _impl.read(str, count); - return *this; - } - - void clear() override - { - _impl.clear(); - } - T& _impl; - }; - class ostream : public stream - { - public: - virtual ~ostream() = default; - - virtual ostream& write(const std::string&) = 0; - virtual ostream& write(std::streamsize) = 0; - virtual ostream& flush() = 0; - - }; - template <class T > - class base_ostream : public ostream - { - public: - explicit base_ostream(T& _t) :_impl(_t) - { - - } - - bool fail() override - { - return _impl.fail(); - } - bool good() override - { - return _impl.good(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - - ostream& write(const std::string& c) override - { - _impl << c; - return *this; - } - - ostream& write(std::streamsize _s) override - { - - _impl << std::to_string(_s); - return *this; - } - - ostream& flush() override - { - _impl.flush(); - return *this; - } - - void clear() override - { - _impl.clear(); - } - protected: - T& _impl; - }; - - template <class T > - class base_iostream : public istream, public ostream - { - public: - explicit base_iostream(T& _t) :_impl(_t) - { - - } - - int get() override - { - return _impl.get(); - } - bool fail() override - { - return _impl.fail(); - } - bool bad() override - { - return _impl.bad(); - } - bool eof() override - { - return _impl.eof(); - } - bool good() override - { - return _impl.good(); - } - istream& read(char* str, std::streamsize count) override - { - _impl.read(str, count); - return *this; - } - ostream& write(const std::string& c) override - { - _impl << c; - return *this; - } - - ostream& write(std::streamsize _s) override - { - _impl << std::to_string(_s); - return *this; - } - - ostream& flush() override - { - _impl.flush(); - return *this; - } - - void clear() override - { - _impl.clear(); - } - protected: - T& _impl; - }; + class stream + { + public: + virtual ~stream() = default; + virtual bool fail() = 0; + virtual bool bad() = 0; + virtual bool eof() = 0; + virtual bool good() = 0; + virtual void clear() = 0; + virtual std::string what() = 0; + virtual bool need_to_clear_the_state() + { + return false; + } + + bool operator!() + { + return bad(); + } + }; + class istream : public stream + { + public: + virtual int get() = 0; + virtual ~istream() = default; + virtual istream& read(char* str, std::streamsize count) = 0; + }; + template <class T > + class base_istream : public istream + { + public: + explicit base_istream(T& _t) :_impl(_t) + { + + } + + int get() override + { + return _impl.get(); + } + bool fail() override + { + return _impl.fail(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + bool good() override + { + return _impl.good(); + } + istream& read(char* str, std::streamsize count) override + { + _impl.read(str, count); + return *this; + } + + void clear() override + { + _impl.clear(); + } + T& _impl; + }; + class ostream : public stream + { + public: + virtual ~ostream() = default; + + virtual ostream& write(const std::string&) = 0; + virtual ostream& write(std::streamsize) = 0; + virtual ostream& flush() = 0; + + }; + template <class T > + class base_ostream : public ostream + { + public: + explicit base_ostream(T& _t) :_impl(_t) + { + + } + + bool fail() override + { + return _impl.fail(); + } + bool good() override + { + return _impl.good(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + + ostream& write(const std::string& c) override + { + _impl << c; + return *this; + } + + ostream& write(std::streamsize _s) override + { + + _impl << std::to_string(_s); + return *this; + } + + ostream& flush() override + { + _impl.flush(); + return *this; + } + + void clear() override + { + _impl.clear(); + } + protected: + T& _impl; + }; + + template <class T > + class base_iostream : public istream, public ostream + { + public: + explicit base_iostream(T& _t) :_impl(_t) + { + + } + + int get() override + { + return _impl.get(); + } + bool fail() override + { + return _impl.fail(); + } + bool bad() override + { + return _impl.bad(); + } + bool eof() override + { + return _impl.eof(); + } + bool good() override + { + return _impl.good(); + } + istream& read(char* str, std::streamsize count) override + { + _impl.read(str, count); + return *this; + } + ostream& write(const std::string& c) override + { + _impl << c; + return *this; + } + + ostream& write(std::streamsize _s) override + { + _impl << std::to_string(_s); + return *this; + } + + ostream& flush() override + { + _impl.flush(); + return *this; + } + + void clear() override + { + _impl.clear(); + } + protected: + T& _impl; + }; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h index cca9f9a486a..3e1ba547ca0 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/JsonRpc/threaded_queue.h @@ -57,23 +57,23 @@ struct MultiQueueWaiter { static bool HasState(std::initializer_list<BaseThreadQueue*> queues); bool ValidateWaiter(std::initializer_list<BaseThreadQueue*> queues); - + template <typename... BaseThreadQueue> bool Wait(std::atomic<bool>& quit, BaseThreadQueue... queues) { - MultiQueueLock<BaseThreadQueue...> l(queues...); - while (!quit.load(std::memory_order_relaxed)) { - if (HasState({ queues... })) - return false; - cv.wait(l); - } - return true; + MultiQueueLock<BaseThreadQueue...> l(queues...); + while (!quit.load(std::memory_order_relaxed)) { + if (HasState({ queues... })) + return false; + cv.wait(l); + } + return true; } template <typename... BaseThreadQueue> void WaitUntil(std::chrono::steady_clock::time_point t, - BaseThreadQueue... queues) { - MultiQueueLock<BaseThreadQueue...> l(queues...); - if (!HasState({ queues... })) - cv.wait_until(l, t); + BaseThreadQueue... queues) { + MultiQueueLock<BaseThreadQueue...> l(queues...); + if (!HasState({ queues... })) + cv.wait_until(l, t); } template <typename... BaseThreadQueue> void Wait(BaseThreadQueue... queues) { @@ -181,22 +181,22 @@ struct ThreadedQueue : public BaseThreadQueue { } // Return all elements in the queue. std::vector<T> DequeueAll() { - std::lock_guard<std::mutex> lock(mutex); - - total_count_ = 0; - - std::vector<T> result; - result.reserve(priority_.size() + queue_.size()); - while (!priority_.empty()) { - result.emplace_back(std::move(priority_.front())); - priority_.pop_front(); - } - while (!queue_.empty()) { - result.emplace_back(std::move(queue_.front())); - queue_.pop_front(); - } - - return result; + std::lock_guard<std::mutex> lock(mutex); + + total_count_ = 0; + + std::vector<T> result; + result.reserve(priority_.size() + queue_.size()); + while (!priority_.empty()) { + result.emplace_back(std::move(priority_.front())); + priority_.pop_front(); + } + while (!queue_.empty()) { + result.emplace_back(std::move(queue_.front())); + queue_.pop_front(); + } + + return result; } std::vector<T> TryDequeueSome(size_t num) { std::lock_guard<std::mutex> lock(mutex); @@ -213,7 +213,7 @@ struct ThreadedQueue : public BaseThreadQueue { } else { - break; + break; } num -= 1; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h index ef1ee438603..4f9aae08515 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/AbsolutePath.h @@ -4,21 +4,21 @@ #include <string> struct AbsolutePath { - static AbsolutePath BuildDoNotUse(const std::string& path); + static AbsolutePath BuildDoNotUse(const std::string& path); - // Try not to use this. - AbsolutePath(); + // Try not to use this. + AbsolutePath(); - // Provide implicit conversions to std::string for the time being. - AbsolutePath(const std::string& path, bool validate = true); - operator std::string() const; + // Provide implicit conversions to std::string for the time being. + AbsolutePath(const std::string& path, bool validate = true); + operator std::string() const; - bool operator==(const AbsolutePath& rhs) const; - bool operator!=(const AbsolutePath& rhs) const; - bool operator<(const AbsolutePath& rhs) const; - bool operator>(const AbsolutePath& rhs) const; - std::string path; - bool qualify = true; + bool operator==(const AbsolutePath& rhs) const; + bool operator!=(const AbsolutePath& rhs) const; + bool operator<(const AbsolutePath& rhs) const; + bool operator>(const AbsolutePath& rhs) const; + std::string path; + bool qualify = true; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h index 7adf557f83a..29ab82b1c6b 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ClientPreferences.h @@ -9,298 +9,298 @@ class ClientPreferences { public: - std::shared_ptr<lsWorkspaceClientCapabilites> workspace; - lsTextDocumentClientCapabilities textDocument ; - - ClientPreferences(const lsClientCapabilities& capabilities) - { - v3supported = capabilities.textDocument.has_value(); - if (v3supported) - textDocument = capabilities.textDocument.value(); - if(capabilities.workspace) - { - workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); - } - } - - bool v3supported=false; - - bool isSignatureHelpSupported() { - - return v3supported && (textDocument.signatureHelp); - } - bool isWorkspaceDidChangeConfigurationSupported() const - { - return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); - } - bool isWorkspaceFoldersSupported() { - return workspace != nullptr && isTrue(workspace->workspaceFolders); - } - - bool isCompletionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.completion); - } - - bool isCompletionSnippetsSupported() { - //@formatter:off - if(!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if(completion.completionItem) - { - return isTrue(completion.completionItem.value().snippetSupport); - } - return false; - } - - bool isV3Supported() { - return v3supported; - } - - bool isFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.formatting); - } - - bool isRangeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); - } - - bool isOnTypeFormattingDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); - } - - bool isCodeLensDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); - } - - bool isSignatureHelpDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); - } - template<typename T> - static bool isDynamicRegistrationSupported(boost::optional<T>& capability) - { - if(capability) - return (capability.value().dynamicRegistration.value()); - return false; - } - - bool isTrue(const boost::optional<bool>& value) - { - return value.get_value_or(false); - } - - bool isRenameDynamicRegistrationSupported() { - return v3supported && isDynamicRegistrationSupported(textDocument.rename); - } - - bool isExecuteCommandDynamicRegistrationSupported() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); - } - - bool isWorkspaceSymbolDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); - } - - bool isWorkspaceChangeWatchedFilesDynamicRegistered() { - return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); - } - - bool isDocumentSymbolDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); - } - - bool isCodeActionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); - } - - bool isDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.definition); - } - - bool isTypeDefinitionDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); - } - - bool isHoverDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.hover); - } - - bool isReferencesDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.references); - } - - bool isDocumentHighlightDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); - } - - bool isFoldgingRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); - } - - bool isImplementationDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.implementation); - } - - bool isSelectionRangeDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); - } - - bool isWillSaveRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSave); - } - - bool isWillSaveWaitUntilRegistered() { - return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); - } - - bool isWorkspaceApplyEditSupported() { - return workspace != nullptr && isTrue(workspace->applyEdit); - } - - bool isSupportsCompletionDocumentationMarkdown() { - - if (!v3supported || !textDocument.completion) - { - return false; - } - const auto& completion = textDocument.completion.value(); - if (completion.completionItem) - { - auto& documentationFormat = completion.completionItem.value().documentationFormat; - if(documentationFormat) - { - auto& data = documentationFormat.value(); - for(auto& it : data) - { - if(it == "markdown") - { - return true; - } - } - } - } - return false; - - } - - - bool isWorkspaceEditResourceChangesSupported() { - if(!workspace) return false; - - if(workspace->workspaceEdit) - { - return isTrue(workspace->workspaceEdit.value().resourceChanges); - } - return false; - } - static bool contains(const std::vector<std::string>& v, const std::string& target) - { - for(auto& it : v) - { - if(it == target) return true; - } - return false; - } - bool isResourceOperationSupported() const - { - if (!workspace) return false; - if (!workspace->workspaceEdit) - { - return false; - } - auto& it = (workspace->workspaceEdit.value()); - if(!it.resourceOperations) return false; - const auto& resourceOperations = it.resourceOperations.value(); - return contains(resourceOperations, "create") && contains(resourceOperations, "rename") && contains(resourceOperations, "delete"); - - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} to - * {@code true} when initializing the LS. Otherwise, {@code false}. - */ - bool isHierarchicalDocumentSymbolSupported() { - if(!v3supported || !textDocument.documentSymbol) return false; - return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); - - } - - bool isSemanticHighlightingSupported() { - //@formatter:off - if (!v3supported || !textDocument.semanticHighlightingCapabilities) return false; - return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); - //@formatter:on - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.codeAction.codeActionLiteralSupport.codeActionKind.valueSet} - * value. Otherwise, {@code false}. - */ - bool isSupportedCodeActionKind(const std::string& kind) { - if (!v3supported || !textDocument.codeAction) return false; - //@formatter:off - const auto& codeAction = textDocument.codeAction.value(); - if(codeAction.codeActionLiteralSupport) - { - const auto& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; - if(codeActionKind) - { - const auto& valueSet = codeActionKind.value().valueSet; - if(valueSet) - { - for(auto& k : valueSet.value()) - { - if(lsp::StartsWith(kind,k)) - { - return true; - } - } - } - } - } - return false; - - //@formatter:on - } - - /** - * {@code true} if the client has explicitly set the - * {@code textDocument.publishDiagnostics.tagSupport} to - * {@code true} when initializing the LS. Otherwise, {@code false}. - */ - bool isDiagnosticTagSupported() { - if (!v3supported || !textDocument.publishDiagnostics) return false; - const auto& publishDiagnostics = textDocument.publishDiagnostics.value(); - if(publishDiagnostics.tagSupport) - { - isTagSupported(publishDiagnostics.tagSupport); - } - return false; - } - - bool isTagSupported(const boost::optional < std::pair<boost::optional<bool>, - boost::optional<DiagnosticsTagSupport> > >& tagSupport) { - if(tagSupport) - { - auto &v = tagSupport.value(); - if (v.first) - { - return v.first.value(); - } - if (v.second) { - return !v.second.value().valueSet.empty(); - } - } - return false; - } - - bool isCallHierarchyDynamicRegistered() { - return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); - } + std::shared_ptr<lsWorkspaceClientCapabilites> workspace; + lsTextDocumentClientCapabilities textDocument ; + + ClientPreferences(const lsClientCapabilities& capabilities) + { + v3supported = capabilities.textDocument.has_value(); + if (v3supported) + textDocument = capabilities.textDocument.value(); + if(capabilities.workspace) + { + workspace = std::make_shared<lsWorkspaceClientCapabilites>(capabilities.workspace.value()); + } + } + + bool v3supported=false; + + bool isSignatureHelpSupported() { + + return v3supported && (textDocument.signatureHelp); + } + bool isWorkspaceDidChangeConfigurationSupported() const + { + return workspace && isDynamicRegistrationSupported(workspace->didChangeConfiguration); + } + bool isWorkspaceFoldersSupported() { + return workspace != nullptr && isTrue(workspace->workspaceFolders); + } + + bool isCompletionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.completion); + } + + bool isCompletionSnippetsSupported() { + //@formatter:off + if(!v3supported || !textDocument.completion) + { + return false; + } + const auto& completion = textDocument.completion.value(); + if(completion.completionItem) + { + return isTrue(completion.completionItem.value().snippetSupport); + } + return false; + } + + bool isV3Supported() { + return v3supported; + } + + bool isFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.formatting); + } + + bool isRangeFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.rangeFormatting); + } + + bool isOnTypeFormattingDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.onTypeFormatting); + } + + bool isCodeLensDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.codeLens); + } + + bool isSignatureHelpDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.signatureHelp); + } + template<typename T> + static bool isDynamicRegistrationSupported(boost::optional<T>& capability) + { + if(capability) + return (capability.value().dynamicRegistration.value()); + return false; + } + + bool isTrue(const boost::optional<bool>& value) + { + return value.get_value_or(false); + } + + bool isRenameDynamicRegistrationSupported() { + return v3supported && isDynamicRegistrationSupported(textDocument.rename); + } + + bool isExecuteCommandDynamicRegistrationSupported() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->executeCommand); + } + + bool isWorkspaceSymbolDynamicRegistered() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->symbol); + } + + bool isWorkspaceChangeWatchedFilesDynamicRegistered() { + return v3supported && workspace != nullptr && isDynamicRegistrationSupported(workspace->didChangeWatchedFiles); + } + + bool isDocumentSymbolDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.documentSymbol); + } + + bool isCodeActionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.codeAction); + } + + bool isDefinitionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.definition); + } + + bool isTypeDefinitionDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.typeDefinition); + } + + bool isHoverDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.hover); + } + + bool isReferencesDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.references); + } + + bool isDocumentHighlightDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.documentHighlight); + } + + bool isFoldgingRangeDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.foldingRange); + } + + bool isImplementationDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.implementation); + } + + bool isSelectionRangeDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.selectionRange); + } + + bool isWillSaveRegistered() { + return v3supported && isTrue(textDocument.synchronization.willSave); + } + + bool isWillSaveWaitUntilRegistered() { + return v3supported && isTrue(textDocument.synchronization.willSaveWaitUntil); + } + + bool isWorkspaceApplyEditSupported() { + return workspace != nullptr && isTrue(workspace->applyEdit); + } + + bool isSupportsCompletionDocumentationMarkdown() { + + if (!v3supported || !textDocument.completion) + { + return false; + } + const auto& completion = textDocument.completion.value(); + if (completion.completionItem) + { + auto& documentationFormat = completion.completionItem.value().documentationFormat; + if(documentationFormat) + { + auto& data = documentationFormat.value(); + for(auto& it : data) + { + if(it == "markdown") + { + return true; + } + } + } + } + return false; + + } + + + bool isWorkspaceEditResourceChangesSupported() { + if(!workspace) return false; + + if(workspace->workspaceEdit) + { + return isTrue(workspace->workspaceEdit.value().resourceChanges); + } + return false; + } + static bool contains(const std::vector<std::string>& v, const std::string& target) + { + for(auto& it : v) + { + if(it == target) return true; + } + return false; + } + bool isResourceOperationSupported() const + { + if (!workspace) return false; + if (!workspace->workspaceEdit) + { + return false; + } + auto& it = (workspace->workspaceEdit.value()); + if(!it.resourceOperations) return false; + const auto& resourceOperations = it.resourceOperations.value(); + return contains(resourceOperations, "create") && contains(resourceOperations, "rename") && contains(resourceOperations, "delete"); + + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} to + * {@code true} when initializing the LS. Otherwise, {@code false}. + */ + bool isHierarchicalDocumentSymbolSupported() { + if(!v3supported || !textDocument.documentSymbol) return false; + return isTrue(textDocument.documentSymbol.value().hierarchicalDocumentSymbolSupport); + + } + + bool isSemanticHighlightingSupported() { + //@formatter:off + if (!v3supported || !textDocument.semanticHighlightingCapabilities) return false; + return isTrue(textDocument.semanticHighlightingCapabilities.value().semanticHighlighting); + //@formatter:on + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.codeAction.codeActionLiteralSupport.codeActionKind.valueSet} + * value. Otherwise, {@code false}. + */ + bool isSupportedCodeActionKind(const std::string& kind) { + if (!v3supported || !textDocument.codeAction) return false; + //@formatter:off + const auto& codeAction = textDocument.codeAction.value(); + if(codeAction.codeActionLiteralSupport) + { + const auto& codeActionKind = codeAction.codeActionLiteralSupport.value().codeActionKind; + if(codeActionKind) + { + const auto& valueSet = codeActionKind.value().valueSet; + if(valueSet) + { + for(auto& k : valueSet.value()) + { + if(lsp::StartsWith(kind,k)) + { + return true; + } + } + } + } + } + return false; + + //@formatter:on + } + + /** + * {@code true} if the client has explicitly set the + * {@code textDocument.publishDiagnostics.tagSupport} to + * {@code true} when initializing the LS. Otherwise, {@code false}. + */ + bool isDiagnosticTagSupported() { + if (!v3supported || !textDocument.publishDiagnostics) return false; + const auto& publishDiagnostics = textDocument.publishDiagnostics.value(); + if(publishDiagnostics.tagSupport) + { + isTagSupported(publishDiagnostics.tagSupport); + } + return false; + } + + bool isTagSupported(const boost::optional < std::pair<boost::optional<bool>, + boost::optional<DiagnosticsTagSupport> > >& tagSupport) { + if(tagSupport) + { + auto &v = tagSupport.value(); + if (v.first) + { + return v.first.value(); + } + if (v.second) { + return !v.second.value().valueSet.empty(); + } + } + return false; + } + + bool isCallHierarchyDynamicRegistered() { + return v3supported && isDynamicRegistrationSupported(textDocument.callHierarchy); + } }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h index a1e3f1dcc1e..1704dd33c6c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/CodeActionParams.h @@ -7,98 +7,98 @@ #include "LibLsp/lsp/lsCodeAction.h" namespace JDT { - namespace CodeActionKind { - - - /** - * Base kind for quickfix actions: 'quickfix' - */ - extern const char* QuickFix; - - /** - * Base kind for refactoring actions: 'refactor' - */ - extern const char* Refactor; - - /** - * Base kind for refactoring extraction actions: 'refactor.extract' - * - * Example extract actions: - * - * - Extract method - Extract function - Extract variable - Extract interface - * from class - ... - */ - extern const char* RefactorExtract; - - /** - * Base kind for refactoring inline actions: 'refactor.inline' - * - * Example inline actions: - * - * - Inline function - Inline variable - Inline constant - ... - */ - extern const char* RefactorInline; - - /** - * Base kind for refactoring rewrite actions: 'refactor.rewrite' - * - * Example rewrite actions: - * - * - Convert JavaScript function to class - Add or remove parameter - - * Encapsulate field - Make method static - Move method to base class - ... - */ - extern const char* RefactorRewrite; - - /** - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. - */ - extern const char* Source ; - - /** - * Base kind for an organize imports source action: `source.organizeImports` - */ - extern const char* SourceOrganizeImports; - - extern const char* COMMAND_ID_APPLY_EDIT; - }; + namespace CodeActionKind { + + + /** + * Base kind for quickfix actions: 'quickfix' + */ + extern const char* QuickFix; + + /** + * Base kind for refactoring actions: 'refactor' + */ + extern const char* Refactor; + + /** + * Base kind for refactoring extraction actions: 'refactor.extract' + * + * Example extract actions: + * + * - Extract method - Extract function - Extract variable - Extract interface + * from class - ... + */ + extern const char* RefactorExtract; + + /** + * Base kind for refactoring inline actions: 'refactor.inline' + * + * Example inline actions: + * + * - Inline function - Inline variable - Inline constant - ... + */ + extern const char* RefactorInline; + + /** + * Base kind for refactoring rewrite actions: 'refactor.rewrite' + * + * Example rewrite actions: + * + * - Convert JavaScript function to class - Add or remove parameter - + * Encapsulate field - Make method static - Move method to base class - ... + */ + extern const char* RefactorRewrite; + + /** + * Base kind for source actions: `source` + * + * Source code actions apply to the entire file. + */ + extern const char* Source ; + + /** + * Base kind for an organize imports source action: `source.organizeImports` + */ + extern const char* SourceOrganizeImports; + + extern const char* COMMAND_ID_APPLY_EDIT; + }; } struct lsCodeActionContext { - // An array of diagnostics. - std::vector<lsDiagnostic> diagnostics; - /** - * Requested kind of actions to return. - * - * Actions not of this kind are filtered out by the client before being shown. So servers - * can omit computing them. - * - * See {@link CodeActionKind} for allowed values. - */ - boost::optional<std::vector<std::string>> only; - - MAKE_SWAP_METHOD(lsCodeActionContext, - diagnostics, only); + // An array of diagnostics. + std::vector<lsDiagnostic> diagnostics; + /** + * Requested kind of actions to return. + * + * Actions not of this kind are filtered out by the client before being shown. So servers + * can omit computing them. + * + * See {@link CodeActionKind} for allowed values. + */ + boost::optional<std::vector<std::string>> only; + + MAKE_SWAP_METHOD(lsCodeActionContext, + diagnostics, only); }; MAKE_REFLECT_STRUCT(lsCodeActionContext, - diagnostics, only); + diagnostics, only); // Params for the CodeActionRequest struct lsCodeActionParams { - // The document in which the command was invoked. - lsTextDocumentIdentifier textDocument; - // The range for which the command was invoked. - lsRange range; - // Context carrying additional information. - lsCodeActionContext context; - - MAKE_SWAP_METHOD(lsCodeActionParams, - textDocument, - range, - context); + // The document in which the command was invoked. + lsTextDocumentIdentifier textDocument; + // The range for which the command was invoked. + lsRange range; + // Context carrying additional information. + lsCodeActionContext context; + + MAKE_SWAP_METHOD(lsCodeActionParams, + textDocument, + range, + context); }; MAKE_REFLECT_STRUCT(lsCodeActionParams, textDocument, diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Directory.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Directory.h index 93f2c0807d3..77b6cbb3e79 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Directory.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Directory.h @@ -4,10 +4,10 @@ struct AbsolutePath; struct Directory { - explicit Directory(const AbsolutePath& path); + explicit Directory(const AbsolutePath& path); - bool operator==(const Directory& rhs) const; - bool operator!=(const Directory& rhs) const; + bool operator==(const Directory& rhs) const; + bool operator!=(const Directory& rhs) const; - std::string path; + std::string path; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h index c06eed4b1ce..5ad4e07d8d4 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ExecuteCommandParams.h @@ -2,19 +2,19 @@ #include "lsAny.h" struct ExecuteCommandParams { - /** - * The identifier of the actual command handler. - */ + /** + * The identifier of the actual command handler. + */ - std::string command; + std::string command; - /** - * Arguments that the command should be invoked with. - * The arguments are typically specified when a command is returned from the server to the client. - * Example requests that return a command are textDocument/codeAction or textDocument/codeLens. - */ - boost::optional<std::vector<lsp::Any>> arguments; - - MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); + /** + * Arguments that the command should be invoked with. + * The arguments are typically specified when a command is returned from the server to the client. + * Example requests that return a command are textDocument/codeAction or textDocument/codeLens. + */ + boost::optional<std::vector<lsp::Any>> arguments; + + MAKE_SWAP_METHOD(ExecuteCommandParams, command, arguments); }; MAKE_REFLECT_STRUCT(ExecuteCommandParams,command,arguments) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h index bf1337e44fe..369ebb2a6da 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/IProgressMonitor.h @@ -2,7 +2,7 @@ #include <string> -namespace lsp { +namespace lsp { /** * The <code>IProgressMonitor</code> interface is implemented * by objects that monitor the progress of an activity; the methods @@ -36,110 +36,108 @@ namespace lsp { * Clients may implement this interface. * </p> */ - class IProgressMonitor { - public: - virtual ~IProgressMonitor() - { - } - - /** Constant indicating an unknown amount of work. - */ - - const static int UNKNOWN = -1; - - /** - * Notifies that the main task is beginning. This must only be called once - * on a given progress monitor instance. - * - * @param name the name (or description) of the main task - * @param totalWork the total number of work units into which - * the main task is been subdivided. If the value is <code>UNKNOWN</code> - * the implemenation is free to indicate progress in a way which - * doesn't require the total number of work units in advance. - */ - virtual void beginTask(void* , int totalWork) - { - - }; - /** - * Notifies that the work is done; that is, either the main task is completed - * or the user canceled it. This method may be called more than once - * (implementations should be prepared to handle this case). - */ - - virtual void endTask(void*, int totalWork) - { - - } - - virtual void done(void*) = 0; - - /** - * Internal method to handle scaling correctly. This method - * must not be called by a client. Clients should - * always use the method </code>worked(int)</code>. - */ - virtual void internalWorked(double work) - { - - } - /** - * Returns whether cancelation of current operation has been requested. - * Long-running operations should poll to see if cancelation - * has been requested. - * - * @return <code>true</code> if cancellation has been requested, - * and <code>false</code> otherwise - * @see #setCanceled - */ - virtual bool isCanceled() = 0; - /** - * Sets the cancel state to the given value. - * - * @param value <code>true</code> indicates that cancelation has - * been requested (but not necessarily acknowledged); - * <code>false</code> clears this flag - * - * @see #isCanceled - */ - virtual void setCanceled(bool value) = 0; - /** - * Sets the task name to the given value. This method is used to - * restore the task label after a nested operation was executed. - * Normally there is no need for clients to call this method. - * - * @param name the name (or description) of the main task - * @see #beginTask(java.lang.const wstring&, int) - */ - virtual void setTaskName(void*) - { - - }; - /** - * Notifies that a subtask of the main task is beginning. - * Subtasks are optional; the main task might not have subtasks. - * - * @param name the name (or description) of the subtask - */ - virtual void subTask(void* ) - { - - } - /** - * Notifies that a given number of work unit of the main task - * has been completed. Note that this amount represents an - * installment, as opposed to a cumulative amount of work done - * to date. - * - * @param work the number of work units just completed - */ - virtual void worked(int work) - { - - }; - - virtual void catch_exception(void*) = 0; - }; + class IProgressMonitor { + public: + virtual ~IProgressMonitor() + { + } + + /** Constant indicating an unknown amount of work. + */ + + const static int UNKNOWN = -1; + + /** + * Notifies that the main task is beginning. This must only be called once + * on a given progress monitor instance. + * + * @param name the name (or description) of the main task + * @param totalWork the total number of work units into which + * the main task is been subdivided. If the value is <code>UNKNOWN</code> + * the implemenation is free to indicate progress in a way which + * doesn't require the total number of work units in advance. + */ + virtual void beginTask(void* , int totalWork) + { + + }; + /** + * Notifies that the work is done; that is, either the main task is completed + * or the user canceled it. This method may be called more than once + * (implementations should be prepared to handle this case). + */ + + virtual void endTask(void*, int totalWork) + { + + } + + virtual void done(void*) = 0; + + /** + * Internal method to handle scaling correctly. This method + * must not be called by a client. Clients should + * always use the method <code>worked(int)</code>. + */ + virtual void internalWorked(double work) + { + + } + /** + * Returns whether cancelation of current operation has been requested. + * Long-running operations should poll to see if cancelation + * has been requested. + * + * @return <code>true</code> if cancellation has been requested, + * and <code>false</code> otherwise + * @see #setCanceled + */ + virtual bool isCanceled() = 0; + /** + * Sets the cancel state to the given value. + * + * @param value <code>true</code> indicates that cancelation has + * been requested (but not necessarily acknowledged); + * <code>false</code> clears this flag + * + * @see #isCanceled + */ + virtual void setCanceled(bool value) = 0; + /** + * Sets the task name to the given value. This method is used to + * restore the task label after a nested operation was executed. + * Normally there is no need for clients to call this method. + * + * @param name the name (or description) of the main task + * @see #beginTask(java.lang.const wstring&, int) + */ + virtual void setTaskName(void*) + { + + }; + /** + * Notifies that a subtask of the main task is beginning. + * Subtasks are optional; the main task might not have subtasks. + * + * @param name the name (or description) of the subtask + */ + virtual void subTask(void* ) + { + + } + /** + * Notifies that a given number of work unit of the main task + * has been completed. Note that this amount represents an + * installment, as opposed to a cumulative amount of work done + * to date. + * + * @param work the number of work units just completed + */ + virtual void worked(int work) + { + + }; + + virtual void catch_exception(void*) = 0; + }; } - - diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h index 92d773db0cc..1618939c698 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/Markup.h @@ -1,5 +1,5 @@ #pragma once -#include <cctype> +#include <cctype> #include <clocale> #include <cstddef> #include <memory> @@ -11,7 +11,7 @@ namespace lsp { - + /// Holds text and knows how to lay it out. Multiple blocks can be grouped to /// form a document. Blocks include their own trailing newlines, std::string_ref /// should trim them if need be. diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h index 220817a1a27..bac8fbbaf51 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/Markup/string_ref.h @@ -12,877 +12,877 @@ namespace std { - /** - * An extension of STL's string providing additional functionality that is often availiable in - * higher-level languages such as Python. - */ - class string_ref : public string - { - public: - - //static unsigned GetAutoSenseRadix(string_ref& Str) { - // if (Str.empty()) - // return 10; - - // if (Str.start_with("0x") || Str.start_with("0X")) { - // Str = Str.substr(2); - // return 16; - // } - - // if (Str.start_with("0b") || Str.start_with("0B")) { - // Str = Str.substr(2); - // return 2; - // } - - // if (Str.start_with("0o")) { - // Str = Str.substr(2); - // return 8; - // } - - // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { - // Str = Str.substr(1); - // return 8; - // } - - // return 10; - //} - - //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, - // unsigned long long& Result) { - // // Autosense radix if not specified. - // if (Radix == 0) - // Radix = GetAutoSenseRadix(Str); - - // // Empty strings (after the radix autosense) are invalid. - // if (Str.empty()) return true; - - // // Parse all the bytes of the string given this radix. Watch for overflow. - // string_ref Str2 = Str; - // Result = 0; - // while (!Str2.empty()) { - // unsigned CharVal; - // if (Str2[0] >= '0' && Str2[0] <= '9') - // CharVal = Str2[0] - '0'; - // else if (Str2[0] >= 'a' && Str2[0] <= 'z') - // CharVal = Str2[0] - 'a' + 10; - // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') - // CharVal = Str2[0] - 'A' + 10; - // else - // break; - - // // If the parsed value is larger than the integer radix, we cannot - // // consume any more characters. - // if (CharVal >= Radix) - // break; - - // // Add in this character. - // unsigned long long PrevResult = Result; - // Result = Result * Radix + CharVal; - - // // Check for overflow by shifting back and seeing if bits were lost. - // if (Result / Radix < PrevResult) - // return true; - - // Str2 = Str2.substr(1); - // } - - // // We consider the operation a failure if no characters were consumed - // // successfully. - // if (Str.size() == Str2.size()) - // return true; - - // Str = Str2; - // return false; - //} - - //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, - // long long& Result) { - // unsigned long long ULLVal; - - // // Handle positive strings first. - // if (Str.empty() || Str.front() != '-') { - // if (consumeUnsignedInteger(Str, Radix, ULLVal) || - // // Check for value so large it overflows a signed value. - // (long long)ULLVal < 0) - // return true; - // Result = ULLVal; - // return false; - // } - - // // Get the positive part of the value. - // string_ref Str2 = Str.drop_front(1); - // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || - // // Reject values so large they'd overflow as negative signed, but allow - // // "-0". This negates the unsigned so that the negative isn't undefined - // // on signed overflow. - // (long long)-ULLVal > 0) - // return true; - - // Str = Str2; - // Result = -ULLVal; - // return false; - //} - - ///// GetAsUnsignedInteger - Workhorse method that converts a integer character - ///// sequence of radix up to 36 to an unsigned long long value. - //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, - // unsigned long long& Result) { - // if (consumeUnsignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsUnsignedInteger, we require the whole string to be consumed or - // // else we consider it a failure. - // return !Str.empty(); - //} - - //static bool getAsSignedInteger(string_ref Str, unsigned Radix, - // long long& Result) { - // if (consumeSignedInteger(Str, Radix, Result)) - // return true; - - // // For getAsSignedInteger, we require the whole string to be consumed or else - // // we consider it a failure. - // return !Str.empty(); - //} - - - ///// Parse the current string as an integer of the specified radix. If - ///// \p Radix is specified as zero, this does radix autosensing using - ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. - ///// - ///// If the string is invalid or if only a subset of the string is valid, - ///// this returns true to signify the error. The string is considered - ///// erroneous if empty or if it overflows T. - //template <typename T> - //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // long long LLVal; - // if (getAsSignedInteger(*this, Radix, LLVal) || - // static_cast<T>(LLVal) != LLVal) - // return true; - // Result = LLVal; - // return false; - //} - - //template <typename T> - //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> - // getAsInteger(unsigned Radix, T& Result) const { - // unsigned long long ULLVal; - // // The additional cast to unsigned long long is required to avoid the - // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type - // // 'unsigned __int64' when instantiating getAsInteger with T = bool. - // if (getAsUnsignedInteger(*this, Radix, ULLVal) || - // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) - // return true; - // Result = ULLVal; - // return false; - //} - - - - /**` - * Default constructor - * - * Constructs an empty string_ref ("") - */ - string_ref() : string() { } - - /** - * Duplicate the STL string copy constructor - * - * @param[in] s The string to copy - * @param[in] pos The starting position in the string to copy from - * @param[in] n The number of characters to copy - */ - string_ref(const string &s, size_type pos = 0, size_type n = npos) : string(s, pos, npos) { } - - /** - * Construct an string_ref from a null-terminated character array - * - * @param[in] s The character array to copy into the new string - */ - string_ref(const value_type *s) : string(s) { } - - /** - * Construct an string_ref from a character array and a length - * - * @param[in] s The character array to copy into the new string - * @param[in] n The number of characters to copy - */ - string_ref(const value_type *s, size_type n) : string(s, n) { } - - /** - * Create an string_ref with @p n copies of @p c - * - * @param[in] n The number of copies - * @param[in] c The character to copy @p n times - */ - string_ref(size_type n, value_type c) : string(n, c) { } - - /** - * Create a string from a range - * - * @param[in] first The first element to copy in - * @param[in] last The last element to copy in - */ - template <class InputIterator> - string_ref(InputIterator first, InputIterator last) : string(first, last) { } - - /** - * The destructor - */ - ~string_ref() { } - - /** - * Split a string by whitespace - * - * @return A vector of strings, each of which is a substring of the string - */ - vector<string_ref> split(size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') - { - if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) - continue; - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Split a string by a character - * - * Returns a vector of ext_strings, each of which is a substring of the string formed by splitting - * it on boundaries formed by the character @p separator. If @p limit is set, the returned vector - * will contain a maximum of @p limit elements with the last element containing the rest of - * the string. - * - * If @p separator is not found in the string, a single element will be returned in the vector - * containing the entire string. - * - * The separators are removed from the output - * - * @param[in] separator The character separator to split the string on - * @param[in] limit The maximum number of output elements - * @return A vector of strings, each of which is a substring of the string - * - * @section split_ex Example - * @code - * std::string_ref s("This|is|a|test."); - * std::vector<std::string_ref> v = s.split('|'); - * std::copy(v.begin(), v.end(), std::ostream_iterator<std::string_ref>(std::cout, "\n")); - * - * This - * is - * a - * test. - * @endcode - */ - vector<string_ref> split(value_type separator, size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (*i == separator) - { - v.push_back(string_ref(last, i)); - last = i + 1; - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Split a string by another string - * - * Returns a vector of ext_strings, each of which is a substring of the string formed by - * splitting it on boundaries formed by the string @p separator. If @p limit is set, the - * returned vector will contain a maximum of @p limit elements with the last element - * containing the rest of the string. - * - * If @p separator is not found in the string, a single element will be returned in the - * vector containing the entire string. - * - * The separators are removed from the output - * - * @param[in] separator The string separator to split the string on - * @param[in] limit The maximum number of output elements - * @return A vector of strings, each of which is a substring of the string - * - * @ref split_ex - */ - vector<string_ref> split(const string &separator, size_type limit = npos) const - { - vector<string_ref> v; - - const_iterator - i = begin(), - last = i; - for (; i != end(); i++) - { - if (string(i, i + separator.length()) == separator) - { - v.push_back(string_ref(last, i)); - last = i + separator.length(); - - if (v.size() >= limit - 1) - { - v.push_back(string_ref(last, end())); - return v; - } - } - } - - if (last != i) - v.push_back(string_ref(last, i)); - - return v; - } - - /** - * Convert a string into an integer - * - * Convert the initial portion of a string into a signed integer. Once a non-numeric - * character is reached, the remainder of @p string is ignored and the integer that was - * read returned. - * - * @param s The string to convert - * @return The integer converted from @p string - */ - static long int integer(const string &s) - { - long int retval = 0; - bool neg = false; - - for (const_iterator i = s.begin(); i != s.end(); i++) - { - if (i == s.begin()) - { - if (*i == '-') - { - neg = true; - continue; - } - else if (*i == '+') - continue; - } - if (*i >= '0' && *i <= '9') - { - retval *= 10; - retval += *i - '0'; - } - else - break; - } - - if (neg) - retval *= -1; - - return retval; - } - - /** - * Convert the string to an integer - * - * Convert the initial portion of the string into a signed integer. Once a non-numeric - * character is reached, the remainder of the string is ignored and the integer that had - * been read thus far is returned. - * - * @return The integer converted from the string - */ - long int integer() const - { - return integer(*this); - } - - /** - * Split a string into chunks of size @p chunklen. Returns a vector of strings. - * - * Splits a string into chunks of the given size. The final chunk may not fill its - * entire allocated number of characters. - * - * @param[in] chunklen The number of characters per chunk - * @return A vector of strings, each of length <= chunklen - * - * @section chunk_split-ex Example - * @code - * std::string_ref s("abcdefghijk"); - * std::vector<std::string_ref> v = s.chunk_split(3); - * std::copy(v.begin(), v.end(), ostream_iterator<std::string_ref>(cout, " ")); - * - * abc def ghi jk - * @endcode - */ - vector<string_ref> chunk_split(size_type chunklen) const - { - vector<string_ref> retval; - retval.reserve(size() / chunklen + 1); - - size_type count = 0; - const_iterator - i = begin(), - last = i; - for (; i != end(); i++, count++) - { - if (count == chunklen) - { - count = 0; - retval.push_back(string_ref(last, i)); - last = i; - } - } - - if (last != i) - retval.push_back(string_ref(last, i)); - - return retval; - } - - /** - * Join a sequence of strings by some glue to create a new string - * - * Glue is not added to the end of the string. - * - * @pre [first, last) is a valid range - * @pre InputIterator is a model of STL's Input Iterator - * @pre InputIterator must point to a string type (std::string, std::string_ref, char *) - * - * @param[in] glue The glue to join strings with - * @param[in] first The beginning of the range to join - * @param[in] last The end of the range to join - * @return A string constructed of each element of the range connected together with @p glue - * - * @section join_ex Example - * @code - * std::vector<std::string_ref> v; - * v.push_back("This"); - * v.push_back("is"); - * v.push_back("a"); - * v.push_back("test."); - * std::cout << std::string_ref::join("|", v.begin(), v.end()) << std::endl; - * - * This|is|a|test. - * @endcode - */ - template <class InputIterator> - static string_ref join(const string &glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(glue); - } - retval.erase(retval.length() - glue.length()); - - return retval; - } - - /** - * Join a sequence of strings by some glue to create a new string - * - * @copydoc join - * @ref join_ex - */ - template <class InputIterator> - static string_ref join(value_type glue, InputIterator first, InputIterator last) - { - string_ref retval; - - for (; first != last; ++first) - { - retval.append(*first); - retval.append(1, glue); - } - retval.erase(retval.length() - 1); - - return retval; - } - - /** - * Search for any instances of @p needle and replace them with @p s - * - * @param[in] needle The string to replace - * @param[in] s The replacement string - * @return *this - * @post All instances of @p needle in the string are replaced with @p s - * - * @section replace-ex Example - * @code - * std::string_ref s("This is a test."); - * s.replace("is", "ere"); - * std::cout << s << std::endl; - * - * There ere a test. - * @endcode - */ - string_ref &replace(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - while ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - string_ref &replace_first(const string &needle, const string &s) - { - size_type - lastpos = 0, - thispos; - - if ((thispos = find(needle, lastpos)) != npos) - { - string::replace(thispos, needle.length(), s); - lastpos = thispos + 1; - } - return *this; - } - /** - * Search of any instances of @p needle and replace them with @p c - * - * @param[in] needle The character to replace - * @param[in] c The replacement character - * @return *this - * @post All instances of @p needle in the string are replaced with @p c - * - * @ref replace-ex - */ - string_ref &replace(value_type needle, value_type c) - { - for (iterator i = begin(); i != end(); i++) - if (*i == needle) - *i = c; - - return *this; - } - - /** - * Repeat a string @p n times - * - * @param[in] n The number of times to repeat the string - * @return string_ref containing @p n copies of the string - * - * @section repeat-ex Example - * @code - * std::string_ref s("123"); - * s = s * 3; - * std::cout << s << std::endl; - * - * 123123123 - * @endcode - */ - string_ref operator*(size_type n) - { - string_ref retval; - for (size_type i = 0; i < n; i++) - retval.append(*this); - - return retval; - } - - /** - * Convert the string to lowercase - * - * @return *this - * @post The string is converted to lowercase - */ - string_ref &tolower() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i = (*i) + ('a' - 'A'); - return *this; - } - - /** - * Convert the string to uppercase - * - * @return *this - * @post The string is converted to uppercase - */ - string_ref &toupper() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'a' && *i <= 'z') - *i = (*i) - ('a' - 'A'); - return *this; - } - - /** - * Count the occurances of @p str in the string. - * - * @return The count of substrings @p str in the string - */ - size_type count(const string &str) const - { - size_type - count = 0, - last = 0, - cur = 0; - - while ((cur = find(str, last + 1)) != npos) - { - count++; - last = cur; - } - - return count; - } - - /** - * Determine if the string is alphanumeric - * - * @return true if the string contains only characters between a-z, A-Z and 0-9 and - * contains at least one character, else false - */ - bool is_alnum() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - { - if (*i < 'A' || *i > 'Z') - if (*i < '0' || *i > '9') - if (*i < 'a' || *i > 'z') - return false; - } - - return true; - } - - /** - * Determine if the string is alphabetic only - * - * @return true of the string contains only characters between a-z and A-Z and contains at - * least one character, else false - */ - bool is_alpha() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) - return false; - - return true; - } - - /** - * Determine if the string is numeric only - * - * @return true if the string contains only characters between 0-9 and contains at least - * one character, else false - */ - bool is_numeric() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < '0' || *i > '9') - return false; - - return true; - } - - /** - * Determine if a string is all lower case - * - * @return true if there is at least one character, and all characters are lowercase - * letters, else false - */ - bool is_lower() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'a' || *i < 'z') - return false; - - return true; - } - - /** - * Determine if a string is all upper case - * - * @return true if there is at least one character, and all characters are uppercase - * letters, else false - */ - bool is_upper() const - { - if (length() == 0) - return false; - - for (const_iterator i = begin(); i != end(); i++) - if (*i < 'A' || *i > 'Z') - return false; - - return true; - } - - /** - * Swap the case of a string - * - * @post Converts all uppercase to lowercase, and all lowercase to uppercase in the string - * @return *this - */ - string_ref &swapcase() - { - for (iterator i = begin(); i != end(); i++) - if (*i >= 'A' && *i <= 'Z') - *i += ('a' - 'A'); - else if (*i >= 'a' && *i <= 'z') - *i -= ('a' - 'A'); - - return *this; - } - - /******************************************************************************* - Function: std::string_ref::start_with - Access: public - Qualifier: const - Parameter: const string & str - Returns: bool - - Purpose: is the string start with str - *******************************************************************************/ - bool start_with(const string& str) const - { - return ( this->find(str) == 0 ); - } - - /// Return a string_ref equal to 'this' but with only the last \p N - /// elements remaining. If \p N is greater than the length of the - /// string, the entire string is returned. - - string_ref take_back(size_t N = 1) const { - if (N >= size()) - return *this; - return drop_front(size() - N); - } - /// Return a string_ref equal to 'this' but with the first \p N elements - /// dropped. - - string_ref drop_front(size_t N = 1) const { - //assert(size() >= N && "Dropping more elements than exist"); - return substr(N); - } - - - - /// Return a string_ref equal to 'this' but with the last \p N elements - /// dropped. - - string_ref drop_back(size_t N = 1) const { - - return substr(0, size() - N); - } - - /// Return a string_ref equal to 'this', but with all characters satisfying - /// the given predicate dropped from the beginning of the string. - - string_ref drop_while(std::function<bool(char)> F) const { - return substr(std::find_if_not(begin(),end(),F)-begin()); - } - - /// Return a string_ref equal to 'this', but with all characters not - /// satisfying the given predicate dropped from the beginning of the string. - - string_ref drop_until(std::function<bool(char)> F) const { - return substr(std::find_if(begin(), end(), F) - begin()); - } - - /// Returns true if this string_ref has the given prefix and removes that - /// prefix. - bool consume_front(string_ref Prefix) { - if (!start_with(Prefix)) - return false; - - *this = drop_front(Prefix.size()); - return true; - } - - /// Returns true if this string_ref has the given suffix and removes that - /// suffix. - bool consume_back(string_ref Suffix) { - if (!end_with(Suffix)) - return false; - - *this = drop_back(Suffix.size()); - return true; - } - - /******************************************************************************* - Function: std::string_ref::end_with - Access: public - Qualifier: const - Parameter: const string & str - Returns: bool - - Purpose: is the string end with str - *******************************************************************************/ - bool end_with(const string& str) const - { - if (str.length() > this->length()) - { - return false; - } - size_type off = this->length() - str.length(); - return ( find(str, off) == off); - } - - /******************************************************************************* - Function: hl_lib::string_ref::format - Access: public - Qualifier: - Parameter: const char * format_string - Parameter: ... - Returns: string_ref& - - Purpose: format the string - *******************************************************************************/ - string_ref& format(const char* format_string, ...) - { + /** + * An extension of STL's string providing additional functionality that is often availiable in + * higher-level languages such as Python. + */ + class string_ref : public string + { + public: + + //static unsigned GetAutoSenseRadix(string_ref& Str) { + // if (Str.empty()) + // return 10; + + // if (Str.start_with("0x") || Str.start_with("0X")) { + // Str = Str.substr(2); + // return 16; + // } + + // if (Str.start_with("0b") || Str.start_with("0B")) { + // Str = Str.substr(2); + // return 2; + // } + + // if (Str.start_with("0o")) { + // Str = Str.substr(2); + // return 8; + // } + + // if (Str[0] == '0' && Str.size() > 1 && std::isdigit(Str[1])) { + // Str = Str.substr(1); + // return 8; + // } + + // return 10; + //} + + //static bool consumeUnsignedInteger(string_ref& Str, unsigned Radix, + // unsigned long long& Result) { + // // Autosense radix if not specified. + // if (Radix == 0) + // Radix = GetAutoSenseRadix(Str); + + // // Empty strings (after the radix autosense) are invalid. + // if (Str.empty()) return true; + + // // Parse all the bytes of the string given this radix. Watch for overflow. + // string_ref Str2 = Str; + // Result = 0; + // while (!Str2.empty()) { + // unsigned CharVal; + // if (Str2[0] >= '0' && Str2[0] <= '9') + // CharVal = Str2[0] - '0'; + // else if (Str2[0] >= 'a' && Str2[0] <= 'z') + // CharVal = Str2[0] - 'a' + 10; + // else if (Str2[0] >= 'A' && Str2[0] <= 'Z') + // CharVal = Str2[0] - 'A' + 10; + // else + // break; + + // // If the parsed value is larger than the integer radix, we cannot + // // consume any more characters. + // if (CharVal >= Radix) + // break; + + // // Add in this character. + // unsigned long long PrevResult = Result; + // Result = Result * Radix + CharVal; + + // // Check for overflow by shifting back and seeing if bits were lost. + // if (Result / Radix < PrevResult) + // return true; + + // Str2 = Str2.substr(1); + // } + + // // We consider the operation a failure if no characters were consumed + // // successfully. + // if (Str.size() == Str2.size()) + // return true; + + // Str = Str2; + // return false; + //} + + //static bool consumeSignedInteger(string_ref& Str, unsigned Radix, + // long long& Result) { + // unsigned long long ULLVal; + + // // Handle positive strings first. + // if (Str.empty() || Str.front() != '-') { + // if (consumeUnsignedInteger(Str, Radix, ULLVal) || + // // Check for value so large it overflows a signed value. + // (long long)ULLVal < 0) + // return true; + // Result = ULLVal; + // return false; + // } + + // // Get the positive part of the value. + // string_ref Str2 = Str.drop_front(1); + // if (consumeUnsignedInteger(Str2, Radix, ULLVal) || + // // Reject values so large they'd overflow as negative signed, but allow + // // "-0". This negates the unsigned so that the negative isn't undefined + // // on signed overflow. + // (long long)-ULLVal > 0) + // return true; + + // Str = Str2; + // Result = -ULLVal; + // return false; + //} + + ///// GetAsUnsignedInteger - Workhorse method that converts a integer character + ///// sequence of radix up to 36 to an unsigned long long value. + //static bool getAsUnsignedInteger(string_ref Str, unsigned Radix, + // unsigned long long& Result) { + // if (consumeUnsignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsUnsignedInteger, we require the whole string to be consumed or + // // else we consider it a failure. + // return !Str.empty(); + //} + + //static bool getAsSignedInteger(string_ref Str, unsigned Radix, + // long long& Result) { + // if (consumeSignedInteger(Str, Radix, Result)) + // return true; + + // // For getAsSignedInteger, we require the whole string to be consumed or else + // // we consider it a failure. + // return !Str.empty(); + //} + + + ///// Parse the current string as an integer of the specified radix. If + ///// \p Radix is specified as zero, this does radix autosensing using + ///// extended C rules: 0 is octal, 0x is hex, 0b is binary. + ///// + ///// If the string is invalid or if only a subset of the string is valid, + ///// this returns true to signify the error. The string is considered + ///// erroneous if empty or if it overflows T. + //template <typename T> + //std::enable_if_t<std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // long long LLVal; + // if (getAsSignedInteger(*this, Radix, LLVal) || + // static_cast<T>(LLVal) != LLVal) + // return true; + // Result = LLVal; + // return false; + //} + + //template <typename T> + //std::enable_if_t<!std::numeric_limits<T>::is_signed, bool> + // getAsInteger(unsigned Radix, T& Result) const { + // unsigned long long ULLVal; + // // The additional cast to unsigned long long is required to avoid the + // // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type + // // 'unsigned __int64' when instantiating getAsInteger with T = bool. + // if (getAsUnsignedInteger(*this, Radix, ULLVal) || + // static_cast<unsigned long long>(static_cast<T>(ULLVal)) != ULLVal) + // return true; + // Result = ULLVal; + // return false; + //} + + + + /**` + * Default constructor + * + * Constructs an empty string_ref ("") + */ + string_ref() : string() { } + + /** + * Duplicate the STL string copy constructor + * + * @param[in] s The string to copy + * @param[in] pos The starting position in the string to copy from + * @param[in] n The number of characters to copy + */ + string_ref(const string &s, size_type pos = 0, size_type n = npos) : string(s, pos, npos) { } + + /** + * Construct an string_ref from a null-terminated character array + * + * @param[in] s The character array to copy into the new string + */ + string_ref(const value_type *s) : string(s) { } + + /** + * Construct an string_ref from a character array and a length + * + * @param[in] s The character array to copy into the new string + * @param[in] n The number of characters to copy + */ + string_ref(const value_type *s, size_type n) : string(s, n) { } + + /** + * Create an string_ref with @p n copies of @p c + * + * @param[in] n The number of copies + * @param[in] c The character to copy @p n times + */ + string_ref(size_type n, value_type c) : string(n, c) { } + + /** + * Create a string from a range + * + * @param[in] first The first element to copy in + * @param[in] last The last element to copy in + */ + template <class InputIterator> + string_ref(InputIterator first, InputIterator last) : string(first, last) { } + + /** + * The destructor + */ + ~string_ref() { } + + /** + * Split a string by whitespace + * + * @return A vector of strings, each of which is a substring of the string + */ + vector<string_ref> split(size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (*i == ' ' || *i == '\n' || *i == '\t' || *i == '\r') + { + if (i + 1 != end() && (i[1] == ' ' || i[1] == '\n' || i[1] == '\t' || i[1] == '\r')) + continue; + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Split a string by a character + * + * Returns a vector of ext_strings, each of which is a substring of the string formed by splitting + * it on boundaries formed by the character @p separator. If @p limit is set, the returned vector + * will contain a maximum of @p limit elements with the last element containing the rest of + * the string. + * + * If @p separator is not found in the string, a single element will be returned in the vector + * containing the entire string. + * + * The separators are removed from the output + * + * @param[in] separator The character separator to split the string on + * @param[in] limit The maximum number of output elements + * @return A vector of strings, each of which is a substring of the string + * + * @section split_ex Example + * @code + * std::string_ref s("This|is|a|test."); + * std::vector<std::string_ref> v = s.split('|'); + * std::copy(v.begin(), v.end(), std::ostream_iterator<std::string_ref>(std::cout, "\n")); + * + * This + * is + * a + * test. + * @endcode + */ + vector<string_ref> split(value_type separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (*i == separator) + { + v.push_back(string_ref(last, i)); + last = i + 1; + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Split a string by another string + * + * Returns a vector of ext_strings, each of which is a substring of the string formed by + * splitting it on boundaries formed by the string @p separator. If @p limit is set, the + * returned vector will contain a maximum of @p limit elements with the last element + * containing the rest of the string. + * + * If @p separator is not found in the string, a single element will be returned in the + * vector containing the entire string. + * + * The separators are removed from the output + * + * @param[in] separator The string separator to split the string on + * @param[in] limit The maximum number of output elements + * @return A vector of strings, each of which is a substring of the string + * + * @ref split_ex + */ + vector<string_ref> split(const string &separator, size_type limit = npos) const + { + vector<string_ref> v; + + const_iterator + i = begin(), + last = i; + for (; i != end(); i++) + { + if (string(i, i + separator.length()) == separator) + { + v.push_back(string_ref(last, i)); + last = i + separator.length(); + + if (v.size() >= limit - 1) + { + v.push_back(string_ref(last, end())); + return v; + } + } + } + + if (last != i) + v.push_back(string_ref(last, i)); + + return v; + } + + /** + * Convert a string into an integer + * + * Convert the initial portion of a string into a signed integer. Once a non-numeric + * character is reached, the remainder of @p string is ignored and the integer that was + * read returned. + * + * @param s The string to convert + * @return The integer converted from @p string + */ + static long int integer(const string &s) + { + long int retval = 0; + bool neg = false; + + for (const_iterator i = s.begin(); i != s.end(); i++) + { + if (i == s.begin()) + { + if (*i == '-') + { + neg = true; + continue; + } + else if (*i == '+') + continue; + } + if (*i >= '0' && *i <= '9') + { + retval *= 10; + retval += *i - '0'; + } + else + break; + } + + if (neg) + retval *= -1; + + return retval; + } + + /** + * Convert the string to an integer + * + * Convert the initial portion of the string into a signed integer. Once a non-numeric + * character is reached, the remainder of the string is ignored and the integer that had + * been read thus far is returned. + * + * @return The integer converted from the string + */ + long int integer() const + { + return integer(*this); + } + + /** + * Split a string into chunks of size @p chunklen. Returns a vector of strings. + * + * Splits a string into chunks of the given size. The final chunk may not fill its + * entire allocated number of characters. + * + * @param[in] chunklen The number of characters per chunk + * @return A vector of strings, each of length <= chunklen + * + * @section chunk_split-ex Example + * @code + * std::string_ref s("abcdefghijk"); + * std::vector<std::string_ref> v = s.chunk_split(3); + * std::copy(v.begin(), v.end(), ostream_iterator<std::string_ref>(cout, " ")); + * + * abc def ghi jk + * @endcode + */ + vector<string_ref> chunk_split(size_type chunklen) const + { + vector<string_ref> retval; + retval.reserve(size() / chunklen + 1); + + size_type count = 0; + const_iterator + i = begin(), + last = i; + for (; i != end(); i++, count++) + { + if (count == chunklen) + { + count = 0; + retval.push_back(string_ref(last, i)); + last = i; + } + } + + if (last != i) + retval.push_back(string_ref(last, i)); + + return retval; + } + + /** + * Join a sequence of strings by some glue to create a new string + * + * Glue is not added to the end of the string. + * + * @pre [first, last) is a valid range + * @pre InputIterator is a model of STL's Input Iterator + * @pre InputIterator must point to a string type (std::string, std::string_ref, char *) + * + * @param[in] glue The glue to join strings with + * @param[in] first The beginning of the range to join + * @param[in] last The end of the range to join + * @return A string constructed of each element of the range connected together with @p glue + * + * @section join_ex Example + * @code + * std::vector<std::string_ref> v; + * v.push_back("This"); + * v.push_back("is"); + * v.push_back("a"); + * v.push_back("test."); + * std::cout << std::string_ref::join("|", v.begin(), v.end()) << std::endl; + * + * This|is|a|test. + * @endcode + */ + template <class InputIterator> + static string_ref join(const string &glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(glue); + } + retval.erase(retval.length() - glue.length()); + + return retval; + } + + /** + * Join a sequence of strings by some glue to create a new string + * + * @copydoc join + * @ref join_ex + */ + template <class InputIterator> + static string_ref join(value_type glue, InputIterator first, InputIterator last) + { + string_ref retval; + + for (; first != last; ++first) + { + retval.append(*first); + retval.append(1, glue); + } + retval.erase(retval.length() - 1); + + return retval; + } + + /** + * Search for any instances of @p needle and replace them with @p s + * + * @param[in] needle The string to replace + * @param[in] s The replacement string + * @return *this + * @post All instances of @p needle in the string are replaced with @p s + * + * @section replace-ex Example + * @code + * std::string_ref s("This is a test."); + * s.replace("is", "ere"); + * std::cout << s << std::endl; + * + * There ere a test. + * @endcode + */ + string_ref &replace(const string &needle, const string &s) + { + size_type + lastpos = 0, + thispos; + + while ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + string_ref &replace_first(const string &needle, const string &s) + { + size_type + lastpos = 0, + thispos; + + if ((thispos = find(needle, lastpos)) != npos) + { + string::replace(thispos, needle.length(), s); + lastpos = thispos + 1; + } + return *this; + } + /** + * Search of any instances of @p needle and replace them with @p c + * + * @param[in] needle The character to replace + * @param[in] c The replacement character + * @return *this + * @post All instances of @p needle in the string are replaced with @p c + * + * @ref replace-ex + */ + string_ref &replace(value_type needle, value_type c) + { + for (iterator i = begin(); i != end(); i++) + if (*i == needle) + *i = c; + + return *this; + } + + /** + * Repeat a string @p n times + * + * @param[in] n The number of times to repeat the string + * @return string_ref containing @p n copies of the string + * + * @section repeat-ex Example + * @code + * std::string_ref s("123"); + * s = s * 3; + * std::cout << s << std::endl; + * + * 123123123 + * @endcode + */ + string_ref operator*(size_type n) + { + string_ref retval; + for (size_type i = 0; i < n; i++) + retval.append(*this); + + return retval; + } + + /** + * Convert the string to lowercase + * + * @return *this + * @post The string is converted to lowercase + */ + string_ref &tolower() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'A' && *i <= 'Z') + *i = (*i) + ('a' - 'A'); + return *this; + } + + /** + * Convert the string to uppercase + * + * @return *this + * @post The string is converted to uppercase + */ + string_ref &toupper() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'a' && *i <= 'z') + *i = (*i) - ('a' - 'A'); + return *this; + } + + /** + * Count the occurances of @p str in the string. + * + * @return The count of substrings @p str in the string + */ + size_type count(const string &str) const + { + size_type + count = 0, + last = 0, + cur = 0; + + while ((cur = find(str, last + 1)) != npos) + { + count++; + last = cur; + } + + return count; + } + + /** + * Determine if the string is alphanumeric + * + * @return true if the string contains only characters between a-z, A-Z and 0-9 and + * contains at least one character, else false + */ + bool is_alnum() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + { + if (*i < 'A' || *i > 'Z') + if (*i < '0' || *i > '9') + if (*i < 'a' || *i > 'z') + return false; + } + + return true; + } + + /** + * Determine if the string is alphabetic only + * + * @return true of the string contains only characters between a-z and A-Z and contains at + * least one character, else false + */ + bool is_alpha() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'A' || (*i > 'Z' && (*i < 'a' || *i > 'z'))) + return false; + + return true; + } + + /** + * Determine if the string is numeric only + * + * @return true if the string contains only characters between 0-9 and contains at least + * one character, else false + */ + bool is_numeric() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < '0' || *i > '9') + return false; + + return true; + } + + /** + * Determine if a string is all lower case + * + * @return true if there is at least one character, and all characters are lowercase + * letters, else false + */ + bool is_lower() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'a' || *i < 'z') + return false; + + return true; + } + + /** + * Determine if a string is all upper case + * + * @return true if there is at least one character, and all characters are uppercase + * letters, else false + */ + bool is_upper() const + { + if (length() == 0) + return false; + + for (const_iterator i = begin(); i != end(); i++) + if (*i < 'A' || *i > 'Z') + return false; + + return true; + } + + /** + * Swap the case of a string + * + * @post Converts all uppercase to lowercase, and all lowercase to uppercase in the string + * @return *this + */ + string_ref &swapcase() + { + for (iterator i = begin(); i != end(); i++) + if (*i >= 'A' && *i <= 'Z') + *i += ('a' - 'A'); + else if (*i >= 'a' && *i <= 'z') + *i -= ('a' - 'A'); + + return *this; + } + + /******************************************************************************* + Function: std::string_ref::start_with + Access: public + Qualifier: const + Parameter: const string & str + Returns: bool + + Purpose: is the string start with str + *******************************************************************************/ + bool start_with(const string& str) const + { + return ( this->find(str) == 0 ); + } + + /// Return a string_ref equal to 'this' but with only the last \p N + /// elements remaining. If \p N is greater than the length of the + /// string, the entire string is returned. + + string_ref take_back(size_t N = 1) const { + if (N >= size()) + return *this; + return drop_front(size() - N); + } + /// Return a string_ref equal to 'this' but with the first \p N elements + /// dropped. + + string_ref drop_front(size_t N = 1) const { + //assert(size() >= N && "Dropping more elements than exist"); + return substr(N); + } + + + + /// Return a string_ref equal to 'this' but with the last \p N elements + /// dropped. + + string_ref drop_back(size_t N = 1) const { + + return substr(0, size() - N); + } + + /// Return a string_ref equal to 'this', but with all characters satisfying + /// the given predicate dropped from the beginning of the string. + + string_ref drop_while(std::function<bool(char)> F) const { + return substr(std::find_if_not(begin(),end(),F)-begin()); + } + + /// Return a string_ref equal to 'this', but with all characters not + /// satisfying the given predicate dropped from the beginning of the string. + + string_ref drop_until(std::function<bool(char)> F) const { + return substr(std::find_if(begin(), end(), F) - begin()); + } + + /// Returns true if this string_ref has the given prefix and removes that + /// prefix. + bool consume_front(string_ref Prefix) { + if (!start_with(Prefix)) + return false; + + *this = drop_front(Prefix.size()); + return true; + } + + /// Returns true if this string_ref has the given suffix and removes that + /// suffix. + bool consume_back(string_ref Suffix) { + if (!end_with(Suffix)) + return false; + + *this = drop_back(Suffix.size()); + return true; + } + + /******************************************************************************* + Function: std::string_ref::end_with + Access: public + Qualifier: const + Parameter: const string & str + Returns: bool + + Purpose: is the string end with str + *******************************************************************************/ + bool end_with(const string& str) const + { + if (str.length() > this->length()) + { + return false; + } + size_type off = this->length() - str.length(); + return ( find(str, off) == off); + } + + /******************************************************************************* + Function: hl_lib::string_ref::format + Access: public + Qualifier: + Parameter: const char * format_string + Parameter: ... + Returns: string_ref& + + Purpose: format the string + *******************************************************************************/ + string_ref& format(const char* format_string, ...) + { if (format_string == 0) { return *this; @@ -912,150 +912,150 @@ namespace std #endif va_end( argList ); return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim_left - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the left of the string - *******************************************************************************/ - string_ref& trim_left(value_type ch = ' ') - { - size_type off = this->find_first_not_of(ch); - if (off != string::npos) - { - this->erase(0, off); - } - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim_right - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the right of the string - *******************************************************************************/ - string_ref& trim_right(value_type ch = ' ') - { - size_type off = this->find_last_not_of(ch); - if (off == string::npos) - { - off = 0; - } - else - { - off++; - } - this->erase(off, length() - off); - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::trim - Access: public - Qualifier: - Parameter: value_type ch - Returns: string_ref& - - Purpose: delete all char which is ch at the left and right of the string - *******************************************************************************/ - string_ref& trim(value_type ch = ' ') - { - trim_left(ch); - trim_right(ch); - return *this; - } - - /******************************************************************************* - Function: hl_lib::string_ref::float_num - Access: public static - Qualifier: - Parameter: const string & str - Returns: double - - Purpose: parse str to a float number - *******************************************************************************/ - static double float_num(const string& str) - { - return atof(str.c_str()); - } - - /******************************************************************************* - Function: hl_lib::string_ref::float_num - Access: public static - Qualifier: - Returns: double - - Purpose: parse this to a float number - *******************************************************************************/ - double float_num() const - { - return float_num(*this); - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: const string & str - Returns: int - - Purpose: compare string no case - *******************************************************************************/ - int compare_nocase(const string& str) const - { + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim_left + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the left of the string + *******************************************************************************/ + string_ref& trim_left(value_type ch = ' ') + { + size_type off = this->find_first_not_of(ch); + if (off != string::npos) + { + this->erase(0, off); + } + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim_right + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the right of the string + *******************************************************************************/ + string_ref& trim_right(value_type ch = ' ') + { + size_type off = this->find_last_not_of(ch); + if (off == string::npos) + { + off = 0; + } + else + { + off++; + } + this->erase(off, length() - off); + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::trim + Access: public + Qualifier: + Parameter: value_type ch + Returns: string_ref& + + Purpose: delete all char which is ch at the left and right of the string + *******************************************************************************/ + string_ref& trim(value_type ch = ' ') + { + trim_left(ch); + trim_right(ch); + return *this; + } + + /******************************************************************************* + Function: hl_lib::string_ref::float_num + Access: public static + Qualifier: + Parameter: const string & str + Returns: double + + Purpose: parse str to a float number + *******************************************************************************/ + static double float_num(const string& str) + { + return atof(str.c_str()); + } + + /******************************************************************************* + Function: hl_lib::string_ref::float_num + Access: public static + Qualifier: + Returns: double + + Purpose: parse this to a float number + *******************************************************************************/ + double float_num() const + { + return float_num(*this); + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: const string & str + Returns: int + + Purpose: compare string no case + *******************************************************************************/ + int compare_nocase(const string& str) const + { #ifdef _WIN32 - return _stricmp(this->c_str(), str.c_str()); + return _stricmp(this->c_str(), str.c_str()); #else - return strcasecmp(this->c_str(), str.c_str()); + return strcasecmp(this->c_str(), str.c_str()); #endif - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: size_type index - Parameter: size_type length - Parameter: const string & str - Returns: int - - Purpose: compare substring no case - *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str ) const - { - string_ref temp = this->substr(index, length); - return temp.compare_nocase(str); - } - - /******************************************************************************* - Function: hl_lib::string_ref::compare_nocase - Access: public - Qualifier: const - Parameter: size_type index - Parameter: size_type length - Parameter: const string & str - Parameter: size_type index2 - Parameter: size_type length2 - Returns: int - - Purpose: compare two substring no case - *******************************************************************************/ - int compare_nocase( size_type index, size_type length, const string &str, size_type index2, size_type length2) const - { - string_ref temp1 = this->substr(index, length); - string_ref temp2 = str.substr(index2, length2); - return temp1.compare_nocase(temp2); - } - - }; + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: size_type index + Parameter: size_type length + Parameter: const string & str + Returns: int + + Purpose: compare substring no case + *******************************************************************************/ + int compare_nocase( size_type index, size_type length, const string &str ) const + { + string_ref temp = this->substr(index, length); + return temp.compare_nocase(str); + } + + /******************************************************************************* + Function: hl_lib::string_ref::compare_nocase + Access: public + Qualifier: const + Parameter: size_type index + Parameter: size_type length + Parameter: const string & str + Parameter: size_type index2 + Parameter: size_type length2 + Returns: int + + Purpose: compare two substring no case + *******************************************************************************/ + int compare_nocase( size_type index, size_type length, const string &str, size_type index2, size_type length2) const + { + string_ref temp1 = this->substr(index, length); + string_ref temp2 = str.substr(index2, length2); + return temp1.compare_nocase(temp2); + } + + }; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h index fa84e4109a5..6d082d2d2aa 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ParentProcessWatcher.h @@ -6,12 +6,12 @@ class ParentProcessWatcher { public: - struct ParentProcessWatcherData; + struct ParentProcessWatcherData; - ParentProcessWatcher(lsp::Log& log, int pid, const std::function<void()>&& callback, uint32_t poll_delay_secs = 10); + ParentProcessWatcher(lsp::Log& log, int pid, const std::function<void()>&& callback, uint32_t poll_delay_secs = 10); - ~ParentProcessWatcher(); + ~ParentProcessWatcher(); - std::shared_ptr<ParentProcessWatcherData> d_ptr; + std::shared_ptr<ParentProcessWatcherData> d_ptr; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h index 1389a1d5b7d..5edecef0b26 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProcessIoService.h @@ -4,45 +4,45 @@ namespace lsp { - class ProcessIoService - { - public: - using IOService = boost::asio::io_service; - using Work = boost::asio::io_service::work; - using WorkPtr = std::unique_ptr<Work>; + class ProcessIoService + { + public: + using IOService = boost::asio::io_service; + using Work = boost::asio::io_service::work; + using WorkPtr = std::unique_ptr<Work>; - ProcessIoService() { + ProcessIoService() { - work_ = std::unique_ptr<Work>(new Work(ioService_)); - auto temp_thread_ = new std::thread([this] - { - ioService_.run(); - }); - thread_ = std::unique_ptr<std::thread>(temp_thread_); - } + work_ = std::unique_ptr<Work>(new Work(ioService_)); + auto temp_thread_ = new std::thread([this] + { + ioService_.run(); + }); + thread_ = std::unique_ptr<std::thread>(temp_thread_); + } - ProcessIoService(const ProcessIoService&) = delete; - ProcessIoService& operator=(const ProcessIoService&) = delete; + ProcessIoService(const ProcessIoService&) = delete; + ProcessIoService& operator=(const ProcessIoService&) = delete; - boost::asio::io_service& getIOService() - { - return ioService_; - } + boost::asio::io_service& getIOService() + { + return ioService_; + } - void stop() - { + void stop() + { - work_.reset(); + work_.reset(); - thread_->join(); + thread_->join(); - } + } - private: - IOService ioService_; - WorkPtr work_; - std::unique_ptr<std::thread> thread_; + private: + IOService ioService_; + WorkPtr work_; + std::unique_ptr<std::thread> thread_; - }; + }; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h index b563f810d2a..f6097fe1729 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ProtocolJsonHandler.h @@ -2,10 +2,10 @@ #include "LibLsp/JsonRpc/MessageJsonHandler.h" namespace lsp { - class ProtocolJsonHandler : public MessageJsonHandler - { - public: - ProtocolJsonHandler(); - }; + class ProtocolJsonHandler : public MessageJsonHandler + { + public: + ProtocolJsonHandler(); + }; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h index caf2ea5d5fd..ea602059005 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/ResourceOperation.h @@ -6,116 +6,116 @@ #include "LibLsp/lsp/lsAny.h" #include "LibLsp/lsp/lsTextEdit.h" struct ResourceOperation { - std::string kind; - virtual ~ResourceOperation() = default; - - MAKE_SWAP_METHOD(ResourceOperation, kind); + std::string kind; + virtual ~ResourceOperation() = default; + + MAKE_SWAP_METHOD(ResourceOperation, kind); }; MAKE_REFLECT_STRUCT(ResourceOperation, kind); extern void Reflect(Writer& visitor, ResourceOperation* value); struct CreateFileOptions{ - /** - * Overwrite existing file. Overwrite wins over `ignoreIfExists` - */ - boost::optional<bool> overwrite = false; - - /** - * Ignore if exists. - */ - boost::optional< bool> ignoreIfExists =false; - - MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) + /** + * Overwrite existing file. Overwrite wins over `ignoreIfExists` + */ + boost::optional<bool> overwrite = false; + + /** + * Ignore if exists. + */ + boost::optional< bool> ignoreIfExists =false; + + MAKE_SWAP_METHOD(CreateFileOptions, overwrite, ignoreIfExists) }; MAKE_REFLECT_STRUCT(CreateFileOptions, overwrite, ignoreIfExists) struct lsCreateFile :public ResourceOperation { - /** - * The resource to create. - */ - lsCreateFile(); - lsDocumentUri uri; - - /** - * Additional options - */ - boost::optional<CreateFileOptions> options; - - - /** - * An optional annotation identifer describing the operation. - * - * @since 3.16.0 - */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - - MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) + /** + * The resource to create. + */ + lsCreateFile(); + lsDocumentUri uri; + + /** + * Additional options + */ + boost::optional<CreateFileOptions> options; + + + /** + * An optional annotation identifer describing the operation. + * + * @since 3.16.0 + */ + boost::optional<lsChangeAnnotationIdentifier> annotationId; + + MAKE_SWAP_METHOD(lsCreateFile, kind, uri, options, annotationId) }; MAKE_REFLECT_STRUCT(lsCreateFile, kind, uri,options, annotationId) struct DeleteFileOptions { - /** - * Delete the content recursively if a folder is denoted. - */ - boost::optional<bool> recursive = false; + /** + * Delete the content recursively if a folder is denoted. + */ + boost::optional<bool> recursive = false; - /** - * Ignore the operation if the file doesn't exist. - */ - boost::optional<bool> ignoreIfNotExists = false; + /** + * Ignore the operation if the file doesn't exist. + */ + boost::optional<bool> ignoreIfNotExists = false; - MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); + MAKE_SWAP_METHOD(DeleteFileOptions, recursive, ignoreIfNotExists); }; MAKE_REFLECT_STRUCT(DeleteFileOptions, recursive, ignoreIfNotExists) struct lsDeleteFile :public ResourceOperation { - /** - * The file to delete. - */ - lsDeleteFile(); - lsDocumentUri uri; - - /** - * Delete options. - */ - boost::optional<DeleteFileOptions> options; - - MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); + /** + * The file to delete. + */ + lsDeleteFile(); + lsDocumentUri uri; + + /** + * Delete options. + */ + boost::optional<DeleteFileOptions> options; + + MAKE_SWAP_METHOD(lsDeleteFile, kind, uri, options); }; MAKE_REFLECT_STRUCT(lsDeleteFile, kind, uri,options); typedef CreateFileOptions RenameFileOptions; struct lsRenameFile :public ResourceOperation { - /** - * The old (existing) location. - */ - lsRenameFile(); - lsDocumentUri oldUri; - - /** - * The new location. - */ - - lsDocumentUri newUri; - - /** - * Rename options. - */ - boost::optional<RenameFileOptions> options; - - /** - * An optional annotation identifer describing the operation. - * - * @since 3.16.0 - */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - - MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) + /** + * The old (existing) location. + */ + lsRenameFile(); + lsDocumentUri oldUri; + + /** + * The new location. + */ + + lsDocumentUri newUri; + + /** + * Rename options. + */ + boost::optional<RenameFileOptions> options; + + /** + * An optional annotation identifer describing the operation. + * + * @since 3.16.0 + */ + boost::optional<lsChangeAnnotationIdentifier> annotationId; + + MAKE_SWAP_METHOD(lsRenameFile, kind, oldUri, newUri, options, annotationId) }; MAKE_REFLECT_STRUCT(lsRenameFile, kind, oldUri, newUri, options, annotationId); -extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny);
\ No newline at end of file +extern ResourceOperation* GetResourceOperation(lsp::Any& lspAny); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h index 0a2707979da..3178d25d69c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/SimpleTimer.h @@ -9,7 +9,7 @@ class SimpleTimer { public: SimpleTimer(unsigned int duration,const std::function<void()>& _call_back) - :is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) + :is_running_(true), call_back(_call_back), _deadline_timer(_ios, Duration(duration)) { _deadline_timer.async_wait([&](const boost::system::error_code& e) { diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h index fa5d1114037..60484db56a0 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/registerCapability.h @@ -7,20 +7,20 @@ */ struct Registration { - static Registration Create(const std::string& method); - /** - * The id used to register the request. The id can be used to deregister - * the request again. - */ - std::string id; - - /** - * The method / capability to register for. - */ - - std::string method; - - MAKE_SWAP_METHOD(Registration, id, method); + static Registration Create(const std::string& method); + /** + * The id used to register the request. The id can be used to deregister + * the request again. + */ + std::string id; + + /** + * The method / capability to register for. + */ + + std::string method; + + MAKE_SWAP_METHOD(Registration, id, method); }; @@ -35,8 +35,8 @@ MAKE_REFLECT_STRUCT(Registration, id, method); */ struct RegistrationParams { - std::vector<Registration> registrations; - MAKE_SWAP_METHOD(RegistrationParams, registrations); + std::vector<Registration> registrations; + MAKE_SWAP_METHOD(RegistrationParams, registrations); }; /** * The client/registerCapability request is sent from the server to the client @@ -46,4 +46,4 @@ struct RegistrationParams */ MAKE_REFLECT_STRUCT(RegistrationParams, registrations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams,JsonNull, "client/registerCapability");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientRegisterCapability, RegistrationParams,JsonNull, "client/registerCapability"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h index aa51d7efeee..33bf9d1db61 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/client/unregisterCapability.h @@ -10,20 +10,20 @@ */ struct Unregistration { - /** - * The id used to unregister the request or notification. Usually an id - * provided during the register request. - */ + /** + * The id used to unregister the request or notification. Usually an id + * provided during the register request. + */ - std::string id; + std::string id; - /** - * The method / capability to unregister for. - */ + /** + * The method / capability to unregister for. + */ - std::string method; - - MAKE_SWAP_METHOD(Unregistration, id, method); + std::string method; + + MAKE_SWAP_METHOD(Unregistration, id, method); }; MAKE_REFLECT_STRUCT(Unregistration, id, method); /** @@ -32,10 +32,10 @@ MAKE_REFLECT_STRUCT(Unregistration, id, method); */ struct UnregistrationParams { - std::vector<Unregistration> unregisterations; - MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); + std::vector<Unregistration> unregisterations; + MAKE_SWAP_METHOD(UnregistrationParams, unregisterations); }; MAKE_REFLECT_STRUCT(UnregistrationParams, unregisterations); -DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientUnregisterCapability, UnregistrationParams,JsonNull, "client/unregisterCapability");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(Req_ClientUnregisterCapability, UnregistrationParams,JsonNull, "client/unregisterCapability"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h index cfb17fdf34d..dd0ada60cc7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/OverridableMethod.h @@ -4,31 +4,31 @@ #include <string> struct OverridableMethod { - std::string bindingKey; - std::string name; - std::vector<std::string> parameters; - bool unimplemented = false; - std::string declaringClass; - std::string declaringClassType; + std::string bindingKey; + std::string name; + std::vector<std::string> parameters; + bool unimplemented = false; + std::string declaringClass; + std::string declaringClassType; - void swap(OverridableMethod& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - parameters.swap(arg.parameters); - declaringClass.swap(arg.declaringClass); - declaringClassType.swap(arg.declaringClassType); - std::swap(unimplemented, arg.unimplemented); - } + void swap(OverridableMethod& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + parameters.swap(arg.parameters); + declaringClass.swap(arg.declaringClass); + declaringClassType.swap(arg.declaringClassType); + std::swap(unimplemented, arg.unimplemented); + } }; MAKE_REFLECT_STRUCT(OverridableMethod, bindingKey, name, parameters, unimplemented, declaringClass, declaringClassType); struct OverridableMethodsResponse { - std::string type; - std::vector<OverridableMethod> methods; + std::string type; + std::vector<OverridableMethod> methods; - MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) + MAKE_SWAP_METHOD(OverridableMethodsResponse, type, methods) }; MAKE_REFLECT_STRUCT(OverridableMethodsResponse, type, methods) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h index c7faa94d6c9..c8ddbe3c013 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/WorkspaceSymbolParams.h @@ -6,8 +6,8 @@ struct WorkspaceSymbolParams { - std::string query; - MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); + std::string query; + MAKE_SWAP_METHOD(WorkspaceSymbolParams, query); }; MAKE_REFLECT_STRUCT(WorkspaceSymbolParams, query); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h index 5da14a452a7..527b3b1827a 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/addOverridableMethods.h @@ -6,10 +6,10 @@ #include "LibLsp/JsonRpc/RequestInMessage.h" #include "LibLsp/JsonRpc/lsResponseMessage.h" struct AddOverridableMethodParams { - lsCodeActionParams context; - std::vector<OverridableMethod> overridableMethods; + lsCodeActionParams context; + std::vector<OverridableMethod> overridableMethods; - MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); + MAKE_SWAP_METHOD(AddOverridableMethodParams, context, overridableMethods); }; MAKE_REFLECT_STRUCT(AddOverridableMethodParams, context, overridableMethods); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h index a2c2c062ccf..4809e360bbc 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/buildWorkspace.h @@ -10,8 +10,8 @@ enum class BuildWorkspaceStatus : uint8_t{ - FAILED, SUCCEED, WITH_ERROR, CANCELLED, + FAILED, SUCCEED, WITH_ERROR, CANCELLED, }; MAKE_REFLECT_TYPE_PROXY(BuildWorkspaceStatus) -DEFINE_REQUEST_RESPONSE_TYPE(java_buildWorkspace, bool, BuildWorkspaceStatus, "java/buildWorkspace");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(java_buildWorkspace, bool, BuildWorkspaceStatus, "java/buildWorkspace"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h index 261a0cc5516..acb1e4caa61 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkConstructorsStatus.h @@ -6,19 +6,19 @@ #include "checkHashCodeEqualsStatus.h" struct LspMethodBinding { - std::string bindingKey; - std::string name; - std::vector< std::string> parameters; + std::string bindingKey; + std::string name; + std::vector< std::string> parameters; - MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); + MAKE_SWAP_METHOD(LspMethodBinding, bindingKey, name, parameters); }; MAKE_REFLECT_STRUCT(LspMethodBinding, bindingKey, name, parameters); struct CheckConstructorsResponse { - std::vector<LspMethodBinding> constructors; - std::vector<LspVariableBinding> fields; - MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) + std::vector<LspMethodBinding> constructors; + std::vector<LspVariableBinding> fields; + MAKE_SWAP_METHOD(CheckConstructorsResponse, constructors, fields) }; MAKE_REFLECT_STRUCT(CheckConstructorsResponse, constructors,fields) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h index 729639eafa5..68a7ed6606c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkDelegateMethodsStatus.h @@ -8,22 +8,22 @@ #include "checkConstructorsStatus.h" struct LspDelegateField { - LspVariableBinding field; - std::vector<LspMethodBinding> delegateMethods; + LspVariableBinding field; + std::vector<LspMethodBinding> delegateMethods; - MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); + MAKE_SWAP_METHOD(LspDelegateField, field, delegateMethods); }; MAKE_REFLECT_STRUCT(LspDelegateField, field, delegateMethods); struct CheckDelegateMethodsResponse { - std::vector<LspDelegateField> delegateFields; + std::vector<LspDelegateField> delegateFields; - MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) + MAKE_SWAP_METHOD(CheckDelegateMethodsResponse, delegateFields) }; MAKE_REFLECT_STRUCT(CheckDelegateMethodsResponse, delegateFields) DEFINE_REQUEST_RESPONSE_TYPE(java_checkDelegateMethodsStatus, - lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus"); + lsCodeActionParams, CheckDelegateMethodsResponse, "java/checkDelegateMethodsStatus"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h index 1d9652dd442..88731c29b58 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkHashCodeEqualsStatus.h @@ -8,29 +8,29 @@ #include "LibLsp/lsp/CodeActionParams.h" struct LspVariableBinding { - std::string bindingKey; - std::string name; - std::string type; - bool isField; - void swap(LspVariableBinding& arg) noexcept - { - bindingKey.swap(arg.bindingKey); - name.swap(arg.name); - type.swap(arg.type); - std::swap(isField, arg.isField); - } + std::string bindingKey; + std::string name; + std::string type; + bool isField; + void swap(LspVariableBinding& arg) noexcept + { + bindingKey.swap(arg.bindingKey); + name.swap(arg.name); + type.swap(arg.type); + std::swap(isField, arg.isField); + } }; MAKE_REFLECT_STRUCT(LspVariableBinding, bindingKey, name, type, isField) struct CheckHashCodeEqualsResponse { - std::string type; - std::vector<LspVariableBinding> fields; - std::vector<std::string> existingMethods; - MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) + std::string type; + std::vector<LspVariableBinding> fields; + std::vector<std::string> existingMethods; + MAKE_SWAP_METHOD(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) }; MAKE_REFLECT_STRUCT(CheckHashCodeEqualsResponse, type, fields, type, existingMethods) DEFINE_REQUEST_RESPONSE_TYPE(java_checkHashCodeEqualsStatus, - lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus") + lsCodeActionParams, CheckHashCodeEqualsResponse, "java/checkHashCodeEqualsStatus") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h index 24580d94c07..cadb5ba7dd0 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/checkToStringStatus.h @@ -6,19 +6,19 @@ #include "LibLsp/lsp/CodeActionParams.h" #include "checkHashCodeEqualsStatus.h" struct CheckToStringResponse { - std::string type; - std::vector<LspVariableBinding> fields; - bool exists; - void swap(CheckToStringResponse& arg) noexcept - { - type.swap(arg.type); - fields.swap(arg.fields); - std::swap(exists, arg.exists); - } + std::string type; + std::vector<LspVariableBinding> fields; + bool exists; + void swap(CheckToStringResponse& arg) noexcept + { + type.swap(arg.type); + fields.swap(arg.fields); + std::swap(exists, arg.exists); + } }; MAKE_REFLECT_STRUCT(CheckToStringResponse,type,fields,exists) DEFINE_REQUEST_RESPONSE_TYPE(java_checkToStringStatus, - lsCodeActionParams, CheckToStringResponse ,"java/checkToStringStatus") + lsCodeActionParams, CheckToStringResponse ,"java/checkToStringStatus") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h index 02024e3d931..c0195908d03 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/codeActionResult.h @@ -9,14 +9,14 @@ namespace SourceAssistProcessor { - /*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" - };*/ + /*std::set<std::string> UNSUPPORTED_RESOURCES = { "module-info.java", "package-info.java" + };*/ -// static const char* COMMAND_ID_ACTION_OVERRIDEMETHODSPROMPT = "java.action.overrideMethodsPrompt"; -// static const char* COMMAND_ID_ACTION_HASHCODEEQUALSPROMPT = "java.action.hashCodeEqualsPrompt"; -// static const char* COMMAND_ID_ACTION_ORGANIZEIMPORTS = "java.action.organizeImports"; -// static const char* COMMAND_ID_ACTION_GENERATETOSTRINGPROMPT = "java.action.generateToStringPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATEACCESSORSPROMPT = "java.action.generateAccessorsPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT = "java.action.generateConstructorsPrompt"; -// static const char* COMMAND_ID_ACTION_GENERATEDELEGATEMETHODSPROMPT = "java.action.generateDelegateMethodsPrompt"; +// static const char* COMMAND_ID_ACTION_OVERRIDEMETHODSPROMPT = "java.action.overrideMethodsPrompt"; +// static const char* COMMAND_ID_ACTION_HASHCODEEQUALSPROMPT = "java.action.hashCodeEqualsPrompt"; +// static const char* COMMAND_ID_ACTION_ORGANIZEIMPORTS = "java.action.organizeImports"; +// static const char* COMMAND_ID_ACTION_GENERATETOSTRINGPROMPT = "java.action.generateToStringPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATEACCESSORSPROMPT = "java.action.generateAccessorsPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATECONSTRUCTORSPROMPT = "java.action.generateConstructorsPrompt"; +// static const char* COMMAND_ID_ACTION_GENERATEDELEGATEMETHODSPROMPT = "java.action.generateDelegateMethodsPrompt"; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h index 92d4a3627bf..19479adfaff 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/executeCommand.h @@ -6,20 +6,20 @@ #include "LibLsp/lsp/ExecuteCommandParams.h" namespace buildpath { -// static const char* EDIT_ORGNIZEIMPORTS = "java.edit.organizeImports"; -// static const char* RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; +// static const char* EDIT_ORGNIZEIMPORTS = "java.edit.organizeImports"; +// static const char* RESOLVE_SOURCE_ATTACHMENT = "java.project.resolveSourceAttachment"; -// static const char* UPDATE_SOURCE_ATTACHMENT = "java.project.updateSourceAttachment"; +// static const char* UPDATE_SOURCE_ATTACHMENT = "java.project.updateSourceAttachment"; -// static const char* ADD_TO_SOURCEPATH = "java.project.addToSourcePath"; +// static const char* ADD_TO_SOURCEPATH = "java.project.addToSourcePath"; -// static const char* REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; +// static const char* REMOVE_FROM_SOURCEPATH = "java.project.removeFromSourcePath"; -// static const char* LIST_SOURCEPATHS = "java.project.listSourcePaths"; - struct Result { - bool status; - std::string message; - }; +// static const char* LIST_SOURCEPATHS = "java.project.listSourcePaths"; + struct Result { + bool status; + std::string message; + }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h index d184c675d83..fd470b17c88 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/findLinks.h @@ -8,11 +8,11 @@ #include "LibLsp/lsp/lsTextDocumentPositionParams.h" struct FindLinksParams { - // Supported link types: superImplementation - std::string type; - lsTextDocumentPositionParams position; - - MAKE_SWAP_METHOD(FindLinksParams, type, position) + // Supported link types: superImplementation + std::string type; + lsTextDocumentPositionParams position; + + MAKE_SWAP_METHOD(FindLinksParams, type, position) }; MAKE_REFLECT_STRUCT(FindLinksParams,type,position) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h index 200d840e940..82013096c70 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateAccessors.h @@ -8,11 +8,11 @@ struct GenerateAccessorsParams { - lsCodeActionParams context; - std::vector<AccessorField> accessors; + lsCodeActionParams context; + std::vector<AccessorField> accessors; - MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) + MAKE_SWAP_METHOD(GenerateAccessorsParams, context, accessors) }; MAKE_REFLECT_STRUCT(GenerateAccessorsParams, context, accessors) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h index 77c49a66a29..157fefed795 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateConstructors.h @@ -8,10 +8,10 @@ struct GenerateConstructorsParams { - lsCodeActionParams context; - std::vector<LspMethodBinding> constructors; - std::vector< LspVariableBinding >fields; - MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) + lsCodeActionParams context; + std::vector<LspMethodBinding> constructors; + std::vector< LspVariableBinding >fields; + MAKE_SWAP_METHOD(GenerateConstructorsParams, context, fields) }; MAKE_REFLECT_STRUCT(GenerateConstructorsParams, context, fields) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h index 8958ae4d7ed..c6b47293784 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateDelegateMethods.h @@ -7,17 +7,17 @@ #include "checkConstructorsStatus.h" struct LspDelegateEntry { - LspVariableBinding field; - LspMethodBinding delegateMethod; - MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); + LspVariableBinding field; + LspMethodBinding delegateMethod; + MAKE_SWAP_METHOD(LspDelegateEntry, field, delegateMethod); }; MAKE_REFLECT_STRUCT(LspDelegateEntry, field, delegateMethod); struct GenerateDelegateMethodsParams { - lsCodeActionParams context; - std::vector<LspDelegateEntry> delegateEntries; - MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) + lsCodeActionParams context; + std::vector<LspDelegateEntry> delegateEntries; + MAKE_SWAP_METHOD(GenerateDelegateMethodsParams, context, delegateEntries) }; MAKE_REFLECT_STRUCT(GenerateDelegateMethodsParams, context, delegateEntries) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h index 937c3587338..0881d305b18 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateHashCodeEquals.h @@ -8,15 +8,15 @@ #include "checkHashCodeEqualsStatus.h" struct GenerateHashCodeEqualsParams { - lsCodeActionParams context; - std::vector<LspVariableBinding> fields; - bool regenerate= false; - void swap(GenerateHashCodeEqualsParams& arg) noexcept - { - context.swap(arg.context); - fields.swap(arg.fields); - std::swap(regenerate, arg.regenerate); - } + lsCodeActionParams context; + std::vector<LspVariableBinding> fields; + bool regenerate= false; + void swap(GenerateHashCodeEqualsParams& arg) noexcept + { + context.swap(arg.context); + fields.swap(arg.fields); + std::swap(regenerate, arg.regenerate); + } }; MAKE_REFLECT_STRUCT(GenerateHashCodeEqualsParams, context, fields, regenerate); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h index 1f8ccc73b87..5e5324a59bd 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/generateToString.h @@ -7,11 +7,11 @@ struct GenerateToStringParams { - lsCodeActionParams context; - std::vector< LspVariableBinding >fields; - - MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) - + lsCodeActionParams context; + std::vector< LspVariableBinding >fields; + + MAKE_SWAP_METHOD(GenerateToStringParams, context, fields) + }; MAKE_REFLECT_STRUCT(GenerateToStringParams, context, fields) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h index bcbf6f8c2ba..56f09a0a537 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getMoveDestinations.h @@ -8,54 +8,54 @@ struct MoveKindInfo { - static std::string moveResource() - { - return "moveResource"; - } - static std::string moveInstanceMethod() - { - return "moveInstanceMethod"; - } - static std::string moveStaticMember() - { - return "moveStaticMember"; - } + static std::string moveResource() + { + return "moveResource"; + } + static std::string moveInstanceMethod() + { + return "moveInstanceMethod"; + } + static std::string moveStaticMember() + { + return "moveStaticMember"; + } }; struct MoveParams { - /** - * The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, - * moveTypeToNewFile. - */ - std::string moveKind; - /** - * The selected resource uris when the move operation is triggered. - */ - std::vector<std::string> sourceUris; - /** - * The code action params when the move operation is triggered. - */ - boost::optional<lsCodeActionParams> params; - /** - * The possible destination: a folder/package, class, instanceDeclaration. - */ - lsp::Any destination; - bool updateReferences; - void swap(MoveParams& arg) noexcept - { - moveKind.swap(arg.moveKind); - sourceUris.swap(arg.sourceUris); - params.swap(arg.params); - destination.swap(arg.destination); - std::swap(updateReferences, arg.updateReferences); - } + /** + * The supported move kind: moveResource, moveInstanceMethod, moveStaticMember, + * moveTypeToNewFile. + */ + std::string moveKind; + /** + * The selected resource uris when the move operation is triggered. + */ + std::vector<std::string> sourceUris; + /** + * The code action params when the move operation is triggered. + */ + boost::optional<lsCodeActionParams> params; + /** + * The possible destination: a folder/package, class, instanceDeclaration. + */ + lsp::Any destination; + bool updateReferences; + void swap(MoveParams& arg) noexcept + { + moveKind.swap(arg.moveKind); + sourceUris.swap(arg.sourceUris); + params.swap(arg.params); + destination.swap(arg.destination); + std::swap(updateReferences, arg.updateReferences); + } }; MAKE_REFLECT_STRUCT(MoveParams, moveKind, sourceUris, params, destination, updateReferences); struct MoveDestinationsResponse { - std::string errorMessage; - std::vector<lsp::Any > destinations; - MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); + std::string errorMessage; + std::vector<lsp::Any > destinations; + MAKE_SWAP_METHOD(MoveDestinationsResponse, errorMessage, destinations); }; MAKE_REFLECT_STRUCT(MoveDestinationsResponse, errorMessage, destinations); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h index e46327075a5..131612dc2e3 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/getRefactorEdit.h @@ -15,40 +15,40 @@ namespace RefactorProposalUtility { - extern const char* APPLY_REFACTORING_COMMAND_ID; - extern const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; - extern const char* EXTRACT_VARIABLE_COMMAND; - extern const char* EXTRACT_CONSTANT_COMMAND; - extern const char* EXTRACT_METHOD_COMMAND; - extern const char* EXTRACT_FIELD_COMMAND; - extern const char* CONVERT_VARIABLE_TO_FIELD_COMMAND; - extern const char* MOVE_FILE_COMMAND; - extern const char* MOVE_INSTANCE_METHOD_COMMAND; - extern const char* MOVE_STATIC_MEMBER_COMMAND; - extern const char* MOVE_TYPE_COMMAND; + extern const char* APPLY_REFACTORING_COMMAND_ID; + extern const char* EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND; + extern const char* EXTRACT_VARIABLE_COMMAND; + extern const char* EXTRACT_CONSTANT_COMMAND; + extern const char* EXTRACT_METHOD_COMMAND; + extern const char* EXTRACT_FIELD_COMMAND; + extern const char* CONVERT_VARIABLE_TO_FIELD_COMMAND; + extern const char* MOVE_FILE_COMMAND; + extern const char* MOVE_INSTANCE_METHOD_COMMAND; + extern const char* MOVE_STATIC_MEMBER_COMMAND; + extern const char* MOVE_TYPE_COMMAND; }; struct RenamePosition { - lsDocumentUri uri; - int offset = 0; - int length = 0; - void swap(RenamePosition& arg) noexcept - { - uri.swap(arg.uri); - std::swap(offset, arg.offset); - std::swap(length, arg.length); - } + lsDocumentUri uri; + int offset = 0; + int length = 0; + void swap(RenamePosition& arg) noexcept + { + uri.swap(arg.uri); + std::swap(offset, arg.offset); + std::swap(length, arg.length); + } }; MAKE_REFLECT_STRUCT(RenamePosition, uri, offset, length); struct GetRefactorEditParams { - std::string command; - std::vector<lsp::Any> commandArguments; - lsCodeActionParams context; - boost::optional<lsFormattingOptions> options; - MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); + std::string command; + std::vector<lsp::Any> commandArguments; + lsCodeActionParams context; + boost::optional<lsFormattingOptions> options; + MAKE_SWAP_METHOD(GetRefactorEditParams, command, context, options); }; MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); @@ -56,20 +56,20 @@ MAKE_REFLECT_STRUCT(GetRefactorEditParams, command, context, options); struct RefactorWorkspaceEdit { - /** - * The workspace edit this code action performs. - */ - lsWorkspaceEdit edit; - /** - * A command this code action executes. If a code action provides a edit and a - * command, first the edit is executed and then the command. - */ - - boost::optional<std::string> errorMessage; - - boost::optional < lsCommandWithAny > command; - - MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) + /** + * The workspace edit this code action performs. + */ + lsWorkspaceEdit edit; + /** + * A command this code action executes. If a code action provides a edit and a + * command, first the edit is executed and then the command. + */ + + boost::optional<std::string> errorMessage; + + boost::optional < lsCommandWithAny > command; + + MAKE_SWAP_METHOD(RefactorWorkspaceEdit, edit, command, errorMessage) }; MAKE_REFLECT_STRUCT(RefactorWorkspaceEdit,edit,command,errorMessage) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h index ba77041474f..f8bd8a4f7a2 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/resolveUnimplementedAccessors.h @@ -7,16 +7,16 @@ struct AccessorField { - std::string fieldName; - bool isStatic =false; - bool generateGetter = false; - bool generateSetter = false; - void swap(AccessorField& arg) noexcept{ - fieldName.swap(arg.fieldName); - std::swap(isStatic, arg.isStatic); - std::swap(generateGetter, arg.generateGetter); - std::swap(generateSetter, arg.generateSetter); - } + std::string fieldName; + bool isStatic =false; + bool generateGetter = false; + bool generateSetter = false; + void swap(AccessorField& arg) noexcept{ + fieldName.swap(arg.fieldName); + std::swap(isStatic, arg.isStatic); + std::swap(generateGetter, arg.generateGetter); + std::swap(generateSetter, arg.generateSetter); + } }; MAKE_REFLECT_STRUCT(AccessorField, fieldName,isStatic,generateGetter,generateSetter) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h index ac8a2419f62..18a2f9999e5 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/jdtls/searchSymbols.h @@ -13,10 +13,10 @@ struct SearchSymbolParams :public WorkspaceSymbolParams { - boost::optional<std::string> projectName; - boost::optional< bool >sourceOnly; - boost::optional< int> maxResults; - MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); + boost::optional<std::string> projectName; + boost::optional< bool >sourceOnly; + boost::optional< int> maxResults; + MAKE_SWAP_METHOD(SearchSymbolParams, query, projectName, sourceOnly, maxResults); }; MAKE_REFLECT_STRUCT(SearchSymbolParams, query, projectName, sourceOnly, maxResults); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h index d81c3eaa636..0823469ba90 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/extention/sonarlint/protocol.h @@ -9,46 +9,46 @@ struct LintRule { - std::string key; - std::string name; + std::string key; + std::string name; - std::string Display() const - { - return name + " (" + key + ")"; - } - bool activeByDefault = true; - boost::optional<std::string> severity; - boost::optional<std::string> type; - int icon_index = -1; - MAKE_SWAP_METHOD(LintRule, key, name, activeByDefault, severity, type); + std::string Display() const + { + return name + " (" + key + ")"; + } + bool activeByDefault = true; + boost::optional<std::string> severity; + boost::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; - boost::optional<std::string> description; - boost::optional<std::string> defaultValue; + std::string name; + boost::optional<std::string> description; + boost::optional<std::string> defaultValue; }; MAKE_REFLECT_STRUCT(RuleParameter, name, description, defaultValue); struct ShowRuleDescriptionParams { - boost::optional<std::string> key; + boost::optional<std::string> key; - boost::optional<std::string> name; + boost::optional<std::string> name; - boost::optional<std::string> htmlDescription; + boost::optional<std::string> htmlDescription; - boost::optional<std::string> type; + boost::optional<std::string> type; - boost::optional<std::string> severity; + boost::optional<std::string> severity; - boost::optional< std::vector<RuleParameter> > parameters; - MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) + boost::optional< std::vector<RuleParameter> > parameters; + MAKE_SWAP_METHOD(ShowRuleDescriptionParams, key, name, htmlDescription, type, severity, parameters) }; @@ -56,96 +56,96 @@ MAKE_REFLECT_STRUCT(ShowRuleDescriptionParams, key, name, htmlDescription, type, 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); + 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; + lsInitializeParams::lsTrace value; }; MAKE_REFLECT_STRUCT(SetTraceNotificationParams, value); 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 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; - boost::optional<std::string> organizationKey; - MAKE_SWAP_METHOD(ServerConnectionSettings, connectionId, serverUrl, token, organizationKey) + std::string connectionId; + std::string serverUrl; + std::string token; + boost::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() - { - level = "on"; - } - void off() - { - level = "off"; - } - void turn(bool activate) - { - if (activate) - { - on(); - } - else - { - off(); - } - } - boost::optional< std::map<std::string, std::string > > parameters; + 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) + { + on(); + } + else + { + off(); + } + } + boost::optional< std::map<std::string, std::string > > parameters; }; MAKE_REFLECT_STRUCT(RuleSetting, level, parameters) struct ConsoleParams { - boost::optional < bool >showAnalyzerLogs; - boost::optional < bool >showVerboseLogs; - MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) + boost::optional < bool >showAnalyzerLogs; + boost::optional < bool >showVerboseLogs; + MAKE_SWAP_METHOD(ConsoleParams, showAnalyzerLogs, showVerboseLogs) }; MAKE_REFLECT_STRUCT(ConsoleParams, showAnalyzerLogs, showVerboseLogs) struct SonarLintWorkspaceSettings { - boost::optional < bool > disableTelemetry; - boost::optional < std::map<std::string, ServerConnectionSettings> >connectedMode; - boost::optional<std::map<std::string, RuleSetting>> rules; - boost::optional<ConsoleParams> output; + boost::optional < bool > disableTelemetry; + boost::optional < std::map<std::string, ServerConnectionSettings> >connectedMode; + boost::optional<std::map<std::string, RuleSetting>> rules; + boost::optional<ConsoleParams> output; - boost::optional<std::string > pathToNodeExecutable; + boost::optional<std::string > pathToNodeExecutable; - boost::optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); + boost::optional< std::map<std::string, std::string > > getConfigurationParameters(const std::string& ruleKey); }; MAKE_REFLECT_STRUCT(SonarLintWorkspaceSettings, disableTelemetry, connectedMode, - rules, output, pathToNodeExecutable) + rules, output, pathToNodeExecutable) - DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); + DEFINE_REQUEST_RESPONSE_TYPE(slls_listAllRules, JsonNull, lsp::Any, "sonarlint/listAllRules"); @@ -173,4 +173,4 @@ DEFINE_REQUEST_RESPONSE_TYPE(slls_showRuleDescription, ShowRuleDescriptionParams DEFINE_REQUEST_RESPONSE_TYPE(slls_getJavaConfig, lsDocumentUri, GetJavaConfigResponse, "sonarlint/getJavaConfig"); -DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification")
\ No newline at end of file +DEFINE_NOTIFICATION_TYPE(slls_setTraceNotification, SetTraceNotificationParams, "$/setTraceNotification") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h index f10080ea216..c07cc8149d6 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/InitializeParams.h @@ -6,10 +6,10 @@ #include "LibLsp/lsp/workspace/workspaceFolders.h" struct ClientInfo { - std::string name; - boost::optional<std::string> version; - - MAKE_SWAP_METHOD(ClientInfo,name,version); + std::string name; + boost::optional<std::string> version; + + MAKE_SWAP_METHOD(ClientInfo,name,version); }; MAKE_REFLECT_STRUCT(ClientInfo,name,version); @@ -19,7 +19,7 @@ struct lsInitializeParams { // If the parent process is not alive then the server should exit (see exit // notification) its process. boost::optional<int> processId; - + /** * Information about the client * @@ -37,7 +37,7 @@ struct lsInitializeParams { * @since 3.16.0 */ boost::optional<std::string> locale; - + // The rootPath of the workspace. Is null // if no folder is open. // @@ -64,13 +64,13 @@ struct lsInitializeParams { boost::optional< std::string >clientName; - + enum class lsTrace { // NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose'; Off, // off Messages, // messages Verbose // verbose - + }; // The initial trace setting. If omitted trace is disabled ('off'). @@ -117,9 +117,9 @@ struct lsInitializeError { bool retry; void swap(lsInitializeError& arg) noexcept { - auto tem = retry; - retry = arg.retry; - arg.retry = tem; + auto tem = retry; + retry = arg.retry; + arg.retry = tem; } }; MAKE_REFLECT_STRUCT(lsInitializeError, retry); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h index eb8810939ac..2198b158bfc 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/initialize.h @@ -15,7 +15,7 @@ */ struct InitializeResult { lsServerCapabilities capabilities; - MAKE_SWAP_METHOD(InitializeResult, capabilities); + MAKE_SWAP_METHOD(InitializeResult, capabilities); }; MAKE_REFLECT_STRUCT(InitializeResult, capabilities); @@ -26,7 +26,7 @@ MAKE_REFLECT_STRUCT(InitializeResult, capabilities); * the server. * * If the server receives request or notification before the initialize request it should act as follows: - * - for a request the respond should be errored with code: -32001. The message can be picked by the server. + * - for a request the respond should be errored with code: -32001. The message can be picked by the server. * - notifications should be dropped, except for the exit notification. This will allow the exit a server without an initialize request. * * Until the server has responded to the initialize request with an InitializeResult diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h index fcf6634e13f..29129565e48 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsClientCapabilities.h @@ -10,17 +10,17 @@ * @since 3.16.0 */ struct MarkdownClientCapabilities { - /** - * The name of the parser. - */ - std::string parser; - - /** - * The version of the parser. - */ - boost::optional<std::string> version; - MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) - + /** + * The name of the parser. + */ + std::string parser; + + /** + * The version of the parser. + */ + boost::optional<std::string> version; + MAKE_SWAP_METHOD(MarkdownClientCapabilities, parser, version) + }; MAKE_REFLECT_STRUCT(MarkdownClientCapabilities, parser, version) @@ -32,7 +32,7 @@ struct lsClientCapabilities { boost::optional<lsTextDocumentClientCapabilities> textDocument; /** - * Window specific client capabilities. + * Window specific client capabilities. */ boost::optional<lsp::Any> window; /** diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h index 66af2ced6b1..d62d3e4dfd6 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsServerCapabilities.h @@ -16,77 +16,77 @@ extern void Reflect(Reader&, std::pair<boost::optional<lsTextDocumentSyncKind>, // Code Action options. // struct CodeActionOptions : WorkDoneProgressOptions { - // - // CodeActionKinds that this server may return. - // - // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server - // may list out every specific kind they provide. - // - typedef std::string CodeActionKind; - std::vector<CodeActionKind> codeActionKinds; - - MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); + // + // CodeActionKinds that this server may return. + // + // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server + // may list out every specific kind they provide. + // + typedef std::string CodeActionKind; + std::vector<CodeActionKind> codeActionKinds; + + MAKE_SWAP_METHOD(CodeActionOptions, workDoneProgress, codeActionKinds); }; MAKE_REFLECT_STRUCT(CodeActionOptions, workDoneProgress, codeActionKinds) struct CodeLensOptions : WorkDoneProgressOptions { - // - // Code lens has a resolve provider as well. - // - boost::optional<bool> resolveProvider ; - MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); + // + // Code lens has a resolve provider as well. + // + boost::optional<bool> resolveProvider ; + MAKE_SWAP_METHOD(CodeLensOptions, workDoneProgress, resolveProvider); }; MAKE_REFLECT_STRUCT(CodeLensOptions, workDoneProgress, resolveProvider) // Format document on type options struct lsDocumentOnTypeFormattingOptions :WorkDoneProgressOptions { - // A character on which formatting should be triggered, like `}`. - std::string firstTriggerCharacter; - - // More trigger characters. - std::vector<std::string> moreTriggerCharacter; - MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); + // A character on which formatting should be triggered, like `}`. + std::string firstTriggerCharacter; + + // More trigger characters. + std::vector<std::string> moreTriggerCharacter; + MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingOptions, workDoneProgress, + firstTriggerCharacter, + moreTriggerCharacter); }; MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingOptions, workDoneProgress, - firstTriggerCharacter, - moreTriggerCharacter); + firstTriggerCharacter, + moreTriggerCharacter); struct RenameOptions : WorkDoneProgressOptions { - // - // Renames should be checked and tested before being executed. - // - boost::optional<bool> prepareProvider; - MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); + // + // Renames should be checked and tested before being executed. + // + boost::optional<bool> prepareProvider; + MAKE_SWAP_METHOD(RenameOptions, workDoneProgress, prepareProvider); }; MAKE_REFLECT_STRUCT(RenameOptions,workDoneProgress,prepareProvider) struct DocumentFilter{ - // - // A language id, like `typescript`. - // - boost::optional<std::string> language; - // - // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. - // - boost::optional<std::string>scheme; - // - // A glob pattern, like `*.{ts,js}`. - // - // Glob patterns can have the following syntax: - // - `*` to match one or more characters in a path segment - // - `?` to match on one character in a path segment - // - `**` to match any number of path segments, including none - // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js} - // matches all TypeScript and JavaScript files) - // - `[]` to declare a range of characters to match in a path segment - // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) - // - `[!...]` to negate a range of characters to match in a path segment - // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but - // not `example.0`) - // - boost::optional<std::string>pattern; - MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) + // + // A language id, like `typescript`. + // + boost::optional<std::string> language; + // + // A Uri [scheme](#Uri.scheme), like `file` or `untitled`. + // + boost::optional<std::string>scheme; + // + // A glob pattern, like `*.{ts,js}`. + // + // Glob patterns can have the following syntax: + // - `*` to match one or more characters in a path segment + // - `?` to match on one character in a path segment + // - `**` to match any number of path segments, including none + // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js} + // matches all TypeScript and JavaScript files) + // - `[]` to declare a range of characters to match in a path segment + // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) + // - `[!...]` to negate a range of characters to match in a path segment + // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but + // not `example.0`) + // + boost::optional<std::string>pattern; + MAKE_SWAP_METHOD(DocumentFilter, language, scheme, pattern) }; MAKE_REFLECT_STRUCT(DocumentFilter, language, scheme, pattern) @@ -95,17 +95,17 @@ using DocumentSelector = std::vector<DocumentFilter>; // Document link options struct lsDocumentLinkOptions :WorkDoneProgressOptions { - // Document links have a resolve provider as well. - boost::optional<bool> resolveProvider; - MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); + // Document links have a resolve provider as well. + boost::optional<bool> resolveProvider; + MAKE_SWAP_METHOD(lsDocumentLinkOptions, workDoneProgress, resolveProvider); }; MAKE_REFLECT_STRUCT(lsDocumentLinkOptions, workDoneProgress,resolveProvider); // Execute command options. struct lsExecuteCommandOptions : WorkDoneProgressOptions { - // The commands to be executed on the server - std::vector<std::string> commands; - MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); + // The commands to be executed on the server + std::vector<std::string> commands; + MAKE_SWAP_METHOD(lsExecuteCommandOptions, workDoneProgress, commands); }; MAKE_REFLECT_STRUCT(lsExecuteCommandOptions, workDoneProgress, commands); @@ -116,9 +116,9 @@ struct TextDocumentRegistrationOptions // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. // - boost::optional<DocumentSelector> documentSelector; + boost::optional<DocumentSelector> documentSelector; - MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); + MAKE_SWAP_METHOD(TextDocumentRegistrationOptions, documentSelector); }; MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector); @@ -127,12 +127,12 @@ MAKE_REFLECT_STRUCT(TextDocumentRegistrationOptions, documentSelector); // struct StaticRegistrationOptions :public TextDocumentRegistrationOptions { - // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - boost::optional<std::string> id; - MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + boost::optional<std::string> id; + MAKE_SWAP_METHOD(StaticRegistrationOptions, documentSelector, id) }; MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id) @@ -143,22 +143,22 @@ MAKE_REFLECT_STRUCT(StaticRegistrationOptions, documentSelector,id) // struct WorkspaceFoldersOptions { - // - // The server has support for workspace folders - // - boost::optional<bool> supported; - - // - // Whether the server wants to receive workspace folder - // change notifications. - // - // If a string is provided, the string is treated as an ID - // under which the notification is registered on the client - // side. The ID can be used to unregister for these events - // using the `client/unregisterCapability` request. - // - boost::optional<std::pair< boost::optional<std::string>, boost::optional<bool> > > changeNotifications; - MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); + // + // The server has support for workspace folders + // + boost::optional<bool> supported; + + // + // Whether the server wants to receive workspace folder + // change notifications. + // + // If a string is provided, the string is treated as an ID + // under which the notification is registered on the client + // side. The ID can be used to unregister for these events + // using the `client/unregisterCapability` request. + // + boost::optional<std::pair< boost::optional<std::string>, boost::optional<bool> > > changeNotifications; + MAKE_SWAP_METHOD(WorkspaceFoldersOptions, supported, changeNotifications); }; MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications); @@ -170,8 +170,8 @@ MAKE_REFLECT_STRUCT(WorkspaceFoldersOptions, supported, changeNotifications); // enum lsFileOperationPatternKind { - file, - folder + file, + folder }; MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind) @@ -182,11 +182,11 @@ MAKE_REFLECT_TYPE_PROXY(lsFileOperationPatternKind) // struct lsFileOperationPatternOptions { - // - // The pattern should be matched ignoring casing. - // - boost::optional<bool> ignoreCase; - MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) + // + // The pattern should be matched ignoring casing. + // + boost::optional<bool> ignoreCase; + MAKE_SWAP_METHOD(lsFileOperationPatternOptions, ignoreCase) }; MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase) // @@ -196,33 +196,33 @@ MAKE_REFLECT_STRUCT(lsFileOperationPatternOptions, ignoreCase) // @since 3.16.0 // struct lsFileOperationPattern { - // - // The glob pattern to match. Glob patterns can have the following syntax: - // - `*` to match one or more characters in a path segment - // - `?` to match on one character in a path segment - // - `**` to match any number of path segments, including none - // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` - // matches all TypeScript and JavaScript files) - // - `[]` to declare a range of characters to match in a path segment - // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) - // - `[!...]` to negate a range of characters to match in a path segment - // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but - // not `example.0`) - // - std::string glob; - - // - // Whether to match files or folders with this pattern. - // - // Matches both if undefined. - // - boost::optional<lsFileOperationPatternKind> matches; - - // - // Additional options used during matching. - // - boost::optional<lsFileOperationPatternOptions> options ; - MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) + // + // The glob pattern to match. Glob patterns can have the following syntax: + // - `*` to match one or more characters in a path segment + // - `?` to match on one character in a path segment + // - `**` to match any number of path segments, including none + // - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` + // matches all TypeScript and JavaScript files) + // - `[]` to declare a range of characters to match in a path segment + // (e.g., `example.[0-9]` to match on `example.0`, `example.1`,...) + // - `[!...]` to negate a range of characters to match in a path segment + // (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but + // not `example.0`) + // + std::string glob; + + // + // Whether to match files or folders with this pattern. + // + // Matches both if undefined. + // + boost::optional<lsFileOperationPatternKind> matches; + + // + // Additional options used during matching. + // + boost::optional<lsFileOperationPatternOptions> options ; + MAKE_SWAP_METHOD(lsFileOperationPattern, glob, matches, options) }; MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options) // @@ -233,16 +233,16 @@ MAKE_REFLECT_STRUCT(lsFileOperationPattern, glob, matches, options) // struct lsFileOperationFilter { - // - // A Uri like `file` or `untitled`. - // - boost::optional<std::string> scheme; + // + // A Uri like `file` or `untitled`. + // + boost::optional<std::string> scheme; - // - // The actual file operation pattern. - // - boost::optional<lsFileOperationPattern> pattern; - MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) + // + // The actual file operation pattern. + // + boost::optional<lsFileOperationPattern> pattern; + MAKE_SWAP_METHOD(lsFileOperationFilter, scheme, pattern) }; MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern) // @@ -251,69 +251,69 @@ MAKE_REFLECT_STRUCT(lsFileOperationFilter, scheme, pattern) // @since 3.16.0 // struct lsFileOperationRegistrationOptions { - // - // The actual filters. - // - boost::optional<std::vector<lsFileOperationFilter>> filters; - MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) + // + // The actual filters. + // + boost::optional<std::vector<lsFileOperationFilter>> filters; + MAKE_SWAP_METHOD(lsFileOperationRegistrationOptions, filters) }; MAKE_REFLECT_STRUCT(lsFileOperationRegistrationOptions, filters) struct WorkspaceServerCapabilities { - // - // The server supports workspace folder. - // - // Since 3.6.0 - // - WorkspaceFoldersOptions workspaceFolders; - - - // - // The server is interested in file notifications/requests. - // - // @since 3.16.0 - // - struct lsFileOperations - { - // - // The server is interested in receiving didCreateFiles - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didCreate; - - // - // The server is interested in receiving willCreateFiles requests. - // - boost::optional<lsFileOperationRegistrationOptions> willCreate; - - // - // The server is interested in receiving didRenameFiles - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didRename; - - // - // The server is interested in receiving willRenameFiles requests. - // - boost::optional<lsFileOperationRegistrationOptions> willRename; - - // - // The server is interested in receiving didDeleteFiles file - // notifications. - // - boost::optional<lsFileOperationRegistrationOptions> didDelete; - - // - // The server is interested in receiving willDeleteFiles file - // requests. - // - boost::optional<lsFileOperationRegistrationOptions> willDelete; - MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) - }; - boost::optional<lsFileOperations>fileOperations; - - - MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) + // + // The server supports workspace folder. + // + // Since 3.6.0 + // + WorkspaceFoldersOptions workspaceFolders; + + + // + // The server is interested in file notifications/requests. + // + // @since 3.16.0 + // + struct lsFileOperations + { + // + // The server is interested in receiving didCreateFiles + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didCreate; + + // + // The server is interested in receiving willCreateFiles requests. + // + boost::optional<lsFileOperationRegistrationOptions> willCreate; + + // + // The server is interested in receiving didRenameFiles + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didRename; + + // + // The server is interested in receiving willRenameFiles requests. + // + boost::optional<lsFileOperationRegistrationOptions> willRename; + + // + // The server is interested in receiving didDeleteFiles file + // notifications. + // + boost::optional<lsFileOperationRegistrationOptions> didDelete; + + // + // The server is interested in receiving willDeleteFiles file + // requests. + // + boost::optional<lsFileOperationRegistrationOptions> willDelete; + MAKE_SWAP_METHOD(lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) + }; + boost::optional<lsFileOperations>fileOperations; + + + MAKE_SWAP_METHOD(WorkspaceServerCapabilities, workspaceFolders, fileOperations) }; MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities, workspaceFolders, fileOperations) MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, willCreate, didRename, willRename, didDelete, willDelete) @@ -328,77 +328,77 @@ MAKE_REFLECT_STRUCT(WorkspaceServerCapabilities::lsFileOperations, didCreate, wi // struct SemanticHighlightingServerCapabilities { - // - // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> - // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting - // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from - // the server. - // - std::vector< std::vector<std::string> > scopes; - MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) + // + // A "lookup table" of semantic highlighting <a href="https://manual.macromates.com/en/language_grammars">TextMate scopes</a> + // supported by the language server. If not defined or empty, then the server does not support the semantic highlighting + // feature. Otherwise, clients should reuse this "lookup table" when receiving semantic highlighting notifications from + // the server. + // + std::vector< std::vector<std::string> > scopes; + MAKE_SWAP_METHOD(SemanticHighlightingServerCapabilities, scopes) }; MAKE_REFLECT_STRUCT(SemanticHighlightingServerCapabilities, scopes) struct SemanticTokensServerFull { - // - // The server supports deltas for full documents. - // - bool delta =false; - MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) + // + // The server supports deltas for full documents. + // + bool delta =false; + MAKE_SWAP_METHOD(SemanticTokensServerFull, delta) }; MAKE_REFLECT_STRUCT(SemanticTokensServerFull, delta) struct SemanticTokensWithRegistrationOptions { - SemanticTokensLegend legend; - - // - // Server supports providing semantic tokens for a specific range - // of a document. - // - boost::optional< std::pair< boost::optional<bool>, boost::optional<lsp::Any> > > range; - - // - // Server supports providing semantic tokens for a full document. - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<SemanticTokensServerFull> > > full; - - // - // A document selector to identify the scope of the registration. If set to null - // the document selector provided on the client side will be used. - // - boost::optional < std::vector<DocumentFilter> > documentSelector; - // - // The id used to register the request. The id can be used to deregister - // the request again. See also Registration#id. - // - boost::optional<std::string> id; - MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) + SemanticTokensLegend legend; + + // + // Server supports providing semantic tokens for a specific range + // of a document. + // + boost::optional< std::pair< boost::optional<bool>, boost::optional<lsp::Any> > > range; + + // + // Server supports providing semantic tokens for a full document. + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<SemanticTokensServerFull> > > full; + + // + // A document selector to identify the scope of the registration. If set to null + // the document selector provided on the client side will be used. + // + boost::optional < std::vector<DocumentFilter> > documentSelector; + // + // The id used to register the request. The id can be used to deregister + // the request again. See also Registration#id. + // + boost::optional<std::string> id; + MAKE_SWAP_METHOD(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector, id) }; MAKE_REFLECT_STRUCT(SemanticTokensWithRegistrationOptions, legend, range, full, documentSelector ,id) using DocumentColorOptions = WorkDoneProgressOptions; using FoldingRangeOptions = WorkDoneProgressOptions; struct lsServerCapabilities { - // Defines how text documents are synced. Is either a detailed structure - // defining each notification or for backwards compatibility the + // Defines how text documents are synced. Is either a detailed structure + // defining each notification or for backwards compatibility the - // TextDocumentSyncKind number. - boost::optional< std::pair<boost::optional<lsTextDocumentSyncKind>, - boost::optional<lsTextDocumentSyncOptions> >> textDocumentSync; + // TextDocumentSyncKind number. + boost::optional< std::pair<boost::optional<lsTextDocumentSyncKind>, + boost::optional<lsTextDocumentSyncOptions> >> textDocumentSync; - // The server provides hover support. - boost::optional<bool> hoverProvider; + // The server provides hover support. + boost::optional<bool> hoverProvider; - // The server provides completion support. - boost::optional < lsCompletionOptions > completionProvider; + // The server provides completion support. + boost::optional < lsCompletionOptions > completionProvider; - // The server provides signature help support. - boost::optional < lsSignatureHelpOptions > signatureHelpProvider; + // The server provides signature help support. + boost::optional < lsSignatureHelpOptions > signatureHelpProvider; - // The server provides goto definition support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > definitionProvider; + // The server provides goto definition support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > definitionProvider; // @@ -406,184 +406,184 @@ struct lsServerCapabilities { // // Since 3.6.0 // - boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > typeDefinitionProvider ; + boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > typeDefinitionProvider ; - // The server provides implementation support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > implementationProvider ; + // The server provides implementation support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<StaticRegistrationOptions> > > implementationProvider ; - // The server provides find references support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > referencesProvider ; + // The server provides find references support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > referencesProvider ; - // The server provides document highlight support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentHighlightProvider ; + // The server provides document highlight support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentHighlightProvider ; - // The server provides document symbol support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentSymbolProvider ; + // The server provides document symbol support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentSymbolProvider ; - // The server provides workspace symbol support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ; + // The server provides workspace symbol support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > workspaceSymbolProvider ; - // The server provides code actions. - boost::optional< std::pair< boost::optional<bool>, boost::optional<CodeActionOptions> > > codeActionProvider ; + // The server provides code actions. + boost::optional< std::pair< boost::optional<bool>, boost::optional<CodeActionOptions> > > codeActionProvider ; - // The server provides code lens. - boost::optional<CodeLensOptions> codeLensProvider; + // The server provides code lens. + boost::optional<CodeLensOptions> codeLensProvider; - // The server provides document formatting. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentFormattingProvider ; + // The server provides document formatting. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentFormattingProvider ; - // The server provides document range formatting. - boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ; + // The server provides document range formatting. + boost::optional< std::pair< boost::optional<bool>, boost::optional<WorkDoneProgressOptions> > > documentRangeFormattingProvider ; - // The server provides document formatting on typing. - boost::optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; + // The server provides document formatting on typing. + boost::optional<lsDocumentOnTypeFormattingOptions> documentOnTypeFormattingProvider; - // The server provides rename support. - boost::optional< std::pair< boost::optional<bool>, boost::optional<RenameOptions> > > renameProvider; + // The server provides rename support. + boost::optional< std::pair< boost::optional<bool>, boost::optional<RenameOptions> > > renameProvider; - // The server provides document link support. - boost::optional<lsDocumentLinkOptions > documentLinkProvider; + // The server provides document link support. + boost::optional<lsDocumentLinkOptions > documentLinkProvider; - - // - // The server provides color provider support. - // - // @since 3.6.0 - // - boost::optional< std::pair< boost::optional<bool>, boost::optional<DocumentColorOptions> > > colorProvider; - - - // - // The server provides folding provider support. - // - // @since 3.10.0 - // - boost::optional < std::pair< boost::optional<bool>, boost::optional<FoldingRangeOptions> > > foldingRangeProvider; - - // The server provides execute command support. - boost::optional < lsExecuteCommandOptions >executeCommandProvider; - - - // - // Workspace specific server capabilities - // - boost::optional< WorkspaceServerCapabilities > workspace; - - // - // Semantic highlighting server capabilities. - // - - boost::optional< SemanticHighlightingServerCapabilities >semanticHighlighting; - - // - // Server capability for calculating super- and subtype hierarchies. - // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. - // - // <p> - // <b>Note:</b> the <a href= - // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} - // language feature</a> is not yet part of the official LSP specification. - // - - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > typeHierarchyProvider; - - // - // The server provides Call Hierarchy support. - // - - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > callHierarchyProvider; - - // - // The server provides selection range support. - // - // Since 3.15.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > selectionRangeProvider; - - // - // The server provides linked editing range support. - // - // Since 3.16.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > linkedEditingRangeProvider; - - - // - // The server provides semantic tokens support. - // - // Since 3.16.0 - // - boost::optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider; - - // - // Whether server provides moniker support. - // - // Since 3.16.0 - // - boost::optional< std::pair< boost::optional<bool>, - boost::optional<StaticRegistrationOptions> > > monikerProvider; - - boost::optional<lsp::Any> experimental; - - - MAKE_SWAP_METHOD(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) + + // + // The server provides color provider support. + // + // @since 3.6.0 + // + boost::optional< std::pair< boost::optional<bool>, boost::optional<DocumentColorOptions> > > colorProvider; + + + // + // The server provides folding provider support. + // + // @since 3.10.0 + // + boost::optional < std::pair< boost::optional<bool>, boost::optional<FoldingRangeOptions> > > foldingRangeProvider; + + // The server provides execute command support. + boost::optional < lsExecuteCommandOptions >executeCommandProvider; + + + // + // Workspace specific server capabilities + // + boost::optional< WorkspaceServerCapabilities > workspace; + + // + // Semantic highlighting server capabilities. + // + + boost::optional< SemanticHighlightingServerCapabilities >semanticHighlighting; + + // + // Server capability for calculating super- and subtype hierarchies. + // The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + // + // <p> + // <b>Note:</b> the <a href= + // "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} + // language feature</a> is not yet part of the official LSP specification. + // + + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > typeHierarchyProvider; + + // + // The server provides Call Hierarchy support. + // + + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > callHierarchyProvider; + + // + // The server provides selection range support. + // + // Since 3.15.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > selectionRangeProvider; + + // + // The server provides linked editing range support. + // + // Since 3.16.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > linkedEditingRangeProvider; + + + // + // The server provides semantic tokens support. + // + // Since 3.16.0 + // + boost::optional < SemanticTokensWithRegistrationOptions> semanticTokensProvider; + + // + // Whether server provides moniker support. + // + // Since 3.16.0 + // + boost::optional< std::pair< boost::optional<bool>, + boost::optional<StaticRegistrationOptions> > > monikerProvider; + + boost::optional<lsp::Any> experimental; + + + MAKE_SWAP_METHOD(lsServerCapabilities, + textDocumentSync, + hoverProvider, + completionProvider, + signatureHelpProvider, + definitionProvider, + typeDefinitionProvider, + implementationProvider, + referencesProvider, + documentHighlightProvider, + documentSymbolProvider, + workspaceSymbolProvider, + codeActionProvider, + codeLensProvider, + documentFormattingProvider, + documentRangeFormattingProvider, + documentOnTypeFormattingProvider, + renameProvider, + documentLinkProvider, + executeCommandProvider, + workspace, + semanticHighlighting, + typeHierarchyProvider, + callHierarchyProvider, + selectionRangeProvider, + experimental, colorProvider, foldingRangeProvider, + linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) }; MAKE_REFLECT_STRUCT(lsServerCapabilities, - textDocumentSync, - hoverProvider, - completionProvider, - signatureHelpProvider, - definitionProvider, - typeDefinitionProvider, - implementationProvider, - referencesProvider, - documentHighlightProvider, - documentSymbolProvider, - workspaceSymbolProvider, - codeActionProvider, - codeLensProvider, - documentFormattingProvider, - documentRangeFormattingProvider, - documentOnTypeFormattingProvider, - renameProvider, - documentLinkProvider, - executeCommandProvider, - workspace, - semanticHighlighting, - typeHierarchyProvider, - callHierarchyProvider, - selectionRangeProvider, - experimental, colorProvider, foldingRangeProvider, - linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) + textDocumentSync, + hoverProvider, + completionProvider, + signatureHelpProvider, + definitionProvider, + typeDefinitionProvider, + implementationProvider, + referencesProvider, + documentHighlightProvider, + documentSymbolProvider, + workspaceSymbolProvider, + codeActionProvider, + codeLensProvider, + documentFormattingProvider, + documentRangeFormattingProvider, + documentOnTypeFormattingProvider, + renameProvider, + documentLinkProvider, + executeCommandProvider, + workspace, + semanticHighlighting, + typeHierarchyProvider, + callHierarchyProvider, + selectionRangeProvider, + experimental, colorProvider, foldingRangeProvider, + linkedEditingRangeProvider, monikerProvider, semanticTokensProvider) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h index 569f203c7a5..4e66bcb7ae9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsTextDocumentClientCapabilities.h @@ -14,8 +14,8 @@ struct WorkDoneProgressOptions { - boost::optional<bool>workDoneProgress; - MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); + boost::optional<bool>workDoneProgress; + MAKE_SWAP_METHOD(WorkDoneProgressOptions, workDoneProgress); }; MAKE_REFLECT_STRUCT(WorkDoneProgressOptions, workDoneProgress); @@ -58,9 +58,9 @@ struct lsSaveOptions { bool includeText = false; void swap(lsSaveOptions& arg)noexcept { - auto temp = includeText; - includeText = arg.includeText; - arg.includeText = temp; + auto temp = includeText; + includeText = arg.includeText; + arg.includeText = temp; } }; MAKE_REFLECT_STRUCT(lsSaveOptions, includeText); @@ -114,11 +114,11 @@ struct lsTextDocumentSyncOptions { boost::optional<lsSaveOptions> save; MAKE_SWAP_METHOD(lsTextDocumentSyncOptions, - openClose, - change, - willSave, - willSaveWaitUntil, - save); + openClose, + change, + willSave, + willSaveWaitUntil, + save); }; MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, openClose, @@ -128,402 +128,402 @@ MAKE_REFLECT_STRUCT(lsTextDocumentSyncOptions, save); struct SynchronizationCapabilities { - // Whether text document synchronization supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Whether text document synchronization supports dynamic registration. + boost::optional<bool> dynamicRegistration; - // The client supports sending will save notifications. - boost::optional<bool> willSave; + // The client supports sending will save notifications. + boost::optional<bool> willSave; - // The client supports sending a will save request and - // waits for a response providing text edits which will - // be applied to the document before it is saved. - boost::optional<bool> willSaveWaitUntil; + // The client supports sending a will save request and + // waits for a response providing text edits which will + // be applied to the document before it is saved. + boost::optional<bool> willSaveWaitUntil; - // The client supports did save notifications. - boost::optional<bool> didSave; + // The client supports did save notifications. + boost::optional<bool> didSave; - MAKE_SWAP_METHOD(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); + MAKE_SWAP_METHOD(SynchronizationCapabilities, + dynamicRegistration, + willSave, + willSaveWaitUntil, + didSave); }; MAKE_REFLECT_STRUCT(SynchronizationCapabilities, - dynamicRegistration, - willSave, - willSaveWaitUntil, - didSave); + dynamicRegistration, + willSave, + willSaveWaitUntil, + didSave); struct CompletionItemKindCapabilities { - boost::optional<std::vector<lsCompletionItemKind> >valueSet; - MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); + boost::optional<std::vector<lsCompletionItemKind> >valueSet; + MAKE_SWAP_METHOD(CompletionItemKindCapabilities, valueSet); }; MAKE_REFLECT_STRUCT(CompletionItemKindCapabilities, valueSet); struct CompletionItemCapabilities { - // Client supports snippets as insert text. - // - // A snippet can define tab stops and placeholders with `$1`, `$2` - // and `${3:foo}`. `$0` defines the final tab stop, it defaults to - // the end of the snippet. Placeholders with equal identifiers are linked, - // that is typing in one will update others too. - boost::optional<bool> snippetSupport; + // Client supports snippets as insert text. + // + // A snippet can define tab stops and placeholders with `$1`, `$2` + // and `${3:foo}`. `$0` defines the final tab stop, it defaults to + // the end of the snippet. Placeholders with equal identifiers are linked, + // that is typing in one will update others too. + boost::optional<bool> snippetSupport; // Client supports commit characters on a completion item. - boost::optional<bool> commitCharactersSupport; + boost::optional<bool> commitCharactersSupport; // Client supports the following content formats for the documentation // property. The order describes the preferred format of the client. - boost::optional< std::vector<std::string> > documentationFormat; + boost::optional< std::vector<std::string> > documentationFormat; // Client supports the deprecated property on a completion item. - boost::optional<bool> deprecatedSupport; + boost::optional<bool> deprecatedSupport; - // - // Client supports the preselect property on a completion item. - // - boost::optional<bool> preselectSupport; + // + // Client supports the preselect property on a completion item. + // + boost::optional<bool> preselectSupport; - MAKE_SWAP_METHOD(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); + MAKE_SWAP_METHOD(CompletionItemCapabilities, + snippetSupport, + commitCharactersSupport, + documentationFormat, + deprecatedSupport, preselectSupport); }; MAKE_REFLECT_STRUCT(CompletionItemCapabilities, - snippetSupport, - commitCharactersSupport, - documentationFormat, - deprecatedSupport, preselectSupport); + snippetSupport, + commitCharactersSupport, + documentationFormat, + deprecatedSupport, preselectSupport); // // Capabilities specific to the `textDocument/completion` // struct CompletionCapabilities { - // Whether completion supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Whether completion supports dynamic registration. + boost::optional<bool> dynamicRegistration; - // The client supports the following `CompletionItem` specific - // capabilities. - boost::optional<CompletionItemCapabilities> completionItem; + // The client supports the following `CompletionItem` specific + // capabilities. + boost::optional<CompletionItemCapabilities> completionItem; - // - // The client supports the following `CompletionItemKind` specific - // capabilities. - // - boost::optional<CompletionItemKindCapabilities> completionItemKind; + // + // The client supports the following `CompletionItemKind` specific + // capabilities. + // + boost::optional<CompletionItemKindCapabilities> completionItemKind; - // - // The client supports sending additional context information for a - // `textDocument/completion` request. - // - boost::optional<bool> contextSupport; + // + // The client supports sending additional context information for a + // `textDocument/completion` request. + // + boost::optional<bool> contextSupport; - MAKE_SWAP_METHOD(CompletionCapabilities, - dynamicRegistration, - completionItem, completionItemKind); + MAKE_SWAP_METHOD(CompletionCapabilities, + dynamicRegistration, + completionItem, completionItemKind); }; MAKE_REFLECT_STRUCT(CompletionCapabilities, - dynamicRegistration, - completionItem , completionItemKind); + dynamicRegistration, + completionItem , completionItemKind); struct HoverCapabilities:public DynamicRegistrationCapabilities { - // + // // Client supports the following content formats for the content // property. The order describes the preferred format of the client. // // See {@link MarkupKind} for allowed values. // - boost::optional<std::vector<std::string>> contentFormat; + boost::optional<std::vector<std::string>> contentFormat; - MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); + MAKE_SWAP_METHOD(HoverCapabilities, dynamicRegistration, contentFormat); }; MAKE_REFLECT_STRUCT(HoverCapabilities, dynamicRegistration, contentFormat); // // Client capabilities specific to parameter information. // -struct ParameterInformationCapabilities { - // - // The client supports processing label offsets instead of a - // simple label string. - // - // Since 3.14.0 - // - boost::optional<bool> labelOffsetSupport; - - MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); +struct ParameterInformationCapabilities { + // + // The client supports processing label offsets instead of a + // simple label string. + // + // Since 3.14.0 + // + boost::optional<bool> labelOffsetSupport; + + MAKE_SWAP_METHOD(ParameterInformationCapabilities, labelOffsetSupport); }; MAKE_REFLECT_STRUCT(ParameterInformationCapabilities, labelOffsetSupport) struct SignatureInformationCapabilities { - // - // Client supports the following content formats for the documentation - // property. The order describes the preferred format of the client. - // - // See {@link MarkupKind} for allowed values. - // - std::vector<std::string> documentationFormat; - - // - // Client capabilities specific to parameter information. - // - ParameterInformationCapabilities parameterInformation; - - MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) + // + // Client supports the following content formats for the documentation + // property. The order describes the preferred format of the client. + // + // See {@link MarkupKind} for allowed values. + // + std::vector<std::string> documentationFormat; + + // + // Client capabilities specific to parameter information. + // + ParameterInformationCapabilities parameterInformation; + + MAKE_SWAP_METHOD(SignatureInformationCapabilities, documentationFormat, parameterInformation) }; MAKE_REFLECT_STRUCT(SignatureInformationCapabilities,documentationFormat, parameterInformation) struct SignatureHelpCapabilities :public DynamicRegistrationCapabilities { - // - // The client supports the following `SignatureInformation` - // specific properties. - // - boost::optional< SignatureInformationCapabilities > signatureInformation; + // + // The client supports the following `SignatureInformation` + // specific properties. + // + boost::optional< SignatureInformationCapabilities > signatureInformation; - MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) + MAKE_SWAP_METHOD(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) }; MAKE_REFLECT_STRUCT(SignatureHelpCapabilities, dynamicRegistration, signatureInformation) struct DocumentSymbolCapabilities :public DynamicRegistrationCapabilities { - // - // Specific capabilities for the `SymbolKind`. - // - boost::optional<SymbolKindCapabilities> symbolKind; + // + // Specific capabilities for the `SymbolKind`. + // + boost::optional<SymbolKindCapabilities> symbolKind; - // - // The client support hierarchical document symbols. - // - boost::optional<bool> hierarchicalDocumentSymbolSupport; + // + // The client support hierarchical document symbols. + // + boost::optional<bool> hierarchicalDocumentSymbolSupport; - MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) + MAKE_SWAP_METHOD(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) }; MAKE_REFLECT_STRUCT(DocumentSymbolCapabilities, dynamicRegistration, symbolKind, hierarchicalDocumentSymbolSupport) struct DeclarationCapabilities:public DynamicRegistrationCapabilities{ - // - // The client supports additional metadata in the form of declaration links. - // - boost::optional<bool>linkSupport; + // + // The client supports additional metadata in the form of declaration links. + // + boost::optional<bool>linkSupport; - MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); + MAKE_SWAP_METHOD(DeclarationCapabilities, dynamicRegistration, linkSupport); }; MAKE_REFLECT_STRUCT(DeclarationCapabilities, dynamicRegistration, linkSupport) struct CodeActionKindCapabilities { - // - // The code action kind values the client supports. When this - // property exists the client also guarantees that it will - // handle values outside its set gracefully and falls back - // to a default value when unknown. - // - // See {@link CodeActionKind} for allowed values. - // - boost::optional< std::vector< std::string> >valueSet; - - MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) + // + // The code action kind values the client supports. When this + // property exists the client also guarantees that it will + // handle values outside its set gracefully and falls back + // to a default value when unknown. + // + // See {@link CodeActionKind} for allowed values. + // + boost::optional< std::vector< std::string> >valueSet; + + MAKE_SWAP_METHOD(CodeActionKindCapabilities, valueSet) }; MAKE_REFLECT_STRUCT(CodeActionKindCapabilities,valueSet) struct CodeActionLiteralSupportCapabilities { - boost::optional<CodeActionKindCapabilities> codeActionKind; + boost::optional<CodeActionKindCapabilities> codeActionKind; - MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) + MAKE_SWAP_METHOD(CodeActionLiteralSupportCapabilities, codeActionKind) }; MAKE_REFLECT_STRUCT(CodeActionLiteralSupportCapabilities, codeActionKind) struct CodeActionCapabilities:public DynamicRegistrationCapabilities{ - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; + boost::optional<CodeActionLiteralSupportCapabilities> codeActionLiteralSupport; - MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) + MAKE_SWAP_METHOD(CodeActionCapabilities, dynamicRegistration, codeActionLiteralSupport) }; MAKE_REFLECT_STRUCT(CodeActionCapabilities,dynamicRegistration,codeActionLiteralSupport) struct RenameCapabilities :public DynamicRegistrationCapabilities { - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<bool> prepareSupport; + boost::optional<bool> prepareSupport; - MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) + MAKE_SWAP_METHOD(RenameCapabilities, dynamicRegistration, prepareSupport) }; MAKE_REFLECT_STRUCT(RenameCapabilities, dynamicRegistration, prepareSupport) struct DiagnosticsTagSupport { - /** - * The tags supported by the client. - */ - std::vector<DiagnosticTag> valueSet; - MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) + /** + * The tags supported by the client. + */ + std::vector<DiagnosticTag> valueSet; + MAKE_SWAP_METHOD(DiagnosticsTagSupport, valueSet) }; MAKE_REFLECT_STRUCT(DiagnosticsTagSupport, valueSet) struct PublishDiagnosticsClientCapabilities :public DynamicRegistrationCapabilities { - /** + /** * The client support code action literals as a valid * response of the `textDocument/codeAction` request. */ - boost::optional<bool> relatedInformation; - - /** - * Client supports the tag property to provide meta data about a diagnostic. - * Clients supporting tags have to handle unknown tags gracefully. - * - * This property had been added and implemented as boolean before it was - * added to the specification as {@link DiagnosticsTagSupport}. In order to - * keep this implementation compatible with intermediate clients (including - * vscode-language-client < 6.0.0) we add an either type here. - * - * Since 3.15 - */ - boost::optional < std::pair<boost::optional<bool>, boost::optional<DiagnosticsTagSupport> > > tagSupport; - - /** - * Whether the client interprets the version property of the - * `textDocument/publishDiagnostics` notification's parameter. - * - * Since 3.15.0 - */ - boost::optional<bool> versionSupport; - - /** + boost::optional<bool> relatedInformation; + + /** + * Client supports the tag property to provide meta data about a diagnostic. + * Clients supporting tags have to handle unknown tags gracefully. + * + * This property had been added and implemented as boolean before it was + * added to the specification as {@link DiagnosticsTagSupport}. In order to + * keep this implementation compatible with intermediate clients (including + * vscode-language-client < 6.0.0) we add an either type here. + * + * Since 3.15 + */ + boost::optional < std::pair<boost::optional<bool>, boost::optional<DiagnosticsTagSupport> > > tagSupport; + + /** + * Whether the client interprets the version property of the + * `textDocument/publishDiagnostics` notification's parameter. + * + * Since 3.15.0 + */ + boost::optional<bool> versionSupport; + + /** * Client supports a codeDescription property * * @since 3.16.0 */ - boost::optional<bool> codeDescriptionSupport ; + boost::optional<bool> codeDescriptionSupport ; - /** - * Whether code action supports the `data` property which is - * preserved between a `textDocument/publishDiagnostics` and - * `textDocument/codeAction` request. - * - * @since 3.16.0 - */ - boost::optional<bool> dataSupport ; + /** + * Whether code action supports the `data` property which is + * preserved between a `textDocument/publishDiagnostics` and + * `textDocument/codeAction` request. + * + * @since 3.16.0 + */ + boost::optional<bool> dataSupport ; - MAKE_SWAP_METHOD(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport,versionSupport,codeDescriptionSupport,dataSupport) + MAKE_SWAP_METHOD(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport,versionSupport,codeDescriptionSupport,dataSupport) }; MAKE_REFLECT_STRUCT(PublishDiagnosticsClientCapabilities, dynamicRegistration, relatedInformation, tagSupport, versionSupport, codeDescriptionSupport, dataSupport) struct FoldingRangeCapabilities :public DynamicRegistrationCapabilities { - // - // The maximum number of folding ranges that the client prefers to receive per document. The value serves as a - // hint, servers are free to follow the limit. - // - boost::optional<int> rangeLimit; - - // - // If set, the client signals that it only supports folding complete lines. If set, client will - // ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. - // - boost::optional<bool> lineFoldingOnly; - MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) + // + // The maximum number of folding ranges that the client prefers to receive per document. The value serves as a + // hint, servers are free to follow the limit. + // + boost::optional<int> rangeLimit; + + // + // If set, the client signals that it only supports folding complete lines. If set, client will + // ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. + // + boost::optional<bool> lineFoldingOnly; + MAKE_SWAP_METHOD(FoldingRangeCapabilities, dynamicRegistration, rangeLimit, lineFoldingOnly) }; MAKE_REFLECT_STRUCT(FoldingRangeCapabilities, dynamicRegistration, rangeLimit,lineFoldingOnly) struct SemanticHighlightingCapabilities :public DynamicRegistrationCapabilities { - // + // // The client support code action literals as a valid // response of the `textDocument/codeAction` request. // - boost::optional<bool> semanticHighlighting; + boost::optional<bool> semanticHighlighting; - MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) + MAKE_SWAP_METHOD(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) }; MAKE_REFLECT_STRUCT(SemanticHighlightingCapabilities, dynamicRegistration, semanticHighlighting) struct SemanticTokensClientCapabilitiesRequestsFull { - // - // The client will send the `textDocument/semanticTokens/full/delta` request if - // the server provides a corresponding handler. - // - bool delta = false; - MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) + // + // The client will send the `textDocument/semanticTokens/full/delta` request if + // the server provides a corresponding handler. + // + bool delta = false; + MAKE_SWAP_METHOD(SemanticTokensClientCapabilitiesRequestsFull, delta) }; MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilitiesRequestsFull, delta) struct SemanticTokensClientCapabilities : public DynamicRegistrationCapabilities { - //export TokenFormat = 'relative'; - struct lsRequests - { - // - // The client will send the `textDocument/semanticTokens/range` request - // if the server provides a corresponding handler. - // - boost::optional<std::pair< boost::optional<bool>, - boost::optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; - // - // The client will send the `textDocument/semanticTokens/full` request - // if the server provides a corresponding handler. - // - boost::optional<std::pair< boost::optional<bool>, boost::optional<lsp::Any>>> full; - MAKE_SWAP_METHOD(lsRequests, range, full) - }; - - lsRequests requests; - // - // The token types that the client supports. - // - std::vector<std::string> tokenTypes; - - // - // The token modifiers that the client supports. - // - std::vector<std::string> tokenModifiers; - // - // The formats the clients supports. - // - std::vector<std::string> formats; - // - // Whether the client supports tokens that can overlap each other. - // - boost::optional < bool >overlappingTokenSupport; - - // - // Whether the client supports tokens that can span multiple lines. - // - boost::optional < bool > multilineTokenSupport; - - MAKE_SWAP_METHOD(SemanticTokensClientCapabilities, dynamicRegistration,requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) + //export TokenFormat = 'relative'; + struct lsRequests + { + // + // The client will send the `textDocument/semanticTokens/range` request + // if the server provides a corresponding handler. + // + boost::optional<std::pair< boost::optional<bool>, + boost::optional<SemanticTokensClientCapabilitiesRequestsFull>>> range; + // + // The client will send the `textDocument/semanticTokens/full` request + // if the server provides a corresponding handler. + // + boost::optional<std::pair< boost::optional<bool>, boost::optional<lsp::Any>>> full; + MAKE_SWAP_METHOD(lsRequests, range, full) + }; + + lsRequests requests; + // + // The token types that the client supports. + // + std::vector<std::string> tokenTypes; + + // + // The token modifiers that the client supports. + // + std::vector<std::string> tokenModifiers; + // + // The formats the clients supports. + // + std::vector<std::string> formats; + // + // Whether the client supports tokens that can overlap each other. + // + boost::optional < bool >overlappingTokenSupport; + + // + // Whether the client supports tokens that can span multiple lines. + // + boost::optional < bool > multilineTokenSupport; + + MAKE_SWAP_METHOD(SemanticTokensClientCapabilities, dynamicRegistration,requests, tokenTypes, tokenModifiers, + formats, overlappingTokenSupport, multilineTokenSupport) }; MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities::lsRequests, range,full) MAKE_REFLECT_STRUCT(SemanticTokensClientCapabilities, dynamicRegistration, requests, tokenTypes, tokenModifiers, - formats, overlappingTokenSupport, multilineTokenSupport) + formats, overlappingTokenSupport, multilineTokenSupport) // Text document specific client capabilities. struct lsTextDocumentClientCapabilities { - SynchronizationCapabilities synchronization; + SynchronizationCapabilities synchronization; // Capabilities specific to the `textDocument/completion` @@ -641,10 +641,10 @@ struct lsTextDocumentClientCapabilities { boost::optional< DynamicRegistrationCapabilities > selectionRange; // - // Capabilities specific to the `textDocument/linkedEditingRange` request. - // - // @since 3.16.0 - // + // Capabilities specific to the `textDocument/linkedEditingRange` request. + // + // @since 3.16.0 + // boost::optional< DynamicRegistrationCapabilities > linkedEditingRange; // @@ -669,45 +669,45 @@ struct lsTextDocumentClientCapabilities { boost::optional< DynamicRegistrationCapabilities > moniker; MAKE_SWAP_METHOD(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange , linkedEditingRange, semanticTokens, moniker) + synchronization, + completion, + hover, + signatureHelp, + implementation, + references, + documentHighlight, + documentSymbol, + formatting, + rangeFormatting, + onTypeFormatting, + declaration, + definition, typeDefinition, implementation, + codeAction, + codeLens, + documentLink, colorProvider, + rename, publishDiagnostics, foldingRange, + semanticHighlightingCapabilities, typeHierarchyCapabilities, + callHierarchy, selectionRange , linkedEditingRange, semanticTokens, moniker) }; MAKE_REFLECT_STRUCT(lsTextDocumentClientCapabilities, - synchronization, - completion, - hover, - signatureHelp, - implementation, - references, - documentHighlight, - documentSymbol, - formatting, - rangeFormatting, - onTypeFormatting, - declaration, - definition, typeDefinition, implementation, - codeAction, - codeLens, - documentLink, colorProvider, - rename, publishDiagnostics, foldingRange, - semanticHighlightingCapabilities, typeHierarchyCapabilities, - callHierarchy, selectionRange, linkedEditingRange, semanticTokens, moniker) + synchronization, + completion, + hover, + signatureHelp, + implementation, + references, + documentHighlight, + documentSymbol, + formatting, + rangeFormatting, + onTypeFormatting, + declaration, + definition, typeDefinition, implementation, + codeAction, + codeLens, + documentLink, colorProvider, + rename, publishDiagnostics, foldingRange, + semanticHighlightingCapabilities, typeHierarchyCapabilities, + callHierarchy, selectionRange, linkedEditingRange, semanticTokens, moniker) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h index dd37a1af2ff..ee672aa1113 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/lsWorkspaceClientCapabilites.h @@ -21,90 +21,90 @@ struct lschangeAnnotationSupport { - /** - * Whether the client groups edits with equal labels into tree nodes, - * for instance all edits labelled with "Changes in Strings" would - * be a tree node. - */ - boost::optional<bool> groupsOnLabel; - MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) + /** + * Whether the client groups edits with equal labels into tree nodes, + * for instance all edits labelled with "Changes in Strings" would + * be a tree node. + */ + boost::optional<bool> groupsOnLabel; + MAKE_SWAP_METHOD(lschangeAnnotationSupport, groupsOnLabel) }; MAKE_REFLECT_STRUCT(lschangeAnnotationSupport, groupsOnLabel) struct WorkspaceEditCapabilities { - /** - * The client supports versioned document changes in `WorkspaceEdit`s - */ - boost::optional<bool> documentChanges; - - /** - * The client supports resource changes - * in `WorkspaceEdit`s. - * - * @deprecated Since LSP introduces resource operations, use {link #resourceOperations} - */ - - boost::optional<bool> resourceChanges; - - /** - * The resource operations the client supports. Clients should at least - * support 'create', 'rename' and 'delete' files and folders. - * - * @since 3.13.0 - */ - boost::optional< std::vector<std::string> > resourceOperations; - - /** - * The failure handling strategy of a client if applying the workspace edit - * fails. - * - * See {@link FailureHandlingKind} for allowed values. - */ - boost::optional<std::string > failureHandling; - - /** - * Whether the client normalizes line endings to the client specific - * setting. - * If set to `true` the client will normalize line ending characters - * in a workspace edit to the client specific new line character(s). - * - * @since 3.16.0 - */ - boost::optional<bool> normalizesLineEndings;; - - /** - * Whether the client in general supports change annotations on text edits, - * create file, rename file and delete file changes. - * - * @since 3.16.0 - */ - boost::optional<lschangeAnnotationSupport> changeAnnotationSupport; - - MAKE_SWAP_METHOD(WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) + /** + * The client supports versioned document changes in `WorkspaceEdit`s + */ + boost::optional<bool> documentChanges; + + /** + * The client supports resource changes + * in `WorkspaceEdit`s. + * + * @deprecated Since LSP introduces resource operations, use {link #resourceOperations} + */ + + boost::optional<bool> resourceChanges; + + /** + * The resource operations the client supports. Clients should at least + * support 'create', 'rename' and 'delete' files and folders. + * + * @since 3.13.0 + */ + boost::optional< std::vector<std::string> > resourceOperations; + + /** + * The failure handling strategy of a client if applying the workspace edit + * fails. + * + * See {@link FailureHandlingKind} for allowed values. + */ + boost::optional<std::string > failureHandling; + + /** + * Whether the client normalizes line endings to the client specific + * setting. + * If set to `true` the client will normalize line ending characters + * in a workspace edit to the client specific new line character(s). + * + * @since 3.16.0 + */ + boost::optional<bool> normalizesLineEndings;; + + /** + * Whether the client in general supports change annotations on text edits, + * create file, rename file and delete file changes. + * + * @since 3.16.0 + */ + boost::optional<lschangeAnnotationSupport> changeAnnotationSupport; + + MAKE_SWAP_METHOD(WorkspaceEditCapabilities, documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) }; MAKE_REFLECT_STRUCT(WorkspaceEditCapabilities,documentChanges, resourceChanges, resourceOperations, failureHandling, normalizesLineEndings, changeAnnotationSupport) struct DynamicRegistrationCapabilities { - // Did foo notification supports dynamic registration. - boost::optional<bool> dynamicRegistration; + // Did foo notification supports dynamic registration. + boost::optional<bool> dynamicRegistration; - MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, - dynamicRegistration); + MAKE_SWAP_METHOD(DynamicRegistrationCapabilities, + dynamicRegistration); }; MAKE_REFLECT_STRUCT(DynamicRegistrationCapabilities, - dynamicRegistration); + dynamicRegistration); // Workspace specific client capabilities. struct SymbolKindCapabilities { - boost::optional< std::vector<lsSymbolKind> > valueSet; + boost::optional< std::vector<lsSymbolKind> > valueSet; - MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) + MAKE_SWAP_METHOD(SymbolKindCapabilities, valueSet) }; @@ -114,66 +114,66 @@ MAKE_REFLECT_STRUCT(SymbolKindCapabilities, valueSet) struct SymbolCapabilities :public DynamicRegistrationCapabilities { - /** - * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. - */ - boost::optional<SymbolKindCapabilities> symbolKind; + /** + * Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. + */ + boost::optional<SymbolKindCapabilities> symbolKind; - MAKE_SWAP_METHOD(SymbolCapabilities, - symbolKind, dynamicRegistration) + MAKE_SWAP_METHOD(SymbolCapabilities, + symbolKind, dynamicRegistration) }; MAKE_REFLECT_STRUCT(SymbolCapabilities, - symbolKind, dynamicRegistration) + symbolKind, dynamicRegistration) struct lsFileOperations { - /** + /** * Whether the client supports dynamic registration for file * requests/notifications. */ - boost::optional<bool> dynamicRegistration ; - - /** - * The client has support for sending didCreateFiles notifications. - */ - boost::optional<bool>didCreate ; - - /** - * The client has support for sending willCreateFiles requests. - */ - boost::optional<bool>willCreate ; - - /** - * The client has support for sending didRenameFiles notifications. - */ - boost::optional<bool>didRename ; - - /** - * The client has support for sending willRenameFiles requests. - */ - boost::optional<bool>willRename ; - - /** - * The client has support for sending didDeleteFiles notifications. - */ - boost::optional<bool>didDelete ; - - /** - * The client has support for sending willDeleteFiles requests. - */ - boost::optional<bool> willDelete ; - MAKE_SWAP_METHOD(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) + boost::optional<bool> dynamicRegistration ; + + /** + * The client has support for sending didCreateFiles notifications. + */ + boost::optional<bool>didCreate ; + + /** + * The client has support for sending willCreateFiles requests. + */ + boost::optional<bool>willCreate ; + + /** + * The client has support for sending didRenameFiles notifications. + */ + boost::optional<bool>didRename ; + + /** + * The client has support for sending willRenameFiles requests. + */ + boost::optional<bool>willRename ; + + /** + * The client has support for sending didDeleteFiles notifications. + */ + boost::optional<bool>didDelete ; + + /** + * The client has support for sending willDeleteFiles requests. + */ + boost::optional<bool> willDelete ; + MAKE_SWAP_METHOD(lsFileOperations, dynamicRegistration, didCreate, willCreate, + didRename, willRename, didDelete, willDelete) }; MAKE_REFLECT_STRUCT(lsFileOperations, dynamicRegistration, didCreate, willCreate, - didRename, willRename, didDelete, willDelete) + didRename, willRename, didDelete, willDelete) struct lsWorkspaceClientCapabilites { // The client supports applying batch edits to the workspace. boost::optional<bool> applyEdit; - + // Capabilities specific to `WorkspaceEdit`s boost::optional<WorkspaceEditCapabilities> workspaceEdit; @@ -211,11 +211,11 @@ struct lsWorkspaceClientCapabilites { /** - * Capabilities specific to the semantic token requests scoped to the - * workspace. - * - * @since 3.16.0 - */ + * Capabilities specific to the semantic token requests scoped to the + * workspace. + * + * @since 3.16.0 + */ boost::optional<DynamicRegistrationCapabilities> semanticTokens ; /** @@ -232,14 +232,14 @@ struct lsWorkspaceClientCapabilites { * @since 3.16.0 */ boost::optional<lsFileOperations> fileOperations; - + MAKE_SWAP_METHOD(lsWorkspaceClientCapabilites, - applyEdit, - workspaceEdit, - didChangeConfiguration, - didChangeWatchedFiles, - symbol,executeCommand, workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) + applyEdit, + workspaceEdit, + didChangeConfiguration, + didChangeWatchedFiles, + symbol,executeCommand, workspaceFolders, + configuration, semanticTokens, codeLens, fileOperations) }; MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites, @@ -249,7 +249,7 @@ MAKE_REFLECT_STRUCT(lsWorkspaceClientCapabilites, didChangeWatchedFiles, symbol, executeCommand,workspaceFolders, - configuration, semanticTokens, codeLens, fileOperations) + configuration, semanticTokens, codeLens, fileOperations) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h index 01cb18d68df..bf70d588421 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/general/progress.h @@ -8,9 +8,9 @@ //and partial result progress to support streaming of results. struct ProgressParams { - std::pair<boost::optional<std::string> , boost::optional<int> > token; - lsp::Any value; - MAKE_SWAP_METHOD(ProgressParams, token, value) + std::pair<boost::optional<std::string> , boost::optional<int> > token; + lsp::Any value; + MAKE_SWAP_METHOD(ProgressParams, token, value) }; MAKE_REFLECT_STRUCT(ProgressParams, token, value) DEFINE_NOTIFICATION_TYPE(Notify_Progress, ProgressParams, "$/progress"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/language/language.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/language/language.h index b4c7829e95f..3f649469724 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/language/language.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/language/language.h @@ -11,27 +11,27 @@ #endif struct StatusReport { - - std::string ToString() const - { - std::string info; - info += "type:" + type + "\n"; - info += "message:" + message + "\n"; - return info; - } - /** - * The message type. See { - * - */ - - std::string type; - /** - * The actual message - * - */ - - std::string message; - MAKE_SWAP_METHOD(StatusReport, type, message); + + std::string ToString() const + { + std::string info; + info += "type:" + type + "\n"; + info += "message:" + message + "\n"; + return info; + } + /** + * The message type. See { + * + */ + + std::string type; + /** + * The actual message + * + */ + + std::string message; + MAKE_SWAP_METHOD(StatusReport, type, message); }; MAKE_REFLECT_STRUCT(StatusReport, type, message); @@ -44,25 +44,25 @@ DEFINE_NOTIFICATION_TYPE(lang_status, StatusReport, "language/status"); enum class MessageType { - /** - * An error message. - */ - Error=(1), - - /** - * A warning message. - */ - Warning=(2), - - /** - * An information message. - */ - Info=(3), - - /** - * A log message. - */ - Log=(4) + /** + * An error message. + */ + Error=(1), + + /** + * A warning message. + */ + Warning=(2), + + /** + * An information message. + */ + Info=(3), + + /** + * A log message. + */ + Log=(4) }; MAKE_REFLECT_TYPE_PROXY(MessageType); @@ -70,36 +70,36 @@ MAKE_REFLECT_TYPE_PROXY(MessageType); struct ActionableNotification { - - /** - * The message type. See { - * - */ - MessageType severity; - /** - * The actual message - * - */ + /** + * The message type. See { + * + */ + + MessageType severity; + /** + * The actual message + * + */ - std::string message; + std::string message; - /** - * Optional data - * - */ + /** + * Optional data + * + */ - boost::optional<lsp::Any> data; + boost::optional<lsp::Any> data; - /** - * Optional commands - * - */ + /** + * Optional commands + * + */ - std::vector<lsCommandWithAny> commands; + std::vector<lsCommandWithAny> commands; - MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) + MAKE_SWAP_METHOD(ActionableNotification, severity, message, data, commands) }; MAKE_REFLECT_STRUCT(ActionableNotification, severity, message, data, commands) @@ -114,27 +114,27 @@ DEFINE_NOTIFICATION_TYPE(lang_actionableNotification, ActionableNotification, "l struct ProgressReport { - std::string ToString() const; + std::string ToString() const; - std::string id; + std::string id; - std::string task; + std::string task; - std::string subTask; + std::string subTask; - std::string status; + std::string status; - int totalWork = 0; + int totalWork = 0; - int workDone = 0; + int workDone = 0; - bool complete = false; - MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); + bool complete = false; + MAKE_SWAP_METHOD(ProgressReport, id, task, subTask, status, workDone, complete); }; @@ -147,24 +147,24 @@ MAKE_REFLECT_STRUCT(ProgressReport, id, task, subTask, status, workDone, complet DEFINE_NOTIFICATION_TYPE(lang_progressReport, ProgressReport, "language/progressReport"); enum EventType { - /** - * classpath updated event. - */ - ClasspathUpdated = (100), - - /** - * projects imported event. - */ - ProjectsImported = (200) + /** + * classpath updated event. + */ + ClasspathUpdated = (100), + + /** + * projects imported event. + */ + ProjectsImported = (200) }; struct EventNotification { - int eventType; - lsp::Any data; - std::string ToString() const; - MAKE_SWAP_METHOD(EventNotification, eventType, data) + int eventType; + lsp::Any data; + std::string ToString() const; + MAKE_SWAP_METHOD(EventNotification, eventType, data) }; MAKE_REFLECT_STRUCT(EventNotification, eventType, data); -DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification");
\ No newline at end of file +DEFINE_NOTIFICATION_TYPE(lang_eventNotification, EventNotification, "language/eventNotification"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/location_type.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/location_type.h index 14e130f5719..c4197917a9e 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/location_type.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/location_type.h @@ -4,15 +4,15 @@ #include "lsRange.h" //Represents a location inside a resource, such as a line inside a text file. struct lsLocation { - lsLocation(); - lsLocation(lsDocumentUri uri, lsRange range); + lsLocation(); + lsLocation(lsDocumentUri uri, lsRange range); - bool operator==(const lsLocation& other) const; - bool operator<(const lsLocation& o) const; + bool operator==(const lsLocation& other) const; + bool operator<(const lsLocation& o) const; - lsDocumentUri uri; - lsRange range; - MAKE_SWAP_METHOD(lsLocation, uri, range) + lsDocumentUri uri; + lsRange range; + MAKE_SWAP_METHOD(lsLocation, uri, range) }; MAKE_REFLECT_STRUCT(lsLocation, uri, range) @@ -20,44 +20,44 @@ MAKE_REFLECT_STRUCT(lsLocation, uri, range) struct LinkLocation :public lsLocation { - std::string displayName; - std::string kind; - MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) + std::string displayName; + std::string kind; + MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName, kind) }; MAKE_REFLECT_STRUCT(LinkLocation, uri, range, displayName,kind) //Represents a link between a sourceand a target location. struct LocationLink { - /** - * Span of the origin of this link. - * - * Used as the underlined span for mouse interaction. Defaults to the word range at - * the mouse position. - */ - boost::optional<lsRange> originSelectionRange; + /** + * Span of the origin of this link. + * + * Used as the underlined span for mouse interaction. Defaults to the word range at + * the mouse position. + */ + boost::optional<lsRange> originSelectionRange; - /** - * The target resource identifier of this link. - */ + /** + * The target resource identifier of this link. + */ - lsDocumentUri targetUri; + lsDocumentUri targetUri; - /** - * The full target range of this link. If the target for example is a symbol then target range is the - * range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to highlight the range in the editor. - */ + /** + * The full target range of this link. If the target for example is a symbol then target range is the + * range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to highlight the range in the editor. + */ - lsRange targetRange; + lsRange targetRange; - /** - * The range that should be selected and revealed when this link is being followed, e.g the name of a function. - * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` - */ + /** + * The range that should be selected and revealed when this link is being followed, e.g the name of a function. + * Must be contained by the the `targetRange`. See also `DocumentSymbol#range` + */ - lsRange targetSelectionRange; + lsRange targetSelectionRange; - MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); + MAKE_SWAP_METHOD(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); }; -MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange);
\ No newline at end of file +MAKE_REFLECT_STRUCT(LocationLink, originSelectionRange, targetUri, targetRange, targetSelectionRange); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h index 3335aa86dc6..035382669f9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsAny.h @@ -5,75 +5,75 @@ #include "LibLsp/JsonRpc/message.h" namespace lsp { - struct Any - { - //! Type of JSON value - enum Type { - kUnKnown=-1, - kNullType = 0, //!< null - kFalseType = 1, //!< false - kTrueType = 2, //!< true - kObjectType = 3, //!< object - kArrayType = 4, //!< array - kStringType = 5, //!< string - kNumberType = 6 //!< number - }; - - - - template <typename T> - bool Get(T& value); - - template <typename T> - void Set(T& value); - - int GuessType(); - int GetType(); - - void Set(std::unique_ptr<LspMessage> value); - - void SetJsonString(std::string&& _data, Type _type); - - void SetJsonString(const std::string& _data, Type _type); - - const std::string& Data()const - { - return data; - } - - void swap(Any& arg) noexcept; - - /* - *Example for GetFromMap - struct A{ - std::string visitor; - bool verbose; - } - REFLECT_MAP_TO_STRUCT(A,visitor,verbose) - - std::string data = "{\"visitor\":\"default\",\"verbose\":\"true\"}; - lsp:Any any; - any.SetJsonString(data, static_cast<lsp::Any::Type>(-1)); - A a_object; - any.GetFromMap(a_object); - */ - template <typename T> - bool GetFromMap(T& value); - - - template <typename T> - bool GetForMapHelper(T& value); - bool GetForMapHelper(std::string& value); - bool GetForMapHelper(boost::optional<std::string>& value); - private: - std::unique_ptr<Reader> GetReader(); - std::unique_ptr<Writer> GetWriter() const; - void SetData(std::unique_ptr<Writer>&); - - std::string data; - int jsonType = kUnKnown; - - }; + struct Any + { + //! Type of JSON value + enum Type { + kUnKnown=-1, + kNullType = 0, //!< null + kFalseType = 1, //!< false + kTrueType = 2, //!< true + kObjectType = 3, //!< object + kArrayType = 4, //!< array + kStringType = 5, //!< string + kNumberType = 6 //!< number + }; + + + + template <typename T> + bool Get(T& value); + + template <typename T> + void Set(T& value); + + int GuessType(); + int GetType(); + + void Set(std::unique_ptr<LspMessage> value); + + void SetJsonString(std::string&& _data, Type _type); + + void SetJsonString(const std::string& _data, Type _type); + + const std::string& Data()const + { + return data; + } + + void swap(Any& arg) noexcept; + + /* + *Example for GetFromMap + struct A{ + std::string visitor; + bool verbose; + } + REFLECT_MAP_TO_STRUCT(A,visitor,verbose) + + std::string data = "{\"visitor\":\"default\",\"verbose\":\"true\"}; + lsp:Any any; + any.SetJsonString(data, static_cast<lsp::Any::Type>(-1)); + A a_object; + any.GetFromMap(a_object); + */ + template <typename T> + bool GetFromMap(T& value); + + + template <typename T> + bool GetForMapHelper(T& value); + bool GetForMapHelper(std::string& value); + bool GetForMapHelper(boost::optional<std::string>& value); + private: + std::unique_ptr<Reader> GetReader(); + std::unique_ptr<Writer> GetWriter() const; + void SetData(std::unique_ptr<Writer>&); + + std::string data; + int jsonType = kUnKnown; + + }; }; @@ -84,22 +84,22 @@ extern void Reflect(Writer& visitor, lsp::Any& value); template <typename T> void ReflectMember(std::map < std::string, lsp::Any>& visitor, const char* name, T& value) { - auto it = visitor.find(name); - if (it != visitor.end()) - { - it->second.GetForMapHelper(value); - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + it->second.GetForMapHelper(value); + } } template <typename T> void ReflectMember(std::map < std::string, std::string>& visitor, const char* name, T& value) { - auto it = visitor.find(name); - if (it != visitor.end()) - { - lsp::Any any; - any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); - any.Get(value); - } + auto it = visitor.find(name); + if (it != visitor.end()) + { + lsp::Any any; + any.SetJsonString(it->second, static_cast<lsp::Any::Type>(-1)); + any.Get(value); + } } #define REFLECT_MAP_TO_STRUCT(type, ...) \ @@ -111,49 +111,49 @@ void ReflectMember(std::map < std::string, std::string>& visitor, const char* na namespace lsp { - template <typename T> - bool Any::Get(T& value) - { - const auto visitor = GetReader(); - Reflect(*visitor, value); - return true; - } - - template <typename T> - void Any::Set(T& value) - { - auto visitor = GetWriter(); - Reflect(*visitor, value); - SetData(visitor); - } - - template <typename T> - bool Any::GetFromMap(T& value) - { - const auto visitor = GetReader(); - std::map < std::string, lsp::Any> _temp; - Reflect(*visitor, _temp); - ReflectMap(_temp, value); - return true; - } - - template <typename T> - bool Any::GetForMapHelper(T& value) - { - jsonType = GetType(); - if (jsonType == kStringType) - { - auto copy = data; - copy.erase(copy.find_last_not_of('"') + 1); - copy.erase(0, copy.find_first_not_of('"')); - lsp::Any any; - any.SetJsonString(copy, kUnKnown); - any.Get(value); - } - else - { - Get(value); - } - return true; - } + template <typename T> + bool Any::Get(T& value) + { + const auto visitor = GetReader(); + Reflect(*visitor, value); + return true; + } + + template <typename T> + void Any::Set(T& value) + { + auto visitor = GetWriter(); + Reflect(*visitor, value); + SetData(visitor); + } + + template <typename T> + bool Any::GetFromMap(T& value) + { + const auto visitor = GetReader(); + std::map < std::string, lsp::Any> _temp; + Reflect(*visitor, _temp); + ReflectMap(_temp, value); + return true; + } + + template <typename T> + bool Any::GetForMapHelper(T& value) + { + jsonType = GetType(); + if (jsonType == kStringType) + { + auto copy = data; + copy.erase(copy.find_last_not_of('"') + 1); + copy.erase(0, copy.find_first_not_of('"')); + lsp::Any any; + any.SetJsonString(copy, kUnKnown); + any.Get(value); + } + else + { + Get(value); + } + return true; + } } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h index 06a14f15405..cf0a2aa65b7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCodeAction.h @@ -13,46 +13,46 @@ struct CodeAction { - /** - * A short, human-readable, title for this code action. - */ - - std::string title; - - /** - * The kind of the code action. - * - * Used to filter code actions. - */ - boost::optional < std::string> kind; - - /** - * The diagnostics that this code action resolves. - */ - boost::optional < std::vector<lsDiagnostic>> diagnostics; - - /** - * The workspace edit this code action performs. - */ - boost::optional < lsWorkspaceEdit >edit; - - /** - * A command this code action executes. If a code action - * provides a edit and a command, first the edit is - * executed and then the command. - */ - boost::optional< lsCommandWithAny > command; - - MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) + /** + * A short, human-readable, title for this code action. + */ + + std::string title; + + /** + * The kind of the code action. + * + * Used to filter code actions. + */ + boost::optional < std::string> kind; + + /** + * The diagnostics that this code action resolves. + */ + boost::optional < std::vector<lsDiagnostic>> diagnostics; + + /** + * The workspace edit this code action performs. + */ + boost::optional < lsWorkspaceEdit >edit; + + /** + * A command this code action executes. If a code action + * provides a edit and a command, first the edit is + * executed and then the command. + */ + boost::optional< lsCommandWithAny > command; + + MAKE_SWAP_METHOD(CodeAction, title, kind, diagnostics, edit, command) }; MAKE_REFLECT_STRUCT(CodeAction, title, kind, diagnostics, edit, command) struct TextDocumentCodeAction { - typedef std::pair<boost::optional<lsCommandWithAny>, boost::optional<CodeAction> > Either; + typedef std::pair<boost::optional<lsCommandWithAny>, boost::optional<CodeAction> > Either; }; -extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value);
\ No newline at end of file +extern void Reflect(Reader& visitor, TextDocumentCodeAction::Either& value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h index 94307f1479f..88ced6e41c1 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsCommand.h @@ -15,29 +15,29 @@ //extension code could handle the command.The protocol currently doesn¡¯t specify a set of well - known commands. template <typename AnyArray> struct lsCommand { - // Title of the command (ie, 'save') - std::string title; - // Actual command identifier. - std::string command; - // Arguments to run the command with. - // **NOTE** This must be serialized as an array. Use - // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. - boost::optional<AnyArray> arguments; + // Title of the command (ie, 'save') + std::string title; + // Actual command identifier. + std::string command; + // Arguments to run the command with. + // **NOTE** This must be serialized as an array. Use + // MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY. + boost::optional<AnyArray> arguments; - void swap(lsCommand<AnyArray>& arg) noexcept - { - title.swap(arg.title); - command.swap(arg.command); - arguments.swap(arg.arguments); - } + void swap(lsCommand<AnyArray>& arg) noexcept + { + title.swap(arg.title); + command.swap(arg.command); + arguments.swap(arg.arguments); + } }; template <typename TVisitor, typename T> void Reflect(TVisitor& visitor, lsCommand<T>& value) { - REFLECT_MEMBER_START(); - REFLECT_MEMBER(title); - REFLECT_MEMBER(command); - REFLECT_MEMBER(arguments); - REFLECT_MEMBER_END(); + REFLECT_MEMBER_START(); + REFLECT_MEMBER(title); + REFLECT_MEMBER(command); + REFLECT_MEMBER(arguments); + REFLECT_MEMBER_END(); } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h index 5d24f59e3a3..255c4c39bac 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsDocumentUri.h @@ -2,24 +2,24 @@ #include "LibLsp/JsonRpc/serializer.h" #include <string> struct lsDocumentUri { - static lsDocumentUri FromPath(const AbsolutePath& path); + static lsDocumentUri FromPath(const AbsolutePath& path); - lsDocumentUri(); - - lsDocumentUri(const AbsolutePath& path); - lsDocumentUri(const lsDocumentUri& other);; - bool operator==(const lsDocumentUri& other) const; - bool operator==(const std::string& other) const; - void SetPath(const AbsolutePath& path); - std::string GetRawPath() const; - AbsolutePath GetAbsolutePath() const; + lsDocumentUri(); - - std::string raw_uri_; - void swap(lsDocumentUri& arg) noexcept - { - raw_uri_.swap(arg.raw_uri_); - } + lsDocumentUri(const AbsolutePath& path); + lsDocumentUri(const lsDocumentUri& other);; + bool operator==(const lsDocumentUri& other) const; + bool operator==(const std::string& other) const; + void SetPath(const AbsolutePath& path); + std::string GetRawPath() const; + AbsolutePath GetAbsolutePath() const; + + + std::string raw_uri_; + void swap(lsDocumentUri& arg) noexcept + { + raw_uri_.swap(arg.raw_uri_); + } }; extern void Reflect(Writer& visitor, lsDocumentUri& value); extern void Reflect(Reader& visitor, lsDocumentUri& value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h index a92df9b0772..cc3ad4bbac1 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsFormattingOptions.h @@ -3,41 +3,41 @@ #include "LibLsp/JsonRpc/serializer.h" struct lsFormattingOptions { - struct KeyData { - boost::optional<bool> _boolean; - boost::optional<int32_t> _integer; - boost::optional<std::string> _string; - }; + struct KeyData { + boost::optional<bool> _boolean; + boost::optional<int32_t> _integer; + boost::optional<std::string> _string; + }; - // Size of a tab in spaces. - int tabSize =4; - // Prefer spaces over tabs. - bool insertSpaces = true; + // Size of a tab in spaces. + int tabSize =4; + // Prefer spaces over tabs. + bool insertSpaces = true; - /** - * Trim trailing whitespace on a line. - * - * @since 3.15.0 - */ - boost::optional<bool> trimTrailingWhitespace; + /** + * Trim trailing whitespace on a line. + * + * @since 3.15.0 + */ + boost::optional<bool> trimTrailingWhitespace; - /** - * Insert a newline character at the end of the file if one does not exist. - * - * @since 3.15.0 - */ - boost::optional<bool> insertFinalNewline; + /** + * Insert a newline character at the end of the file if one does not exist. + * + * @since 3.15.0 + */ + boost::optional<bool> insertFinalNewline; - /** - * Trim all newlines after the final newline at the end of the file. - * - * @since 3.15.0 - */ - boost::optional<bool> trimFinalNewlines; - boost::optional<KeyData> key; + /** + * Trim all newlines after the final newline at the end of the file. + * + * @since 3.15.0 + */ + boost::optional<bool> trimFinalNewlines; + boost::optional<KeyData> key; MAKE_SWAP_METHOD(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key) }; MAKE_REFLECT_STRUCT(lsFormattingOptions, tabSize, insertSpaces, trimTrailingWhitespace, insertFinalNewline, trimFinalNewlines, key); extern void Reflect(Reader& visitor, lsFormattingOptions::KeyData& value); -extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value);
\ No newline at end of file +extern void Reflect(Writer& visitor, lsFormattingOptions::KeyData& value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h index 9191aa66d14..975ee4fed0e 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsMarkedString.h @@ -20,24 +20,24 @@ // Note that markdown strings will be sanitized - that means html will be // escaped. struct lsMarkedString { - boost::optional<std::string> language; - std::string value; + boost::optional<std::string> language; + std::string value; }; struct MarkupContent { - /** - * The type of the Markup. - */ + /** + * The type of the Markup. + */ - std::string kind; + std::string kind; - /** - * The content itself. - */ - - std::string value; + /** + * The content itself. + */ - MAKE_SWAP_METHOD(MarkupContent, kind, value); + std::string value; + + MAKE_SWAP_METHOD(MarkupContent, kind, value); }; MAKE_REFLECT_STRUCT(MarkupContent,kind,value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h index 8c2106e16e1..a14d75ed909 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsPosition.h @@ -11,30 +11,30 @@ //A position is between two characters like an ¡®insert¡¯ cursor in a editor.Special values like //for example - 1 to denote the end of a line are not supported. struct lsPosition { - lsPosition(); - lsPosition(int line, int character); - - bool operator==(const lsPosition& other) const; - bool operator<(const lsPosition& other) const; - - std::string ToString() const; - - /** - * Line position in a document (zero-based). - */ - // Note: these are 0-based. - unsigned line = 0; - /** - * Character offset on a line in a document (zero-based). Assuming that - * the line is represented as a string, the `character` value represents - * the gap between the `character` and `character + 1`. - * - * If the character value is greater than the line length it defaults back - * to the line length. - */ - unsigned character = 0; - static const lsPosition kZeroPosition; - - MAKE_SWAP_METHOD(lsPosition, line, character) + lsPosition(); + lsPosition(int line, int character); + + bool operator==(const lsPosition& other) const; + bool operator<(const lsPosition& other) const; + + std::string ToString() const; + + /** + * Line position in a document (zero-based). + */ + // Note: these are 0-based. + unsigned line = 0; + /** + * Character offset on a line in a document (zero-based). Assuming that + * the line is represented as a string, the `character` value represents + * the gap between the `character` and `character + 1`. + * + * If the character value is greater than the line length it defaults back + * to the line length. + */ + unsigned character = 0; + static const lsPosition kZeroPosition; + + MAKE_SWAP_METHOD(lsPosition, line, character) }; -MAKE_REFLECT_STRUCT(lsPosition, line, character);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsPosition, line, character); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h index 6cc01e37a73..97d78712d73 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsRange.h @@ -12,21 +12,21 @@ //If you want to specify a range that contains a line including the line ending character(s) //then use an end position denoting the start of the next line. struct lsRange { - lsRange(); - lsRange(lsPosition start, lsPosition end); + lsRange(); + lsRange(lsPosition start, lsPosition end); - bool operator==(const lsRange& other) const; - bool operator<(const lsRange& other) const; - /** - * The range's start position. - */ - lsPosition start; - /** - * The range's end position. - */ - lsPosition end; - std::string ToString()const; - MAKE_SWAP_METHOD(lsRange, start, end) + bool operator==(const lsRange& other) const; + bool operator<(const lsRange& other) const; + /** + * The range's start position. + */ + lsPosition start; + /** + * The range's end position. + */ + lsPosition end; + std::string ToString()const; + MAKE_SWAP_METHOD(lsRange, start, end) }; -MAKE_REFLECT_STRUCT(lsRange, start, end)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsRange, start, end) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h index 6146d6188f6..9b0120e3e46 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsResponseError.h @@ -5,113 +5,113 @@ #include "LibLsp/lsp/lsAny.h" enum class lsErrorCodes:int32_t { - // Defined by JSON RPC - ParseError = -32700, - InvalidRequest = -32600, - MethodNotFound = -32601, - InvalidParams = -32602, - InternalError = -32603, - - /** - * This is the start range of JSON RPC reserved error codes. - * It doesn't denote a real error code. No LSP error codes should - * be defined between the start and end range. For backwards - * compatibility the `ServerNotInitialized` and the `UnknownErrorCode` - * are left in the range. - * - * @since 3.16.0 - */ - jsonrpcReservedErrorRangeStart = -32099, - /** @deprecated use jsonrpcReservedErrorRangeStart */ - serverErrorStart = jsonrpcReservedErrorRangeStart, - - /** - * This is the start range of JSON RPC reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - jsonrpcReservedErrorRangeEnd = -32000, - /** @deprecated use jsonrpcReservedErrorRangeEnd */ - serverErrorEnd = jsonrpcReservedErrorRangeEnd, - - /** - * Error code indicating that a server received a notification or - * request before the server has received the `initialize` request. - */ - ServerNotInitialized = -32002, - UnknownErrorCode = -32001, - - /** - * This is the start range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - lspReservedErrorRangeStart= -32899, - - /** - * The server cancelled the request. This error code should - * only be used for requests that explicitly support being - * server cancellable. - * - * @since 3.17.0 - */ - ServerCancelled = -32802, - - /** - * The server detected that the content of a document got - * modified outside normal conditions. A server should - * NOT send this error code if it detects a content change - * in it unprocessed messages. The result even computed - * on an older state might still be useful for the client. - * - * If a client decides that a result is not of any use anymore - * the client should cancel the request. - */ - ContentModified = -32801, - - /** - * The client has canceled a request and a server as detected - * the cancel. - */ - RequestCancelled = -32800, - - /** - * This is the end range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - lspReservedErrorRangeEnd = -32800, - - + // Defined by JSON RPC + ParseError = -32700, + InvalidRequest = -32600, + MethodNotFound = -32601, + InvalidParams = -32602, + InternalError = -32603, + + /** + * This is the start range of JSON RPC reserved error codes. + * It doesn't denote a real error code. No LSP error codes should + * be defined between the start and end range. For backwards + * compatibility the `ServerNotInitialized` and the `UnknownErrorCode` + * are left in the range. + * + * @since 3.16.0 + */ + jsonrpcReservedErrorRangeStart = -32099, + /** @deprecated use jsonrpcReservedErrorRangeStart */ + serverErrorStart = jsonrpcReservedErrorRangeStart, + + /** + * This is the start range of JSON RPC reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + jsonrpcReservedErrorRangeEnd = -32000, + /** @deprecated use jsonrpcReservedErrorRangeEnd */ + serverErrorEnd = jsonrpcReservedErrorRangeEnd, + + /** + * Error code indicating that a server received a notification or + * request before the server has received the `initialize` request. + */ + ServerNotInitialized = -32002, + UnknownErrorCode = -32001, + + /** + * This is the start range of LSP reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + lspReservedErrorRangeStart= -32899, + + /** + * The server cancelled the request. This error code should + * only be used for requests that explicitly support being + * server cancellable. + * + * @since 3.17.0 + */ + ServerCancelled = -32802, + + /** + * The server detected that the content of a document got + * modified outside normal conditions. A server should + * NOT send this error code if it detects a content change + * in it unprocessed messages. The result even computed + * on an older state might still be useful for the client. + * + * If a client decides that a result is not of any use anymore + * the client should cancel the request. + */ + ContentModified = -32801, + + /** + * The client has canceled a request and a server as detected + * the cancel. + */ + RequestCancelled = -32800, + + /** + * This is the end range of LSP reserved error codes. + * It doesn't denote a real error code. + * + * @since 3.16.0 + */ + lspReservedErrorRangeEnd = -32800, + + }; MAKE_REFLECT_TYPE_PROXY(lsErrorCodes); struct lsResponseError { - lsResponseError(): code(lsErrorCodes::UnknownErrorCode) - { - } - - /** - * A number indicating the error type that occurred. - */ - lsErrorCodes code; - // Short description. - /** - * A string providing a short description of the error. - */ - std::string message; - - /** - * A primitive or structured value that contains additional - * information about the error. Can be omitted. - */ - boost::optional<lsp::Any> data; - std::string ToString(); - void Write(Writer& visitor); - - MAKE_SWAP_METHOD(lsResponseError, code, message, data) + lsResponseError(): code(lsErrorCodes::UnknownErrorCode) + { + } + + /** + * A number indicating the error type that occurred. + */ + lsErrorCodes code; + // Short description. + /** + * A string providing a short description of the error. + */ + std::string message; + + /** + * A primitive or structured value that contains additional + * information about the error. Can be omitted. + */ + boost::optional<lsp::Any> data; + std::string ToString(); + void Write(Writer& visitor); + + MAKE_SWAP_METHOD(lsResponseError, code, message, data) }; -MAKE_REFLECT_STRUCT(lsResponseError, code, message, data)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsResponseError, code, message, data) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h index 0bab8bc3d8d..bebbcd48c2a 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentEdit.h @@ -8,17 +8,17 @@ struct lsTextDocumentEdit { - // The text document to change. - lsVersionedTextDocumentIdentifier textDocument; - - /** - * The edits to be applied. - * - * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the - * client capability `workspace.workspaceEdit.changeAnnotationSupport` - */ - // The edits to be applied. - std::vector< lsAnnotatedTextEdit > edits; - MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); + // The text document to change. + lsVersionedTextDocumentIdentifier textDocument; + + /** + * The edits to be applied. + * + * @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the + * client capability `workspace.workspaceEdit.changeAnnotationSupport` + */ + // The edits to be applied. + std::vector< lsAnnotatedTextEdit > edits; + MAKE_SWAP_METHOD(lsTextDocumentEdit, textDocument, edits); }; -MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentEdit, textDocument, edits); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h index bb316eae5a4..0129df9b99e 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentIdentifier.h @@ -5,10 +5,10 @@ //Text documents are identified using a URI.On the protocol level, //URIs are passed as strings.The corresponding JSON structure looks like this: struct lsTextDocumentIdentifier { - /** - * The text document's URI. - */ - lsDocumentUri uri; + /** + * The text document's URI. + */ + lsDocumentUri uri; MAKE_SWAP_METHOD(lsTextDocumentIdentifier, uri) }; -MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentIdentifier, uri) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h index 4d9b4ccc9f7..c5bc915132c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentItem.h @@ -7,20 +7,20 @@ //An item to transfer a text document from the client to the server. struct lsTextDocumentItem { - // The text document's URI. - lsDocumentUri uri; + // The text document's URI. + lsDocumentUri uri; - // The text document's language identifier. - std::string languageId; + // The text document's language identifier. + std::string languageId; - // The version number of this document (it will strictly increase after each - // change, including undo/redo). - int version = 0; + // The version number of this document (it will strictly increase after each + // change, including undo/redo). + int version = 0; - // The content of the opened text document. - std::string text; + // The content of the opened text document. + std::string text; - MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) + MAKE_SWAP_METHOD(lsTextDocumentItem, uri, languageId, version, text) }; -MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text)
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsTextDocumentItem, uri, languageId, version, text) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h index 52d291351e7..6f0940c0b2f 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextDocumentPositionParams.h @@ -9,18 +9,18 @@ * A parameter literal used in requests to pass a text document and a position inside that document. */ struct lsTextDocumentPositionParams { - // The text document. - lsTextDocumentIdentifier textDocument; + // The text document. + lsTextDocumentIdentifier textDocument; - // The position inside the text document. - lsPosition position; + // The position inside the text document. + lsPosition position; + + /** + * Legacy property to support protocol version 1.0 requests. + */ + boost::optional<lsDocumentUri> uri; - /** - * Legacy property to support protocol version 1.0 requests. - */ - boost::optional<lsDocumentUri> uri; - MAKE_SWAP_METHOD(lsTextDocumentPositionParams, textDocument, position, uri); - + }; MAKE_REFLECT_STRUCT(lsTextDocumentPositionParams, textDocument, position, uri); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h index 8785e0dcbc3..de06e85e929 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsTextEdit.h @@ -17,24 +17,24 @@ */ struct lsChangeAnnotation { - /** - * A human-readable string describing the actual change. The string - * is rendered prominent in the user interface. - */ - std::string label; - - /** - * A flag which indicates that user confirmation is needed - * before applying the change. - */ - boost::optional<bool> needsConfirmation; - - /** - * A human-readable string which is rendered less prominent in - * the user interface. - */ - boost::optional < std::string > description; - MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) + /** + * A human-readable string describing the actual change. The string + * is rendered prominent in the user interface. + */ + std::string label; + + /** + * A flag which indicates that user confirmation is needed + * before applying the change. + */ + boost::optional<bool> needsConfirmation; + + /** + * A human-readable string which is rendered less prominent in + * the user interface. + */ + boost::optional < std::string > description; + MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) }; MAKE_REFLECT_STRUCT(lsChangeAnnotation, label, needsConfirmation, description) @@ -64,23 +64,23 @@ using lsChangeAnnotationIdentifier = std::string; //A textual edit applicable to a text document. struct lsTextEdit { - // The range of the text document to be manipulated. To insert - // text into a document create a range where start === end. - lsRange range; + // The range of the text document to be manipulated. To insert + // text into a document create a range where start === end. + lsRange range; - // The string to be inserted. For delete operations use an - // empty string. - std::string newText; + // The string to be inserted. For delete operations use an + // empty string. + std::string newText; - /** + /** * The actual annotation identifier. */ - boost::optional<lsChangeAnnotationIdentifier> annotationId; - + boost::optional<lsChangeAnnotationIdentifier> annotationId; - bool operator==(const lsTextEdit& that); - std::string ToString() const; - MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) + + bool operator==(const lsTextEdit& that); + std::string ToString() const; + MAKE_SWAP_METHOD(lsTextEdit, range, newText, annotationId) }; MAKE_REFLECT_STRUCT(lsTextEdit, range, newText, annotationId) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h index 8a858053b14..7e8ccbd635c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsVersionedTextDocumentIdentifier.h @@ -8,13 +8,13 @@ struct lsVersionedTextDocumentIdentifier { - lsDocumentUri uri; - // The version number of this document. number | null - boost::optional<int> version; + lsDocumentUri uri; + // The version number of this document. number | null + boost::optional<int> version; - lsTextDocumentIdentifier AsTextDocumentIdentifier() const; + lsTextDocumentIdentifier AsTextDocumentIdentifier() const; - MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) + MAKE_SWAP_METHOD(lsVersionedTextDocumentIdentifier, uri, version) }; MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) @@ -29,4 +29,4 @@ MAKE_REFLECT_STRUCT(lsVersionedTextDocumentIdentifier, uri, version) * The version number of a document will increase after each change, * including undo/redo. The number doesn't need to be consecutive. */ -using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier;
\ No newline at end of file +using lsOptionalVersionedTextDocumentIdentifier = lsVersionedTextDocumentIdentifier; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h index c7fb73930a3..4df020d7a23 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsWorkspaceEdit.h @@ -20,36 +20,36 @@ struct lsChangeAnnotations { - lsChangeAnnotation id; - MAKE_SWAP_METHOD(lsChangeAnnotations, id) + lsChangeAnnotation id; + MAKE_SWAP_METHOD(lsChangeAnnotations, id) }; MAKE_REFLECT_STRUCT(lsChangeAnnotations, id) struct lsWorkspaceEdit { - // Holds changes to existing resources. - // changes ? : { [uri:string]: TextEdit[]; }; - // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; - - // An array of `TextDocumentEdit`s to express changes to specific a specific - // version of a text document. Whether a client supports versioned document - // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. - // - boost::optional< std::map<std::string, std::vector<lsTextEdit> > > changes; - typedef std::pair < boost::optional<lsTextDocumentEdit>, boost::optional<lsp::Any> > Either; - - boost::optional < std::vector< Either > > documentChanges; - /** - * A map of change annotations that can be referenced in - * `AnnotatedTextEdit`s or create, rename and delete file / folder - * operations. - * - * Whether clients honor this property depends on the client capability - * `workspace.changeAnnotationSupport`. - * - * @since 3.16.0 - */ - boost::optional< lsChangeAnnotations > changeAnnotations; - - MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) + // Holds changes to existing resources. + // changes ? : { [uri:string]: TextEdit[]; }; + // std::unordered_map<lsDocumentUri, std::vector<lsTextEdit>> changes; + + // An array of `TextDocumentEdit`s to express changes to specific a specific + // version of a text document. Whether a client supports versioned document + // edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. + // + boost::optional< std::map<std::string, std::vector<lsTextEdit> > > changes; + typedef std::pair < boost::optional<lsTextDocumentEdit>, boost::optional<lsp::Any> > Either; + + boost::optional < std::vector< Either > > documentChanges; + /** + * A map of change annotations that can be referenced in + * `AnnotatedTextEdit`s or create, rename and delete file / folder + * operations. + * + * Whether clients honor this property depends on the client capability + * `workspace.changeAnnotationSupport`. + * + * @since 3.16.0 + */ + boost::optional< lsChangeAnnotations > changeAnnotations; + + MAKE_SWAP_METHOD(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) }; MAKE_REFLECT_STRUCT(lsWorkspaceEdit, changes, documentChanges, changeAnnotations) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h index 37acc6ca61a..2d5c7111fb7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_code_action.h @@ -13,18 +13,18 @@ struct CommandArgs { }; MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY(CommandArgs, textDocumentUri, edits); inline void Reflect(Reader& visitor, CommandArgs& value) { - int i = 0; - visitor.IterArray([&](Reader& visitor) { - switch (i++) { - case 0: - Reflect(visitor, value.textDocumentUri); - break; - case 1: - Reflect(visitor, value.edits); - break; + int i = 0; + visitor.IterArray([&](Reader& visitor) { + switch (i++) { + case 0: + Reflect(visitor, value.textDocumentUri); + break; + case 1: + Reflect(visitor, value.edits); + break; - } - }); + } + }); } // codeLens diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h index 250699a44ab..d434b31d130 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_completion.h @@ -57,8 +57,8 @@ MAKE_REFLECT_TYPE_PROXY(lsInsertTextFormat); namespace lsp { - std::string ToString(lsCompletionItemKind); - std::string ToString(lsInsertTextFormat); + std::string ToString(lsCompletionItemKind); + std::string ToString(lsInsertTextFormat); } /** * The Completion request is sent from the client to the server to compute completion items at a given cursor position. @@ -67,7 +67,7 @@ namespace lsp * completion item is selected in the user class. */ struct lsCompletionItem { - + // The label of this completion item. By default // also the text that is inserted when selecting // this completion. @@ -89,11 +89,11 @@ struct lsCompletionItem { * Indicates if this item is deprecated. */ boost::optional< bool >deprecated; - + /** * Select this item when showing. - * + * * *Note* that only one completion item can be selected and that the * tool / client decides which item that is. The rule is that the *first * item of those that match best is selected. @@ -177,18 +177,18 @@ struct lsCompletionItem { boost::optional<lsp::Any> data; std::string ToString(); MAKE_SWAP_METHOD(lsCompletionItem, - label, - kind, - detail, - documentation, - sortText, - insertText, - filterText, - insertTextFormat, - textEdit, - deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); - + label, + kind, + detail, + documentation, + sortText, + insertText, + filterText, + insertTextFormat, + textEdit, + deprecated, preselect, additionalTextEdits, commitCharacters, + command, data); + }; @@ -204,21 +204,21 @@ MAKE_REFLECT_STRUCT(lsCompletionItem, insertTextFormat, textEdit, deprecated, preselect, additionalTextEdits, commitCharacters, - command, data); + command, data); struct CompletionList { - // This list it not complete. Further typing should result in recomputing - // this list. - bool isIncomplete = false; - // The completion items. - std::vector<lsCompletionItem> items; - - void swap(CompletionList& arg) noexcept - { - items.swap(arg.items); - std::swap(isIncomplete, arg.isIncomplete); - } + // This list it not complete. Further typing should result in recomputing + // this list. + bool isIncomplete = false; + // The completion items. + std::vector<lsCompletionItem> items; + + void swap(CompletionList& arg) noexcept + { + items.swap(arg.items); + std::swap(isIncomplete, arg.isIncomplete); + } }; -MAKE_REFLECT_STRUCT(CompletionList, isIncomplete, items);
\ No newline at end of file +MAKE_REFLECT_STRUCT(CompletionList, isIncomplete, items); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h index d1b1d1ba784..3ddea4b9ee9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/lsp_diagnostic.h @@ -28,20 +28,20 @@ MAKE_REFLECT_TYPE_PROXY(lsDiagnosticSeverity); */ enum class DiagnosticTag :uint8_t { - /** - * Unused or unnecessary code. - * - * Clients are allowed to render diagnostics with this tag faded out instead of having - * an error squiggle. - */ - Unnecessary=(1), - - /** - * Deprecated or obsolete code. - * - * Clients are allowed to rendered diagnostics with this tag strike through. - */ - Deprecated=(2), + /** + * Unused or unnecessary code. + * + * Clients are allowed to render diagnostics with this tag faded out instead of having + * an error squiggle. + */ + Unnecessary=(1), + + /** + * Deprecated or obsolete code. + * + * Clients are allowed to rendered diagnostics with this tag strike through. + */ + Deprecated=(2), }; MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); @@ -56,19 +56,19 @@ MAKE_REFLECT_TYPE_PROXY(DiagnosticTag); */ struct DiagnosticRelatedInformation { - /** - * The location of this related diagnostic information. - */ + /** + * The location of this related diagnostic information. + */ lsLocation location; - /** - * The message of this related diagnostic information. - */ + /** + * The message of this related diagnostic information. + */ - std::string message; + std::string message; - MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) + MAKE_SWAP_METHOD(DiagnosticRelatedInformation, location, message) }; MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) /** @@ -77,11 +77,11 @@ MAKE_REFLECT_STRUCT(DiagnosticRelatedInformation, location, message) * @since 3.16.0 */ struct DiagnosticCodeDescription { - /** - * An URI to open with more information about the diagnostic error. - */ - std::string href; - MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) + /** + * An URI to open with more information about the diagnostic error. + */ + std::string href; + MAKE_SWAP_METHOD(DiagnosticCodeDescription, href) }; MAKE_REFLECT_STRUCT(DiagnosticCodeDescription, href) @@ -114,7 +114,7 @@ struct lsDiagnostic { * @since 3.15.0 */ boost::optional<std::vector<DiagnosticTag>> tags; - + /** * An array of related diagnostic information, e.g. when symbol-names within a scope collide @@ -142,8 +142,8 @@ MAKE_REFLECT_STRUCT(lsDiagnostic, range, severity, code, codeDescription, source struct Rsp_Error : ResponseError<lsResponseError, Rsp_Error> { - - MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) + + MAKE_SWAP_METHOD(Rsp_Error, jsonrpc, id, error) }; MAKE_REFLECT_STRUCT(Rsp_Error, jsonrpc, id, error) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/out_list.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/out_list.h index 36c4aa78ba1..60f8ba3c7f7 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/out_list.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/out_list.h @@ -15,8 +15,8 @@ namespace LocationListEither{ - typedef std::pair< boost::optional<std::vector<lsLocation>> , boost::optional<std::vector<LocationLink> > > Either; - + typedef std::pair< boost::optional<std::vector<lsLocation>> , boost::optional<std::vector<LocationLink> > > Either; + }; extern void Reflect(Reader& visitor, LocationListEither::Either& value); //DEFINE_RESPONCE_TYPE(Rsp_LocationListEither, LocationListEither::Either); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/symbol.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/symbol.h index 57298b8d7f9..87ebfe89ed8 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/symbol.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/symbol.h @@ -3,45 +3,45 @@ enum class lsSymbolKind : uint8_t { - Unknown = 0, - - File = 1, - Module = 2, - Namespace = 3, - Package = 4, - Class = 5, - Method = 6, - Property = 7, - Field = 8, - Constructor = 9, - Enum = 10, - Interface = 11, - Function = 12, - Variable = 13, - Constant = 14, - String = 15, - Number = 16, - Boolean = 17, - Array = 18, - Object = 19, - Key = 20, - Null = 21, - EnumMember = 22, - Struct = 23, - Event = 24, - Operator = 25, - - // For C++, this is interpreted as "template parameter" (including - // non-type template parameters). - TypeParameter = 26, - - // cquery extensions - // See also https://github.com/Microsoft/language-server-protocol/issues/344 - // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind - TypeAlias = 252, - Parameter = 253, - StaticMethod = 254, - Macro = 255, + Unknown = 0, + + File = 1, + Module = 2, + Namespace = 3, + Package = 4, + Class = 5, + Method = 6, + Property = 7, + Field = 8, + Constructor = 9, + Enum = 10, + Interface = 11, + Function = 12, + Variable = 13, + Constant = 14, + String = 15, + Number = 16, + Boolean = 17, + Array = 18, + Object = 19, + Key = 20, + Null = 21, + EnumMember = 22, + Struct = 23, + Event = 24, + Operator = 25, + + // For C++, this is interpreted as "template parameter" (including + // non-type template parameters). + TypeParameter = 26, + + // cquery extensions + // See also https://github.com/Microsoft/language-server-protocol/issues/344 + // for new SymbolKind clang/Index/IndexSymbol.h clang::index::SymbolKind + TypeAlias = 252, + Parameter = 253, + StaticMethod = 254, + Macro = 255, }; MAKE_REFLECT_TYPE_PROXY(lsSymbolKind); @@ -113,52 +113,52 @@ MAKE_REFLECT_STRUCT(lsSymbolInformation, name, kind, deprecated, location, conta struct lsDocumentSymbol { - /** - * The name of this symbol. - */ - - std::string name; - - /** - * The kind of this symbol. - */ - - lsSymbolKind kind = lsSymbolKind::Unknown; - - /** - * The range enclosing this symbol not including leading/trailing whitespace but everything else - * like comments. This information is typically used to determine if the clients cursor is - * inside the symbol to reveal in the symbol in the UI. - */ - - lsRange range; - - /** - * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. - * Must be contained by the `range`. - */ - - lsRange selectionRange; - - /** - * More detail for this symbol, e.g the signature of a function. If not provided the - * name is used. - */ - boost::optional< std::string > detail; - - /** - * Indicates if this symbol is deprecated. - */ - boost::optional< bool > deprecated; - - /** - * Children of this symbol, e.g. properties of a class. - */ - boost::optional < std::vector<lsDocumentSymbol> > children; - - //internal use - int flags=0; - - MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); + /** + * The name of this symbol. + */ + + std::string name; + + /** + * The kind of this symbol. + */ + + lsSymbolKind kind = lsSymbolKind::Unknown; + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + + lsRange range; + + /** + * The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. + * Must be contained by the `range`. + */ + + lsRange selectionRange; + + /** + * More detail for this symbol, e.g the signature of a function. If not provided the + * name is used. + */ + boost::optional< std::string > detail; + + /** + * Indicates if this symbol is deprecated. + */ + boost::optional< bool > deprecated; + + /** + * Children of this symbol, e.g. properties of a class. + */ + boost::optional < std::vector<lsDocumentSymbol> > children; + + //internal use + int flags=0; + + MAKE_SWAP_METHOD(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); }; -MAKE_REFLECT_STRUCT(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags);
\ No newline at end of file +MAKE_REFLECT_STRUCT(lsDocumentSymbol, name, kind, range, selectionRange, detail, deprecated, children, flags); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h index 612d186f6fb..7f5978ff84f 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/SemanticTokens.h @@ -4,115 +4,115 @@ #include "LibLsp/lsp/lsVersionedTextDocumentIdentifier.h" #include "LibLsp/JsonRpc/RequestInMessage.h" enum class HighlightingKind_clangD { - Variable = 0, - LocalVariable, - Parameter, - Function, - Method, - StaticMethod, - Field, - StaticField, - Class, - Interface, - Enum, - EnumConstant, - Typedef, - Type, - Unknown, - Namespace, - TemplateParameter, - Concept, - Primitive, - Macro, + Variable = 0, + LocalVariable, + Parameter, + Function, + Method, + StaticMethod, + Field, + StaticField, + Class, + Interface, + Enum, + EnumConstant, + Typedef, + Type, + Unknown, + Namespace, + TemplateParameter, + Concept, + Primitive, + Macro, - // This one is different from the other kinds as it's a line style - // rather than a token style. - InactiveCode, + // This one is different from the other kinds as it's a line style + // rather than a token style. + InactiveCode, - LastKind = InactiveCode + LastKind = InactiveCode }; std::string toSemanticTokenType(HighlightingKind_clangD kind); enum class HighlightingModifier_clangD { - Declaration, - Deprecated, - Deduced, - Readonly, - Static, - Abstract, - DependentName, - DefaultLibrary, + Declaration, + Deprecated, + Deduced, + Readonly, + Static, + Abstract, + DependentName, + DefaultLibrary, - FunctionScope, - ClassScope, - FileScope, - GlobalScope, + FunctionScope, + ClassScope, + FileScope, + GlobalScope, - LastModifier = GlobalScope + LastModifier = GlobalScope }; std::string toSemanticTokenModifier(HighlightingModifier_clangD modifier); enum SemanticTokenType { - ls_namespace=0,// 'namespace', - /** - * Represents a generic type. Acts as a fallback for types which - * can't be mapped to a specific type like class or enum. - */ - ls_type,// 'type', - ls_class,// 'class', - ls_enum,// 'enum', - ls_interface,// 'interface', - ls_struct,// 'struct', - ls_typeParameter,// 'typeParameter', - ls_parameter,// 'parameter', - ls_variable,// 'variable', - ls_property,// 'property', - ls_enumMember,// 'enumMember', - ls_event,// 'event', - ls_function,// 'function', - ls_method,// 'method', - ls_macro,// 'macro', - ls_keyword,// 'keyword', - ls_modifier,// 'modifier', - ls_comment,// 'comment', - ls_string,// 'string', - ls_number,// 'number', - ls_regexp,// 'regexp', - ls_operator,// 'operator' - lastKind = ls_operator + ls_namespace=0,// 'namespace', + /** + * Represents a generic type. Acts as a fallback for types which + * can't be mapped to a specific type like class or enum. + */ + ls_type,// 'type', + ls_class,// 'class', + ls_enum,// 'enum', + ls_interface,// 'interface', + ls_struct,// 'struct', + ls_typeParameter,// 'typeParameter', + ls_parameter,// 'parameter', + ls_variable,// 'variable', + ls_property,// 'property', + ls_enumMember,// 'enumMember', + ls_event,// 'event', + ls_function,// 'function', + ls_method,// 'method', + ls_macro,// 'macro', + ls_keyword,// 'keyword', + ls_modifier,// 'modifier', + ls_comment,// 'comment', + ls_string,// 'string', + ls_number,// 'number', + ls_regexp,// 'regexp', + ls_operator,// 'operator' + lastKind = ls_operator }; std::string to_string(SemanticTokenType); unsigned toSemanticTokenType(std::vector<SemanticTokenType>& modifiers); enum TokenType_JDT { - PACKAGE_JDT=0, - CLASS_JDT, - INTERFACE_JDT, - ENUM_JDT, - ENUM_MEMBER_JDT, - TYPE_JDT, - TYPE_PARAMETER_JDT, - ANNOTATION_JDT, - ANNOTATION_MEMBER_JDT, - METHOD_JDT, - PROPERTY_JDT, - VARIABLE_JDT, - PARAMETER_JDT + PACKAGE_JDT=0, + CLASS_JDT, + INTERFACE_JDT, + ENUM_JDT, + ENUM_MEMBER_JDT, + TYPE_JDT, + TYPE_PARAMETER_JDT, + ANNOTATION_JDT, + ANNOTATION_MEMBER_JDT, + METHOD_JDT, + PROPERTY_JDT, + VARIABLE_JDT, + PARAMETER_JDT }; std::string to_string(TokenType_JDT); enum SemanticTokenModifier { - ls_declaration=0,// 'declaration', - ls_definition,// 'definition', - ls_readonly,// 'readonly', - ls_static,// 'static', - ls_deprecated,// 'deprecated', - ls_abstract,// 'abstract', - ls_async,// 'async', - ls_modification,// 'modification', - ls_documentation,// 'documentation', - ls_defaultLibrary,// 'defaultLibrary' - LastModifier = ls_defaultLibrary + ls_declaration=0,// 'declaration', + ls_definition,// 'definition', + ls_readonly,// 'readonly', + ls_static,// 'static', + ls_deprecated,// 'deprecated', + ls_abstract,// 'abstract', + ls_async,// 'async', + ls_modification,// 'modification', + ls_documentation,// 'documentation', + ls_defaultLibrary,// 'defaultLibrary' + LastModifier = ls_defaultLibrary }; std::string to_string(SemanticTokenModifier); unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); @@ -120,85 +120,85 @@ unsigned toSemanticTokenModifiers(std::vector<SemanticTokenModifier>&); /// This struct is not part of LSP, which just encodes lists of tokens as /// arrays of numbers directly. struct SemanticToken { - /// token line number, relative to the previous token - unsigned deltaLine = 0; - /// token start character, relative to the previous token - /// (relative to 0 or the previous token's start if they are on the same line) - unsigned deltaStart = 0; - /// the length of the token. A token cannot be multiline - unsigned length = 0; - /// will be looked up in `SemanticTokensLegend.tokenTypes` - unsigned tokenType = 0; - /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - unsigned tokenModifiers = 0; + /// token line number, relative to the previous token + unsigned deltaLine = 0; + /// token start character, relative to the previous token + /// (relative to 0 or the previous token's start if they are on the same line) + unsigned deltaStart = 0; + /// the length of the token. A token cannot be multiline + unsigned length = 0; + /// will be looked up in `SemanticTokensLegend.tokenTypes` + unsigned tokenType = 0; + /// each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + unsigned tokenModifiers = 0; }; bool operator==(const SemanticToken&, const SemanticToken&); struct SemanticTokens{ - /** - * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to - * the token before it, because most tokens remain stable relative to each other when edits are made in a file. - * - * --- - * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices: - * - at index `5*i` - `deltaLine`: token line number, relative to the previous token - * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) - * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. - * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536. - * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` - * - * --- - * ### How to encode tokens - * - * Here is an example for encoding a file with 3 tokens in a uint32 array: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] }, - * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] }, - * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] } - * ``` - * - * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. - * For this example, we will choose the following legend which must be passed in when registering the provider: - * ``` - * tokenTypes: ['property', 'type', 'class'], - * tokenModifiers: ['private', 'static'] - * ``` - * - * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked - * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, - * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because - * bits 0 and 1 are set. Using this legend, the tokens now are: - * ``` - * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token - * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` - * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the - * `startChar` of the third token will not be altered: - * ``` - * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, - * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, - * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } - * ``` - * - * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: - * ``` - * // 1st token, 2nd token, 3rd token - * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] - * ``` - */ - std::vector<int32_t> data; - static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); + /** + * Tokens in a file are represented as an array of integers. The position of each token is expressed relative to + * the token before it, because most tokens remain stable relative to each other when edits are made in a file. + * + * --- + * In short, each token takes 5 integers to represent, so a specific token `i` in the file consists of the following array indices: + * - at index `5*i` - `deltaLine`: token line number, relative to the previous token + * - at index `5*i+1` - `deltaStart`: token start character, relative to the previous token (relative to 0 or the previous token's start if they are on the same line) + * - at index `5*i+2` - `length`: the length of the token. A token cannot be multiline. + * - at index `5*i+3` - `tokenType`: will be looked up in `SemanticTokensLegend.tokenTypes`. We currently ask that `tokenType` < 65536. + * - at index `5*i+4` - `tokenModifiers`: each set bit will be looked up in `SemanticTokensLegend.tokenModifiers` + * + * --- + * ### How to encode tokens + * + * Here is an example for encoding a file with 3 tokens in a uint32 array: + * ``` + * { line: 2, startChar: 5, length: 3, tokenType: "property", tokenModifiers: ["private", "static"] }, + * { line: 2, startChar: 10, length: 4, tokenType: "type", tokenModifiers: [] }, + * { line: 5, startChar: 2, length: 7, tokenType: "class", tokenModifiers: [] } + * ``` + * + * 1. First of all, a legend must be devised. This legend must be provided up-front and capture all possible token types. + * For this example, we will choose the following legend which must be passed in when registering the provider: + * ``` + * tokenTypes: ['property', 'type', 'class'], + * tokenModifiers: ['private', 'static'] + * ``` + * + * 2. The first transformation step is to encode `tokenType` and `tokenModifiers` as integers using the legend. Token types are looked + * up by index, so a `tokenType` value of `1` means `tokenTypes[1]`. Multiple token modifiers can be set by using bit flags, + * so a `tokenModifier` value of `3` is first viewed as binary `0b00000011`, which means `[tokenModifiers[0], tokenModifiers[1]]` because + * bits 0 and 1 are set. Using this legend, the tokens now are: + * ``` + * { line: 2, startChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { line: 2, startChar: 10, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { line: 5, startChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } + * ``` + * + * 3. The next step is to represent each token relative to the previous token in the file. In this case, the second token + * is on the same line as the first token, so the `startChar` of the second token is made relative to the `startChar` + * of the first token, so it will be `10 - 5`. The third token is on a different line than the second token, so the + * `startChar` of the third token will not be altered: + * ``` + * { deltaLine: 2, deltaStartChar: 5, length: 3, tokenType: 0, tokenModifiers: 3 }, + * { deltaLine: 0, deltaStartChar: 5, length: 4, tokenType: 1, tokenModifiers: 0 }, + * { deltaLine: 3, deltaStartChar: 2, length: 7, tokenType: 2, tokenModifiers: 0 } + * ``` + * + * 4. Finally, the last step is to inline each of the 5 fields for a token in a single array, which is a memory friendly representation: + * ``` + * // 1st token, 2nd token, 3rd token + * [ 2,5,3,0,3, 0,5,4,1,0, 3,2,7,2,0 ] + * ``` + */ + std::vector<int32_t> data; + static std::vector<int32_t> encodeTokens(std::vector<SemanticToken>& tokens); - /** - * An optional result id. If provided and clients support delta updating - * the client will include the result id in the next semantic token request. - * A server can then instead of computing all semantic tokens again simply - * send a delta. - */ + /** + * An optional result id. If provided and clients support delta updating + * the client will include the result id in the next semantic token request. + * A server can then instead of computing all semantic tokens again simply + * send a delta. + */ boost::optional<std::string> resultId; MAKE_SWAP_METHOD(SemanticTokens, data, resultId) }; @@ -206,9 +206,9 @@ MAKE_REFLECT_STRUCT(SemanticTokens, data, resultId) /// Body of textDocument/semanticTokens/full request. struct SemanticTokensParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) + /// The text document. + lsTextDocumentIdentifier textDocument; + MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) }; MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) @@ -216,28 +216,28 @@ MAKE_REFLECT_STRUCT(SemanticTokensParams, textDocument) /// Body of textDocument/semanticTokens/full/delta request. /// Requests the changes in semantic tokens since a previous response. struct SemanticTokensDeltaParams { - /// The text document. - lsTextDocumentIdentifier textDocument; - /** - * The result id of a previous response. The result Id can either point to - * a full response or a delta response depending on what was received last. - */ - std::string previousResultId; + /// The text document. + lsTextDocumentIdentifier textDocument; + /** + * The result id of a previous response. The result Id can either point to + * a full response or a delta response depending on what was received last. + */ + std::string previousResultId; - MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) + MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) }; MAKE_REFLECT_STRUCT(SemanticTokensDeltaParams, textDocument, previousResultId) /// Describes a a replacement of a contiguous range of semanticTokens. struct SemanticTokensEdit { - // LSP specifies `start` and `deleteCount` which are relative to the array - // encoding of the previous tokens. - // We use token counts instead, and translate when serializing this struct. - unsigned startToken = 0; - unsigned deleteTokens = 0; - std::vector<int32_t> tokens; // encoded as a flat integer array + // LSP specifies `start` and `deleteCount` which are relative to the array + // encoding of the previous tokens. + // We use token counts instead, and translate when serializing this struct. + unsigned startToken = 0; + unsigned deleteTokens = 0; + std::vector<int32_t> tokens; // encoded as a flat integer array - MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) + MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) @@ -245,23 +245,23 @@ MAKE_REFLECT_STRUCT(SemanticTokensEdit, startToken, deleteTokens, tokens) /// This models LSP SemanticTokensDelta | SemanticTokens, which is the result of /// textDocument/semanticTokens/full/delta. struct SemanticTokensOrDelta { - boost::optional<std::string > resultId; - /// Set if we computed edits relative to a previous set of tokens. - boost::optional< std::vector<SemanticTokensEdit> > edits; - /// Set if we computed a fresh set of tokens. - /// Set if we computed edits relative to a previous set of tokens. - boost::optional<std::vector<int32_t>> tokens; // encoded as integer array - MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) + boost::optional<std::string > resultId; + /// Set if we computed edits relative to a previous set of tokens. + boost::optional< std::vector<SemanticTokensEdit> > edits; + /// Set if we computed a fresh set of tokens. + /// Set if we computed edits relative to a previous set of tokens. + boost::optional<std::vector<int32_t>> tokens; // encoded as integer array + MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) }; MAKE_REFLECT_STRUCT(SemanticTokensOrDelta, resultId, edits, tokens) - + struct SemanticTokensLegend { - std::vector<std::string> tokenTypes; - std::vector<std::string> tokenModifiers; - MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) + std::vector<std::string> tokenTypes; + std::vector<std::string> tokenModifiers; + MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) }; MAKE_REFLECT_STRUCT(SemanticTokensLegend, tokenTypes, tokenModifiers) DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full, SemanticTokensParams,boost::optional<SemanticTokens >,"textDocument/semanticTokens/full") -DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full_delta, SemanticTokensDeltaParams, boost::optional<SemanticTokensOrDelta >, "textDocument/semanticTokens/full/delta")
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_semanticTokens_full_delta, SemanticTokensDeltaParams, boost::optional<SemanticTokensOrDelta >, "textDocument/semanticTokens/full/delta") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h index a005c182e17..432fa518d59 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h @@ -12,56 +12,56 @@ MAKE_REFLECT_TYPE_PROXY(SymbolTag) struct CallHierarchyPrepareParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(CallHierarchyPrepareParams, - textDocument, - position) + MAKE_SWAP_METHOD(CallHierarchyPrepareParams, + textDocument, + position) }; MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, - textDocument, - position) + textDocument, + position) - /// Represents programming constructs like functions or constructors - /// in the context of call hierarchy. + /// Represents programming constructs like functions or constructors + /// in the context of call hierarchy. struct CallHierarchyItem { - /// The name of this item. - std::string name; - - /// The kind of this item. - SymbolKind kind; - - /// Tags for this item. - boost::optional<std::vector<SymbolTag>> tags; - - /// More detaill for this item, e.g. the signature of a function. - boost::optional<std::string> detail; - - /// The resource identifier of this item. - lsDocumentUri uri; - - /** - * The range enclosing this symbol not including leading/trailing whitespace - * but everything else, e.g. comments and code. - */ - lsRange range; - - /** - * The range that should be selected and revealed when this symbol is being - * picked, e.g. the name of a function. Must be contained by the - * [`range`](#CallHierarchyItem.range). - */ - lsRange selectionRange; - - /** - * A data entry field that is preserved between a call hierarchy prepare and - * incoming calls or outgoing calls requests. - */ - boost::optional<lsp::Any> data; - MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) + /// The name of this item. + std::string name; + + /// The kind of this item. + SymbolKind kind; + + /// Tags for this item. + boost::optional<std::vector<SymbolTag>> tags; + + /// More detaill for this item, e.g. the signature of a function. + boost::optional<std::string> detail; + + /// The resource identifier of this item. + lsDocumentUri uri; + + /** + * The range enclosing this symbol not including leading/trailing whitespace + * but everything else, e.g. comments and code. + */ + lsRange range; + + /** + * The range that should be selected and revealed when this symbol is being + * picked, e.g. the name of a function. Must be contained by the + * [`range`](#CallHierarchyItem.range). + */ + lsRange selectionRange; + + /** + * A data entry field that is preserved between a call hierarchy prepare and + * incoming calls or outgoing calls requests. + */ + boost::optional<lsp::Any> data; + MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) }; MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data) @@ -69,21 +69,21 @@ MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, sel /// The parameter of a `callHierarchy/incomingCalls` request. struct CallHierarchyIncomingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams,item) + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams,item) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCallsParams, item) /// Represents an incoming call, e.g. a caller of a method or constructor. struct CallHierarchyIncomingCall { - /// The item that makes the call. - CallHierarchyItem from; + /// The item that makes the call. + CallHierarchyItem from; - /// The range at which the calls appear. - /// This is relative to the caller denoted by `From`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) + /// The range at which the calls appear. + /// This is relative to the caller denoted by `From`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges) @@ -92,30 +92,30 @@ MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges) /// The parameter of a `callHierarchy/outgoingCalls` request. struct CallHierarchyOutgoingCallsParams { - CallHierarchyItem item; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) + CallHierarchyItem item; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCallsParams, item) /// Represents an outgoing call, e.g. calling a getter from a method or /// a method from a constructor etc. struct CallHierarchyOutgoingCall { - /// The item that is called. - CallHierarchyItem to; + /// The item that is called. + CallHierarchyItem to; - /// The range at which this item is called. - /// This is the range relative to the caller, and not `To`. - std::vector<lsRange> fromRanges; - MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) + /// The range at which this item is called. + /// This is the range relative to the caller, and not `To`. + std::vector<lsRange> fromRanges; + MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges) }; MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCall, to, fromRanges) DEFINE_REQUEST_RESPONSE_TYPE(td_prepareCallHierarchy, CallHierarchyPrepareParams, - boost::optional<std::vector<CallHierarchyItem>>, "textDocument/prepareCallHierarchy") + boost::optional<std::vector<CallHierarchyItem>>, "textDocument/prepareCallHierarchy") DEFINE_REQUEST_RESPONSE_TYPE(td_incomingCalls, CallHierarchyIncomingCallsParams, - boost::optional<std::vector<CallHierarchyIncomingCall>>, "callHierarchy/incomingCalls") + boost::optional<std::vector<CallHierarchyIncomingCall>>, "callHierarchy/incomingCalls") DEFINE_REQUEST_RESPONSE_TYPE(td_outgoingCalls, CallHierarchyOutgoingCallsParams, - boost::optional<std::vector<CallHierarchyOutgoingCall>>, "callHierarchy/CallHierarchyOutgoingCall")
\ No newline at end of file + boost::optional<std::vector<CallHierarchyOutgoingCall>>, "callHierarchy/CallHierarchyOutgoingCall") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h index 419fdfbc9b4..e72d83af90e 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_action.h @@ -7,24 +7,24 @@ namespace QuickAssistProcessor { - extern const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID;//$NON-NLS-1$ - extern const char* CONVERT_FOR_LOOP_ID;// ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_PARAM_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ - extern const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID ;// "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ - extern const char* ADD_BLOCK_ID ;// "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_LOCAL_NOT_REPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ - extern const char* EXTRACT_CONSTANT_ID ;// "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ - extern const char* INLINE_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_LOCAL_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ - extern const char* CONVERT_ANONYMOUS_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_STRING_BUFFER_ID ;// "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ - extern const char* CONVERT_TO_MESSAGE_FORMAT_ID ;// "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; - extern const char* EXTRACT_METHOD_INPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; + extern const char* SPLIT_JOIN_VARIABLE_DECLARATION_ID;//$NON-NLS-1$ + extern const char* CONVERT_FOR_LOOP_ID;// ;// "org.eclipse.jdt.ls.correction.convertForLoop.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.assignToLocal.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignToField.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_PARAM_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.assignParamToField.assist"; //$NON-NLS-1$ + extern const char* ASSIGN_ALL_PARAMS_TO_NEW_FIELDS_ID ;// "org.eclipse.jdt.ls.correction.assignAllParamsToNewFields.assist"; //$NON-NLS-1$ + extern const char* ADD_BLOCK_ID ;// "org.eclipse.jdt.ls.correction.addBlock.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.extractLocal.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_LOCAL_NOT_REPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractLocalNotReplaceOccurrences.assist"; //$NON-NLS-1$ + extern const char* EXTRACT_CONSTANT_ID ;// "org.eclipse.jdt.ls.correction.extractConstant.assist"; //$NON-NLS-1$ + extern const char* INLINE_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.inlineLocal.assist"; //$NON-NLS-1$ + extern const char* CONVERT_LOCAL_TO_FIELD_ID ;// "org.eclipse.jdt.ls.correction.convertLocalToField.assist"; //$NON-NLS-1$ + extern const char* CONVERT_ANONYMOUS_TO_LOCAL_ID ;// "org.eclipse.jdt.ls.correction.convertAnonymousToLocal.assist"; //$NON-NLS-1$ + extern const char* CONVERT_TO_STRING_BUFFER_ID ;// "org.eclipse.jdt.ls.correction.convertToStringBuffer.assist"; //$NON-NLS-1$ + extern const char* CONVERT_TO_MESSAGE_FORMAT_ID ;// "org.eclipse.jdt.ls.correction.convertToMessageFormat.assist"; //$NON-NLS-1$; + extern const char* EXTRACT_METHOD_INPLACE_ID ;// "org.eclipse.jdt.ls.correction.extractMethodInplace.assist"; //$NON-NLS-1$; - extern const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND ;// "convertAnonymousClassToNestedCommand"; + extern const char* CONVERT_ANONYMOUS_CLASS_TO_NESTED_COMMAND ;// "convertAnonymousClassToNestedCommand"; }; /** * The code action request is sent from the client to the server to compute diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h index 7fd5ae0cf98..9dd763333d8 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/code_lens.h @@ -4,7 +4,7 @@ #include "LibLsp/JsonRpc/lsResponseMessage.h" struct lsDocumentCodeLensParams { - + /** * The document to request code lens for. */ @@ -18,15 +18,15 @@ MAKE_REFLECT_STRUCT(lsDocumentCodeLensParams, textDocument); struct lsCodeLens { - // The range in which this code lens is valid. Should only span a single line. - lsRange range; - // The command this code lens represents. - boost::optional<lsCommandWithAny> command; - // A data entry field that is preserved on a code lens item between - // a code lens and a code lens resolve request. - boost::optional< lsp::Any> data; - - MAKE_SWAP_METHOD(lsCodeLens, range, command, data) + // The range in which this code lens is valid. Should only span a single line. + lsRange range; + // The command this code lens represents. + boost::optional<lsCommandWithAny> command; + // A data entry field that is preserved on a code lens item between + // a code lens and a code lens resolve request. + boost::optional< lsp::Any> data; + + MAKE_SWAP_METHOD(lsCodeLens, range, command, data) }; MAKE_REFLECT_STRUCT(lsCodeLens, range, command, data) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h index 22574e3e194..c70b6502d22 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/colorPresentation.h @@ -12,52 +12,52 @@ struct ColorPresentationParams { - /** + /** * The text document. */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** - * The range in the document where this color appers. - */ + /** + * The range in the document where this color appers. + */ - lsRange range; + lsRange range; - /** - * The actual color value for this color range. - */ + /** + * The actual color value for this color range. + */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorPresentationParams, textDocument, range, color) }; MAKE_REFLECT_STRUCT(ColorPresentationParams, textDocument, range, color) struct ColorPresentation { - /** - * The label of this color presentation. It will be shown on the color - * picker header. By default this is also the text that is inserted when selecting - * this color presentation. - */ - - std::string label; - - /** - * An edit which is applied to a document when selecting - * this presentation for the color. When `null` the label is used. - */ - lsTextEdit textEdit; - - /** - * An optional array of additional text edits that are applied when - * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. - */ - std::vector<lsTextEdit> additionalTextEdits; - MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) + /** + * The label of this color presentation. It will be shown on the color + * picker header. By default this is also the text that is inserted when selecting + * this color presentation. + */ + + std::string label; + + /** + * An edit which is applied to a document when selecting + * this presentation for the color. When `null` the label is used. + */ + lsTextEdit textEdit; + + /** + * An optional array of additional text edits that are applied when + * selecting this color presentation. Edits must not overlap with the main edit nor with themselves. + */ + std::vector<lsTextEdit> additionalTextEdits; + MAKE_SWAP_METHOD(ColorPresentation, label, textEdit, additionalTextEdits) }; MAKE_REFLECT_STRUCT(ColorPresentation, label, textEdit, additionalTextEdits) DEFINE_REQUEST_RESPONSE_TYPE(td_colorPresentation, - ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation")
\ No newline at end of file + ColorPresentationParams, std::vector<ColorPresentation>, "textDocument/colorPresentation") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h index 883c5cfe3a8..916d4550e93 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/completion.h @@ -41,9 +41,9 @@ struct lsCompletionParams : lsTextDocumentPositionParams { // send this using // `ClientCapabilities.textDocument.completion.contextSupport === true` boost::optional<lsCompletionContext> context; - + MAKE_SWAP_METHOD(lsCompletionParams, textDocument, position, context); - + }; MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); @@ -56,9 +56,9 @@ MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context); namespace TextDocumentComplete{ - - typedef std::pair< boost::optional<std::vector<lsCompletionItem>>, boost::optional<CompletionList> > Either; - + + typedef std::pair< boost::optional<std::vector<lsCompletionItem>>, boost::optional<CompletionList> > Either; + }; extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h index e8a6235a002..a7c6fdba346 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/didRenameFiles.h @@ -9,31 +9,31 @@ class FileRenameEvent { public: - std::string oldUri; - std::string newUri; + std::string oldUri; + std::string newUri; - FileRenameEvent() { - } + FileRenameEvent() { + } - FileRenameEvent(std::string oldUri, std::string newUri) { - this->oldUri = oldUri; - this->newUri = newUri; - } - MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); + FileRenameEvent(std::string oldUri, std::string newUri) { + this->oldUri = oldUri; + this->newUri = newUri; + } + MAKE_SWAP_METHOD(FileRenameEvent, oldUri, newUri); }; MAKE_REFLECT_STRUCT(FileRenameEvent, oldUri, newUri); class FileRenameParams { public: - std::vector <FileRenameEvent> files; + std::vector <FileRenameEvent> files; - FileRenameParams() { - } + FileRenameParams() { + } - FileRenameParams(std::vector<FileRenameEvent>& files) { - this->files = files; - } - MAKE_SWAP_METHOD(FileRenameParams, files); + FileRenameParams(std::vector<FileRenameEvent>& files) { + this->files = files; + } + MAKE_SWAP_METHOD(FileRenameParams, files); }; MAKE_REFLECT_STRUCT(FileRenameParams, files); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h index 0887bf66029..fda407f93fb 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_change.h @@ -8,38 +8,38 @@ #include "LibLsp/lsp/lsRange.h" #include "LibLsp/lsp/lsDocumentUri.h" struct lsTextDocumentContentChangeEvent { - // The range of the document that changed. - boost::optional<lsRange> range; - // The length of the range that got replaced. - boost::optional<int> rangeLength; - // The new text of the range/document. - std::string text; - - MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); + // The range of the document that changed. + boost::optional<lsRange> range; + // The length of the range that got replaced. + boost::optional<int> rangeLength; + // The new text of the range/document. + std::string text; + + MAKE_SWAP_METHOD(lsTextDocumentContentChangeEvent, range, rangeLength, text); }; MAKE_REFLECT_STRUCT(lsTextDocumentContentChangeEvent, range, rangeLength, text); struct lsTextDocumentDidChangeParams { - lsVersionedTextDocumentIdentifier textDocument; - std::vector<lsTextDocumentContentChangeEvent> contentChanges; - - /** - * Legacy property to support protocol version 1.0 requests. - */ - - boost::optional<lsDocumentUri> uri; - - void swap(lsTextDocumentDidChangeParams& arg) noexcept - { - uri.swap(arg.uri); - contentChanges.swap(arg.contentChanges); - textDocument.swap(arg.textDocument); - } + lsVersionedTextDocumentIdentifier textDocument; + std::vector<lsTextDocumentContentChangeEvent> contentChanges; + + /** + * Legacy property to support protocol version 1.0 requests. + */ + + boost::optional<lsDocumentUri> uri; + + void swap(lsTextDocumentDidChangeParams& arg) noexcept + { + uri.swap(arg.uri); + contentChanges.swap(arg.contentChanges); + textDocument.swap(arg.textDocument); + } }; MAKE_REFLECT_STRUCT(lsTextDocumentDidChangeParams, - textDocument, - contentChanges, uri); + textDocument, + contentChanges, uri); /** * The document change notification is sent from the client to the server to diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h index e2eaa2cfcd8..d064819ae9c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_close.h @@ -11,11 +11,11 @@ namespace TextDocumentDidClose { struct Params { lsTextDocumentIdentifier textDocument; - void swap(Params& arg) noexcept - { - textDocument.swap(arg.textDocument); - } - + void swap(Params& arg) noexcept + { + textDocument.swap(arg.textDocument); + } + }; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h index 7be7a735d64..ed5dfa535f0 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_open.h @@ -11,15 +11,15 @@ namespace TextDocumentDidOpen { struct Params { lsTextDocumentItem textDocument; - + /** * Legacy property to support protocol version 1.0 requests. */ boost::optional<std::string> text; - + MAKE_SWAP_METHOD(TextDocumentDidOpen::Params, textDocument, text); - + }; } diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h index 1ce386c415f..649c9b76ec9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/did_save.h @@ -15,7 +15,7 @@ namespace TextDocumentDidSave { // when the save notifcation was requested. boost::optional<std::string> text; - MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); + MAKE_SWAP_METHOD(TextDocumentDidSave::Params, textDocument, text); }; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h index 23a6d08d87c..9aeeadba05f 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/documentColor.h @@ -7,12 +7,12 @@ #include "LibLsp/lsp/lsRange.h" #include <vector> struct DocumentColorParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(DocumentColorParams, textDocument); + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(DocumentColorParams, textDocument); }; MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); @@ -28,46 +28,46 @@ MAKE_REFLECT_STRUCT(DocumentColorParams, textDocument); */ namespace TextDocument { - struct Color { - /** - * The red component of this color in the range [0-1]. - */ - double red = 0; + struct Color { + /** + * The red component of this color in the range [0-1]. + */ + double red = 0; - /** - * The green component of this color in the range [0-1]. - */ - double green = 0; + /** + * The green component of this color in the range [0-1]. + */ + double green = 0; - /** - * The blue component of this color in the range [0-1]. - */ - double blue = 0; + /** + * The blue component of this color in the range [0-1]. + */ + double blue = 0; - /** - * The alpha component of this color in the range [0-1]. - */ - double alpha = 0; - MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) - }; + /** + * The alpha component of this color in the range [0-1]. + */ + double alpha = 0; + MAKE_SWAP_METHOD(TextDocument::Color, red, green, blue, alpha) + }; } MAKE_REFLECT_STRUCT(TextDocument::Color, red, green, blue, alpha) struct ColorInformation { - /** - * The range in the document where this color appers. - */ + /** + * The range in the document where this color appers. + */ - lsRange range; + lsRange range; - /** - * The actual color value for this color range. - */ + /** + * The actual color value for this color range. + */ - TextDocument::Color color; - MAKE_SWAP_METHOD(ColorInformation, range, color) + TextDocument::Color color; + MAKE_SWAP_METHOD(ColorInformation, range, color) }; MAKE_REFLECT_STRUCT(ColorInformation,range,color) -DEFINE_REQUEST_RESPONSE_TYPE(td_documentColor, DocumentColorParams,std::vector<ColorInformation>, "textDocument/documentColor");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_documentColor, DocumentColorParams,std::vector<ColorInformation>, "textDocument/documentColor"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h index 536a625c4c9..e450a08df1c 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_link.h @@ -9,7 +9,7 @@ namespace TextDocumentDocumentLink { struct Params { // The document to provide document links for. lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(Params, textDocument) + MAKE_SWAP_METHOD(Params, textDocument) }; }; @@ -27,9 +27,9 @@ struct lsDocumentLink { boost::optional<lsDocumentUri> target; boost::optional<lsp::Any> data; - + MAKE_SWAP_METHOD(lsDocumentLink, range, target, data) - + }; MAKE_REFLECT_STRUCT(lsDocumentLink, range, target,data); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h index 8aa6e8b00e5..150dde1f0bf 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/document_symbol.h @@ -18,7 +18,7 @@ MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument); struct TextDocumentDocumentSymbol{ - typedef std::pair< boost::optional<lsSymbolInformation> , boost::optional<lsDocumentSymbol> > Either; + typedef std::pair< boost::optional<lsSymbolInformation> , boost::optional<lsDocumentSymbol> > Either; }; void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); @@ -42,14 +42,14 @@ void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); * </p> */ -//DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, -// lsDocumentSymbolParams, -// std::vector<TextDocumentDocumentSymbol::Either> ); +//DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, +// lsDocumentSymbolParams, +// std::vector<TextDocumentDocumentSymbol::Either> ); // -DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, - lsDocumentSymbolParams, - std::vector< lsDocumentSymbol >,"textDocument/documentSymbol" ); +DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, + lsDocumentSymbolParams, + std::vector< lsDocumentSymbol >,"textDocument/documentSymbol" ); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h index 27977a4517b..f863b4991df 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/foldingRange.h @@ -9,47 +9,47 @@ struct FoldingRangeRequestParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; - MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) + lsTextDocumentIdentifier textDocument; + MAKE_SWAP_METHOD(FoldingRangeRequestParams, textDocument) }; MAKE_REFLECT_STRUCT(FoldingRangeRequestParams, textDocument) struct FoldingRange { - /** - * The zero-based line number from where the folded range starts. - */ - int startLine; - - /** - * The zero-based line number where the folded range ends. - */ - int endLine; - - /** - * The zero-based character offset from where the folded range starts. If not defined, defaults - * to the length of the start line. - */ - int startCharacter; - - /** - * The zero-based character offset before the folded range ends. If not defined, defaults to the - * length of the end line. - */ - int endCharacter; - - /** - * Describes the kind of the folding range such as `comment' or 'region'. The kind - * is used to categorize folding ranges and used by commands like 'Fold all comments'. See - * FoldingRangeKind for an enumeration of standardized kinds. - */ - std::string kind; - - MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) + /** + * The zero-based line number from where the folded range starts. + */ + int startLine; + + /** + * The zero-based line number where the folded range ends. + */ + int endLine; + + /** + * The zero-based character offset from where the folded range starts. If not defined, defaults + * to the length of the start line. + */ + int startCharacter; + + /** + * The zero-based character offset before the folded range ends. If not defined, defaults to the + * length of the end line. + */ + int endCharacter; + + /** + * Describes the kind of the folding range such as `comment' or 'region'. The kind + * is used to categorize folding ranges and used by commands like 'Fold all comments'. See + * FoldingRangeKind for an enumeration of standardized kinds. + */ + std::string kind; + + MAKE_SWAP_METHOD(FoldingRange, startLine, endLine, startCharacter, endCharacter, kind) }; MAKE_REFLECT_STRUCT(FoldingRange,startLine,endLine,startCharacter,endCharacter,kind) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h index ad54e24bf96..49b7883b5f6 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/formatting.h @@ -8,15 +8,15 @@ namespace TextDocumentFormatting { struct Params { - /** - * The document to format. - */ + /** + * The document to format. + */ lsTextDocumentIdentifier textDocument; - /** - * The format options. - */ + /** + * The format options. + */ lsFormattingOptions options; - MAKE_SWAP_METHOD(Params, textDocument, options); + MAKE_SWAP_METHOD(Params, textDocument, options); }; }; @@ -28,5 +28,5 @@ MAKE_REFLECT_STRUCT(TextDocumentFormatting::Params, textDocument, options); * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_formatting, TextDocumentFormatting::Params, - std::vector<lsTextEdit>, "textDocument/formatting"); + std::vector<lsTextEdit>, "textDocument/formatting"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h index 332baf69e16..0e01416126d 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/highlight.h @@ -14,5 +14,5 @@ */ DEFINE_REQUEST_RESPONSE_TYPE(td_highlight, lsTextDocumentPositionParams, - std::vector<lsDocumentHighlight>, "textDocument/documentHighlight"); + std::vector<lsDocumentHighlight>, "textDocument/documentHighlight"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h index 5302316c6f5..06f3f9613e9 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/hover.h @@ -16,21 +16,21 @@ namespace TextDocumentHover { - typedef boost::optional< std::vector< std::pair<boost::optional<std::string>, boost::optional<lsMarkedString>> > > Left; - typedef std::pair< Left, boost::optional<MarkupContent> > Either; - struct Result { - /** - * The hover's content as markdown - */ - Either contents; - - /** - * An boost::optional range - */ - boost::optional<lsRange> range; - - MAKE_SWAP_METHOD(Result, contents, range) - }; + typedef boost::optional< std::vector< std::pair<boost::optional<std::string>, boost::optional<lsMarkedString>> > > Left; + typedef std::pair< Left, boost::optional<MarkupContent> > Either; + struct Result { + /** + * The hover's content as markdown + */ + Either contents; + + /** + * An boost::optional range + */ + boost::optional<lsRange> range; + + MAKE_SWAP_METHOD(Result, contents, range) + }; } MAKE_REFLECT_STRUCT(TextDocumentHover::Result, contents, range); @@ -44,12 +44,12 @@ DEFINE_REQUEST_RESPONSE_TYPE(td_hover, lsTextDocumentPositionParams, TextDocumen // //}; //MAKE_REFLECT_STRUCT(Rsp_TextDocumentHover, -// jsonrpc, -// id, -// result); +// jsonrpc, +// id, +// result); //MAKE_REFLECT_STRUCT_OPTIONALS_MANDATORY(Rsp_TextDocumentHover, // jsonrpc, -// id, +// id, // result); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h index e4055d359ff..96e938a89f3 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/linkedEditingRange.h @@ -12,40 +12,40 @@ struct LinkedEditingRangeParams { - lsTextDocumentIdentifier textDocument; - lsPosition position; + lsTextDocumentIdentifier textDocument; + lsPosition position; - MAKE_SWAP_METHOD(LinkedEditingRangeParams, - textDocument, - position) + MAKE_SWAP_METHOD(LinkedEditingRangeParams, + textDocument, + position) }; MAKE_REFLECT_STRUCT(LinkedEditingRangeParams, - textDocument, - position) + textDocument, + position) struct LinkedEditingRanges { - /** + /** * A list of ranges that can be renamed together. The ranges must have * identical length and contain identical text content. The ranges cannot overlap. */ std::vector<lsRange> ranges; - /** - * An optional word pattern (regular expression) that describes valid contents for - * the given ranges. If no pattern is provided, the client configuration's word - * pattern will be used. - */ - - boost::optional<std::string> wordPattern; - MAKE_SWAP_METHOD(LinkedEditingRanges, - ranges, - wordPattern) + /** + * An optional word pattern (regular expression) that describes valid contents for + * the given ranges. If no pattern is provided, the client configuration's word + * pattern will be used. + */ + + boost::optional<std::string> wordPattern; + MAKE_SWAP_METHOD(LinkedEditingRanges, + ranges, + wordPattern) }; MAKE_REFLECT_STRUCT(LinkedEditingRanges, - ranges, - wordPattern) + ranges, + wordPattern) DEFINE_REQUEST_RESPONSE_TYPE(td_linkedEditingRange, LinkedEditingRangeParams, - boost::optional<std::vector<LinkedEditingRanges >>,"textDocument/linkedEditingRange")
\ No newline at end of file + boost::optional<std::vector<LinkedEditingRanges >>,"textDocument/linkedEditingRange") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h index df14ea5d3dd..ada2162d128 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/onTypeFormatting.h @@ -17,20 +17,20 @@ struct lsDocumentOnTypeFormattingParams lsPosition position; - /** - * The character that has been typed. - */ + /** + * The character that has been typed. + */ std::string ch; MAKE_SWAP_METHOD(lsDocumentOnTypeFormattingParams, - textDocument, - position, - options, ch); + textDocument, + position, + options, ch); }; MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, textDocument, - position, + position, options,ch); /** @@ -40,5 +40,5 @@ MAKE_REFLECT_STRUCT(lsDocumentOnTypeFormattingParams, * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_onTypeFormatting, - lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting"); + lsDocumentOnTypeFormattingParams, std::vector<lsTextEdit>, "textDocument/onTypeFormatting"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h index 8c653d9864b..a7ece38114d 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/prepareRename.h @@ -13,20 +13,20 @@ * Registration Options: TextDocumentRegistrationOptions */ struct PrepareRenameResult{ - /** - * The range of the string to rename - */ - - lsRange range; + /** + * The range of the string to rename + */ + + lsRange range; /** * A placeholder text of the string content to be renamed. */ - std::string placeholder; - - MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) - + std::string placeholder; + + MAKE_SWAP_METHOD(PrepareRenameResult, range, placeholder) + }; MAKE_REFLECT_STRUCT(PrepareRenameResult,range,placeholder) @@ -36,5 +36,5 @@ typedef std::pair< boost::optional< lsRange>, boost::optional<PrepareRenameResu extern void Reflect(Reader& visitor, TextDocumentPrepareRenameResult& value); -DEFINE_REQUEST_RESPONSE_TYPE(td_prepareRename, - lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_prepareRename, + lsTextDocumentPositionParams, TextDocumentPrepareRenameResult, "textDocument/prepareRename"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h index bf28104bbbf..8272df10e84 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/publishDiagnostics.h @@ -11,14 +11,14 @@ namespace TextDocumentPublishDiagnostics{ // An array of diagnostic information items. std::vector<lsDiagnostic> diagnostics; - MAKE_SWAP_METHOD(Params,uri,diagnostics); + MAKE_SWAP_METHOD(Params,uri,diagnostics); }; - + }; MAKE_REFLECT_STRUCT(TextDocumentPublishDiagnostics::Params, - uri, - diagnostics); + uri, + diagnostics); /** * Diagnostics notifications are sent from the server to the client to diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h index b2fe750af15..c3c5ff0d0b6 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/range_formatting.h @@ -13,9 +13,9 @@ struct lsTextDocumentRangeFormattingParams { lsFormattingOptions options; MAKE_SWAP_METHOD(lsTextDocumentRangeFormattingParams, - textDocument, - range, - options) + textDocument, + range, + options) }; MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, textDocument, @@ -29,7 +29,7 @@ MAKE_REFLECT_STRUCT(lsTextDocumentRangeFormattingParams, * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_rangeFormatting, lsTextDocumentRangeFormattingParams, std::vector<lsTextEdit>, - "textDocument/rangeFormatting"); + "textDocument/rangeFormatting"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h index 23769127565..f398a0b8597 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/references.h @@ -13,16 +13,16 @@ namespace TextDocumentReferences { // Include the declaration of the current symbol. boost::optional<bool> includeDeclaration; MAKE_REFLECT_STRUCT(lsReferenceContext, - includeDeclaration) + includeDeclaration) }; struct Params { lsTextDocumentIdentifier textDocument; lsPosition position; lsReferenceContext context; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - context) + MAKE_SWAP_METHOD(Params, + textDocument, + position, + context) }; @@ -44,5 +44,5 @@ MAKE_REFLECT_STRUCT(TextDocumentReferences::Params, * * Registration Options: TextDocumentRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_references, TextDocumentReferences::Params, +DEFINE_REQUEST_RESPONSE_TYPE(td_references, TextDocumentReferences::Params, std::vector<lsLocation>, "textDocument/references"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h index 35895f0f4f6..8b6d085910f 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/rename.h @@ -20,10 +20,10 @@ namespace TextDocumentRename { // request must return a [ResponseError](#ResponseError) with an // appropriate message set. std::string newName; - MAKE_SWAP_METHOD(Params, - textDocument, - position, - newName); + MAKE_SWAP_METHOD(Params, + textDocument, + position, + newName); }; }; diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h index eab5f838fcd..dceba1fb8ff 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/resolveTypeHierarchy.h @@ -9,23 +9,23 @@ #include "typeHierarchy.h" struct ResolveTypeHierarchyItemParams { - /** - * The hierarchy item to resolve. - */ + /** + * The hierarchy item to resolve. + */ - TypeHierarchyItem item; + TypeHierarchyItem item; - /** - * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. - */ - boost::optional<int> resolve; + /** + * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. + */ + boost::optional<int> resolve; - /** - * The direction of the type hierarchy resolution. - */ + /** + * The direction of the type hierarchy resolution. + */ - TypeHierarchyDirection direction; - MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) + TypeHierarchyDirection direction; + MAKE_SWAP_METHOD(ResolveTypeHierarchyItemParams, item, resolve, direction) }; MAKE_REFLECT_STRUCT(ResolveTypeHierarchyItemParams,item,resolve,direction) DEFINE_REQUEST_RESPONSE_TYPE(typeHierarchy_resolve, ResolveTypeHierarchyItemParams, TypeHierarchyItem, "typeHierarchy/resolve") diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h index 47590e41522..91915275bdf 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/selectionRange.h @@ -8,35 +8,35 @@ #include "LibLsp/lsp/lsTextDocumentIdentifier.h" struct SelectionRangeParams { - /** - * The text document. - */ + /** + * The text document. + */ - lsTextDocumentIdentifier textDocument; + lsTextDocumentIdentifier textDocument; - /** - * The positions inside the text document. - */ + /** + * The positions inside the text document. + */ + + std::vector<lsPosition> positions; + + MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) - std::vector<lsPosition> positions; - - MAKE_SWAP_METHOD(SelectionRangeParams, textDocument, positions) - }; MAKE_REFLECT_STRUCT(SelectionRangeParams, textDocument, positions) struct SelectionRange { - /** - * The [range](#Range) of this selection range. - */ + /** + * The [range](#Range) of this selection range. + */ - lsRange range; + lsRange range; - /** - * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. - */ - boost::optional<SelectionRange*> parent; - MAKE_SWAP_METHOD(SelectionRange, range, parent) + /** + * The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. + */ + boost::optional<SelectionRange*> parent; + MAKE_SWAP_METHOD(SelectionRange, range, parent) }; extern void Reflect(Reader& visitor, boost::optional<SelectionRange*>& value); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h index 32bc86f5fb7..bfb8619559f 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/semanticHighlighting.h @@ -10,19 +10,19 @@ */ struct SemanticHighlightingInformation { - /** - * The zero-based line position in the text document. - */ - int line = 0; + /** + * The zero-based line position in the text document. + */ + int line = 0; - /** - * A base64 encoded string representing every single highlighted ranges in the line with its start position, length - * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> - * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. - */ - std::string tokens; + /** + * A base64 encoded string representing every single highlighted ranges in the line with its start position, length + * and the "lookup table" index of of the semantic highlighting <a href="https://manual.macromates.com/en/language_grammars"> + * TextMate scopes</a>. If the {@code tokens} is empty or not defined, then no highlighted positions are available for the line. + */ + std::string tokens; - MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) + MAKE_SWAP_METHOD(SemanticHighlightingInformation, line, tokens) }; MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); @@ -32,35 +32,35 @@ MAKE_REFLECT_STRUCT(SemanticHighlightingInformation, line, tokens); */ struct SemanticHighlightingParams { - /** - * The text document that has to be decorated with the semantic highlighting information. - */ - - lsVersionedTextDocumentIdentifier textDocument; + /** + * The text document that has to be decorated with the semantic highlighting information. + */ - /** - * An array of semantic highlighting information. - */ + lsVersionedTextDocumentIdentifier textDocument; + + /** + * An array of semantic highlighting information. + */ + + std::vector<SemanticHighlightingInformation> lines; + + MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) - std::vector<SemanticHighlightingInformation> lines; - - MAKE_SWAP_METHOD(SemanticHighlightingParams, textDocument, lines) - }; MAKE_REFLECT_STRUCT(SemanticHighlightingParams, textDocument, lines); /** - * The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client - * to inform the client about additional semantic highlighting information that has to be applied - * on the text document. It is the server's responsibility to decide which lines are included in - * the highlighting information. In other words, the server is capable of sending only a delta - * information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification}) - * the server sends the semantic highlighting information for the entire document, but if the server - * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about - * the affected lines in the document. - * - * <p> - * <b>Note:</b> the <a href= - * "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} - * language feature</a> is not yet part of the official LSP specification. - */ -DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting");
\ No newline at end of file + * The {@code textDocument/semanticHighlighting} notification is pushed from the server to the client + * to inform the client about additional semantic highlighting information that has to be applied + * on the text document. It is the server's responsibility to decide which lines are included in + * the highlighting information. In other words, the server is capable of sending only a delta + * information. For instance, after opening the text document ({@code DidOpenTextDocumentNotification}) + * the server sends the semantic highlighting information for the entire document, but if the server + * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about + * the affected lines in the document. + * + * <p> + * <b>Note:</b> the <a href= + * "https://github.com/Microsoft/vscode-languageserver-node/pull/367">{@code textDocument/semanticHighlighting} + * language feature</a> is not yet part of the official LSP specification. + */ +DEFINE_NOTIFICATION_TYPE(Notify_semanticHighlighting, SemanticHighlightingParams, "textDocument/semanticHighlighting"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h index 2a83645901c..837096695e8 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/signature_help.h @@ -6,8 +6,8 @@ #include "LibLsp/lsp/lsMarkedString.h" #include "LibLsp/lsp/lsTextDocumentPositionParams.h" -extern void Reflect(Reader& visitor, - std::pair<boost::optional<std::string>, boost::optional<MarkupContent>>& value); +extern void Reflect(Reader& visitor, + std::pair<boost::optional<std::string>, boost::optional<MarkupContent>>& value); @@ -72,9 +72,9 @@ struct lsSignatureHelp { MAKE_SWAP_METHOD(lsSignatureHelp, - signatures, - activeSignature, - activeParameter) + signatures, + activeSignature, + activeParameter) }; MAKE_REFLECT_STRUCT(lsSignatureHelp, signatures, @@ -89,4 +89,4 @@ MAKE_REFLECT_STRUCT(lsSignatureHelp, * * Registration Options: SignatureHelpRegistrationOptions */ -DEFINE_REQUEST_RESPONSE_TYPE(td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h index b554d751f3a..384cfb68c94 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/typeHierarchy.h @@ -6,34 +6,34 @@ #include "LibLsp/lsp/symbol.h" #include "LibLsp/lsp/lsAny.h" /** - * The {@code textDocument/typeHierarchy} request is sent from the client to the - * server to retrieve a {@link TypeHierarchyItem type hierarchy item} based on - * the {@link TypeHierarchyParams cursor position in the text document}. This - * request would also allow to specify if the item should be resolved and - * whether sub- or supertypes are to be resolved. If no type hierarchy item can - * be found under the given text document position, resolves to {@code null}. - * - * <p> - * <b>Note:</b> the <a href= - * "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} - * language feature</a> is not yet part of the official LSP specification. - */ + * The {@code textDocument/typeHierarchy} request is sent from the client to the + * server to retrieve a {@link TypeHierarchyItem type hierarchy item} based on + * the {@link TypeHierarchyParams cursor position in the text document}. This + * request would also allow to specify if the item should be resolved and + * whether sub- or supertypes are to be resolved. If no type hierarchy item can + * be found under the given text document position, resolves to {@code null}. + * + * <p> + * <b>Note:</b> the <a href= + * "https://github.com/Microsoft/vscode-languageserver-node/pull/426">{@code textDocument/typeHierarchy} + * language feature</a> is not yet part of the official LSP specification. + */ enum class TypeHierarchyDirection : uint32_t{ - /** - * Flag for retrieving/resolving the subtypes. Value: {@code 0}. - */ - Children = 0, + /** + * Flag for retrieving/resolving the subtypes. Value: {@code 0}. + */ + Children = 0, - /** - * Flag to use when retrieving/resolving the supertypes. Value: {@code 1}. - */ - Parents =1, + /** + * Flag to use when retrieving/resolving the supertypes. Value: {@code 1}. + */ + Parents =1, - /** - * Flag for resolving both the super- and subtypes. Value: {@code 2}. - */ - Both=2 + /** + * Flag for resolving both the super- and subtypes. Value: {@code 2}. + */ + Both=2 }; void Reflect(Reader& reader, TypeHierarchyDirection& value); @@ -42,10 +42,10 @@ void Reflect(Writer& writer, TypeHierarchyDirection& value); struct TypeHierarchyParams :public lsTextDocumentPositionParams { - boost::optional<int> resolve; - boost::optional<TypeHierarchyDirection> direction ; - - MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) + boost::optional<int> resolve; + boost::optional<TypeHierarchyDirection> direction ; + + MAKE_SWAP_METHOD(TypeHierarchyParams, textDocument, position, resolve, direction) }; MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direction); @@ -58,76 +58,76 @@ MAKE_REFLECT_STRUCT(TypeHierarchyParams, textDocument, position, resolve, direc */ struct TypeHierarchyItem { - /** - * The human readable name of the hierarchy item. - */ - - std::string name; - - /** - * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method. - */ - boost::optional<std::string> - detail; - - /** - * The kind of the hierarchy item. For instance, class or interface. - */ - - SymbolKind kind; - - /** - * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default. - */ - - boost::optional<bool> deprecated; - - /** - * The URI of the text document where this type hierarchy item belongs to. - */ - - lsDocumentUri uri; - - /** - * The range enclosing this type hierarchy item not including leading/trailing whitespace but everything else - * like comments. This information is typically used to determine if the clients cursor is inside the type - * hierarchy item to reveal in the symbol in the UI. - * - * @see TypeHierarchyItem#selectionRange - */ - - lsRange range; - - /** - * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function. - * Must be contained by the the {@link TypeHierarchyItem#getRange range}. - * - * @see TypeHierarchyItem#range - */ - - lsRange selectionRange; - - /** - * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any - * direct parents. If not defined, the parents have not been resolved yet. - */ - boost::optional< std::vector<TypeHierarchyItem> > parents; - - /** - * If this type hierarchy item is resolved, it contains the direct children of the current item. - * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved. - */ - boost::optional< std::vector<TypeHierarchyItem> > children; - - /** + /** + * The human readable name of the hierarchy item. + */ + + std::string name; + + /** + * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method. + */ + boost::optional<std::string> + detail; + + /** + * The kind of the hierarchy item. For instance, class or interface. + */ + + SymbolKind kind; + + /** + * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default. + */ + + boost::optional<bool> deprecated; + + /** + * The URI of the text document where this type hierarchy item belongs to. + */ + + lsDocumentUri uri; + + /** + * The range enclosing this type hierarchy item not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the clients cursor is inside the type + * hierarchy item to reveal in the symbol in the UI. + * + * @see TypeHierarchyItem#selectionRange + */ + + lsRange range; + + /** + * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function. + * Must be contained by the the {@link TypeHierarchyItem#getRange range}. + * + * @see TypeHierarchyItem#range + */ + + lsRange selectionRange; + + /** + * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any + * direct parents. If not defined, the parents have not been resolved yet. + */ + boost::optional< std::vector<TypeHierarchyItem> > parents; + + /** + * If this type hierarchy item is resolved, it contains the direct children of the current item. + * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved. + */ + boost::optional< std::vector<TypeHierarchyItem> > children; + + /** * An boost::optional data field can be used to identify a type hierarchy item in a resolve request. */ - boost::optional<lsp::Any> data; + boost::optional<lsp::Any> data; - MAKE_SWAP_METHOD(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data) + MAKE_SWAP_METHOD(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data) }; MAKE_REFLECT_STRUCT(TypeHierarchyItem, name, detail, kind, deprecated, uri, range, selectionRange, parents, children, data); -DEFINE_REQUEST_RESPONSE_TYPE(td_typeHierarchy, TypeHierarchyParams, TypeHierarchyItem, "textDocument/typeHierarchy");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(td_typeHierarchy, TypeHierarchyParams, TypeHierarchyItem, "textDocument/typeHierarchy"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h index 38ced43b42d..196a65c5d34 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/type_definition.h @@ -13,4 +13,4 @@ * Since version 3.6.0 */ DEFINE_REQUEST_RESPONSE_TYPE(td_typeDefinition, - lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition");
\ No newline at end of file + lsTextDocumentPositionParams, LocationListEither::Either, "textDocument/typeDefinition"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h index 84aa0badaa7..29afcac41a4 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/textDocument/willSave.h @@ -8,41 +8,41 @@ namespace WillSaveTextDocumentParams { - /** - * Represents reasons why a text document is saved. - */ - enum class TextDocumentSaveReason { - - /** - * Manually triggered, e.g. by the user pressing save, by starting debugging, - * or by an API call. - */ - Manual=(1), - - /** - * Automatic after a delay. - */ - AfterDelay=(2), - - /** - * When the editor lost focus. - */ - FocusOut=(3) - }; - + /** + * Represents reasons why a text document is saved. + */ + enum class TextDocumentSaveReason { + + /** + * Manually triggered, e.g. by the user pressing save, by starting debugging, + * or by an API call. + */ + Manual=(1), + + /** + * Automatic after a delay. + */ + AfterDelay=(2), + + /** + * When the editor lost focus. + */ + FocusOut=(3) + }; + struct Params { - /** - * The document that will be saved. - */ + /** + * The document that will be saved. + */ lsTextDocumentIdentifier textDocument; /* * A reason why a text document is saved. */ - boost::optional<TextDocumentSaveReason> reason; + boost::optional<TextDocumentSaveReason> reason; - MAKE_SWAP_METHOD(Params, textDocument, reason); + MAKE_SWAP_METHOD(Params, textDocument, reason); }; }; @@ -67,5 +67,5 @@ DEFINE_NOTIFICATION_TYPE(td_willSave, WillSaveTextDocumentParams::Params, "textD * Registration Options: TextDocumentRegistrationOptions */ DEFINE_REQUEST_RESPONSE_TYPE(td_willSaveWaitUntil, - WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil"); + WillSaveTextDocumentParams::Params, std::vector<lsTextEdit>, "textDocument/willSaveWaitUntil"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/utils.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/utils.h index 796b5d2569d..95064c34d63 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/utils.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/utils.h @@ -15,7 +15,7 @@ namespace lsp { - + // Returns true if |value| starts/ends with |start| or |ending|. bool StartsWith(std::string value, std::string start); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h index 8499304f558..332fb7e2e75 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/windows/MessageNotify.h @@ -11,20 +11,20 @@ struct MessageParams { /** * The message type. */ - - lsMessageType type = lsMessageType::Error; - + + lsMessageType type = lsMessageType::Error; + /** * The actual message. */ - std::string message; - - void swap(MessageParams& arg) noexcept { - lsMessageType temp = type; - type = arg.type; - arg.type = temp; - message.swap(arg.message); - } + std::string message; + + void swap(MessageParams& arg) noexcept { + lsMessageType temp = type; + type = arg.type; + arg.type = temp; + message.swap(arg.message); + } }; MAKE_REFLECT_STRUCT(MessageParams, type, message) @@ -49,23 +49,23 @@ DEFINE_NOTIFICATION_TYPE(Notify_ShowMessage, MessageParams, "window/showMessage" * answer from the client. */ struct MessageActionItem { - /** - * A short title like 'Retry', 'Open Log' etc. - */ + /** + * A short title like 'Retry', 'Open Log' etc. + */ - std::string title; - MAKE_SWAP_METHOD(MessageActionItem, title) + std::string title; + MAKE_SWAP_METHOD(MessageActionItem, title) }; MAKE_REFLECT_STRUCT(MessageActionItem, title); struct ShowMessageRequestParams :public MessageParams { - /** - * The message action items to present. - */ - std::vector<MessageActionItem> actions; - - MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) + /** + * The message action items to present. + */ + std::vector<MessageActionItem> actions; + + MAKE_SWAP_METHOD(ShowMessageRequestParams, type, message, actions) }; MAKE_REFLECT_STRUCT(ShowMessageRequestParams, type, message, actions) diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/working_files.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/working_files.h index e305fee8d06..916268f0fa1 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/working_files.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/working_files.h @@ -44,9 +44,9 @@ struct WorkingFiles { bool GetFileBufferContent(const AbsolutePath& filename, std::wstring& out) { auto file = GetFileByFilename(filename); - if(!file) + if(!file) return false; - return GetFileBufferContent(file, out); + return GetFileBufferContent(file, out); } bool GetFileBufferContent(const AbsolutePath& filename,std::string& out) { diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h index 7e2d8bee0a6..d1d4bc85dfb 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/applyEdit.h @@ -8,20 +8,20 @@ struct ApplyWorkspaceEditParams { - /** - * The edits to apply. - */ + /** + * The edits to apply. + */ - lsWorkspaceEdit edit; + lsWorkspaceEdit edit; - /** - * An optional label of the workspace edit. This label is - * presented in the user interface for example on an undo - * stack to undo the workspace edit. - */ - std::string label; + /** + * An optional label of the workspace edit. This label is + * presented in the user interface for example on an undo + * stack to undo the workspace edit. + */ + std::string label; - MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) + MAKE_SWAP_METHOD(ApplyWorkspaceEditParams, edit, label) }; /** * The workspace/applyEdit request is sent from the server to the client to modify resource on the client side. @@ -32,9 +32,9 @@ MAKE_REFLECT_STRUCT(ApplyWorkspaceEditParams, edit, label); struct ApplyWorkspaceEditResponse { - bool applied; - boost::optional<std::string> failureReason; - MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) + bool applied; + boost::optional<std::string> failureReason; + MAKE_SWAP_METHOD(ApplyWorkspaceEditResponse, applied, failureReason) }; MAKE_REFLECT_STRUCT(ApplyWorkspaceEditResponse, applied, failureReason); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h index f7709aa6076..ad22bf0185a 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/configuration.h @@ -7,22 +7,22 @@ struct ConfigurationItem { - /** - * The scope to get the configuration section for. - */ - lsDocumentUri scopeUri; + /** + * The scope to get the configuration section for. + */ + lsDocumentUri scopeUri; - /** - * The configuration section asked for. - */ - std::string section; - MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); + /** + * The configuration section asked for. + */ + std::string section; + MAKE_SWAP_METHOD(ConfigurationItem, scopeUri, section); }; MAKE_REFLECT_STRUCT(ConfigurationItem, scopeUri, section); struct ConfigurationParams { - std::vector<ConfigurationItem> items; - MAKE_SWAP_METHOD(ConfigurationParams, items) + std::vector<ConfigurationItem> items; + MAKE_SWAP_METHOD(ConfigurationParams, items) }; MAKE_REFLECT_STRUCT(ConfigurationParams, items); @@ -34,4 +34,4 @@ MAKE_REFLECT_STRUCT(ConfigurationParams, items); * order of the passed ConfigurationItems (e.g. the first item in the response is the * result for the first configuration item in the params). */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceConfiguration, ConfigurationParams,std::vector<lsp::Any>, "workspace/configuration");
\ No newline at end of file +DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceConfiguration, ConfigurationParams,std::vector<lsp::Any>, "workspace/configuration"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h index 78f000f30d5..1c6cd83b62b 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/didChangeWorkspaceFolders.h @@ -5,30 +5,30 @@ * The workspace folder change event. */ struct WorkspaceFoldersChangeEvent { - /** - * The array of added workspace folders - */ + /** + * The array of added workspace folders + */ - std::vector<WorkspaceFolder> added; + std::vector<WorkspaceFolder> added; - /** - * The array of the removed workspace folders - */ + /** + * The array of the removed workspace folders + */ + + std::vector <WorkspaceFolder> removed; + MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); - std::vector <WorkspaceFolder> removed; - MAKE_SWAP_METHOD(WorkspaceFoldersChangeEvent, added, removed); - }; MAKE_REFLECT_STRUCT(WorkspaceFoldersChangeEvent, added, removed); struct DidChangeWorkspaceFoldersParams { - /** - * The actual workspace folder change event. - */ + /** + * The actual workspace folder change event. + */ + + WorkspaceFoldersChangeEvent event; - WorkspaceFoldersChangeEvent event; - - MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); + MAKE_SWAP_METHOD(DidChangeWorkspaceFoldersParams, event); }; MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); @@ -40,8 +40,8 @@ MAKE_REFLECT_STRUCT(DidChangeWorkspaceFoldersParams, event); * and ClientCapabilities/workspace/workspaceFolders are true; or if the server has * registered to receive this notification it first. */ -DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWorkspaceFolders, - DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders"); +DEFINE_NOTIFICATION_TYPE(Notify_WorkspaceDidChangeWorkspaceFolders, + DidChangeWorkspaceFoldersParams, "workspace/didChangeWorkspaceFolders"); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h index 8f8acceea41..3e7ca6ddede 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/did_change_configuration.h @@ -9,11 +9,11 @@ struct lsDidChangeConfigurationParams { - /** - * The actual changed settings. - */ - lsp::Any settings; - MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); + /** + * The actual changed settings. + */ + lsp::Any settings; + MAKE_SWAP_METHOD(lsDidChangeConfigurationParams, settings); }; MAKE_REFLECT_STRUCT(lsDidChangeConfigurationParams, settings); diff --git a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h index 7cedcfa5f48..1ba33b501cf 100644 --- a/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h +++ b/Build/source/utils/asymptote/LspCpp/include/LibLsp/lsp/workspace/workspaceFolders.h @@ -5,18 +5,18 @@ #include "LibLsp/lsp/lsDocumentUri.h" struct WorkspaceFolder { - /** - * The associated URI for this workspace folder. - */ + /** + * The associated URI for this workspace folder. + */ - lsDocumentUri uri; + lsDocumentUri uri; - /** - * The name of the workspace folder. Defaults to the uri's basename. - */ - std::string name; + /** + * The name of the workspace folder. Defaults to the uri's basename. + */ + std::string name; - MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) + MAKE_SWAP_METHOD(WorkspaceFolder, uri, name) }; MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); @@ -29,6 +29,6 @@ MAKE_REFLECT_STRUCT(WorkspaceFolder, uri, name); * an empty array if a workspace is open but no folders are configured, * the workspace folders otherwise. */ -DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceFolders, - boost::optional<JsonNull>, boost::optional<std::vector< WorkspaceFolder>>, "workspace/workspaceFolders"); +DEFINE_REQUEST_RESPONSE_TYPE(WorkspaceFolders, + boost::optional<JsonNull>, boost::optional<std::vector< WorkspaceFolder>>, "workspace/workspaceFolders"); |